Skip to content

Instantly share code, notes, and snippets.

@metacollin
Last active July 2, 2016 02:22
Show Gist options
  • Select an option

  • Save metacollin/891097a6767e677f3cf5e266ff4c2e2d to your computer and use it in GitHub Desktop.

Select an option

Save metacollin/891097a6767e677f3cf5e266ff4c2e2d to your computer and use it in GitHub Desktop.

Revisions

  1. metacollin revised this gist Jul 2, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -10,9 +10,9 @@ brew install clang-omp
    Then we need to set the environment:

    ```bash
    export C_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150401/include/libiomp:$C_INCLUDE_PATH
    export CPLUS_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150401/include/libiomp:$CPLUS_INCLUDE_PATH
    export LIBRARY_PATH=/usr/local/Cellar/libiomp/20150401/lib:$LIBRARY_PATH
    export C_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150701/include/libiomp:$C_INCLUDE_PATH
    export CPLUS_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150701/include/libiomp:$CPLUS_INCLUDE_PATH
    export LIBRARY_PATH=/usr/local/Cellar/libiomp/20150701/lib:$LIBRARY_PATH
    ```

    We create a file for testing:
  2. @fyears fyears created this gist Jun 7, 2015.
    35 changes: 35 additions & 0 deletions note.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    Refer to https://clang-omp.github.io/ .

    We need to install something:

    ```bash
    brew install libiomp
    brew install clang-omp
    ```

    Then we need to set the environment:

    ```bash
    export C_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150401/include/libiomp:$C_INCLUDE_PATH
    export CPLUS_INCLUDE_PATH=/usr/local/Cellar/libiomp/20150401/include/libiomp:$CPLUS_INCLUDE_PATH
    export LIBRARY_PATH=/usr/local/Cellar/libiomp/20150401/lib:$LIBRARY_PATH
    ```

    We create a file for testing:

    ```c
    /* hello.c */
    #include <omp.h>
    #include <stdio.h>
    int main() {
    #pragma omp parallel
    printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
    }
    ```

    Then compile it using `clang-omp` or `clang-omp++`:

    ```bash
    clang-omp -fopenmp hello.c -o hello
    ./hello
    ```