Last active
July 2, 2016 02:22
-
-
Save metacollin/891097a6767e677f3cf5e266ff4c2e2d to your computer and use it in GitHub Desktop.
Revisions
-
metacollin revised this gist
Jul 2, 2016 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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/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: -
fyears created this gist
Jun 7, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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 ```