-
Notifications
You must be signed in to change notification settings - Fork 2
/
params.json
1 lines (1 loc) · 3.83 KB
/
params.json
1
{"name":"OpenMP 3.1/Clang","tagline":"A very preliminary implementation of the OpenMP® C/C++ language extensions in Clang/LLVM compiler ","body":"OpenMP is a specification for a set of compiler directives, library routines, and environment variables that can be used to specify shared memory parallelism in Fortran and C/C++ programs.\r\n# News\r\n-.-.- Initial release.\r\n\r\n# Try OpenMP 3.1/Clang\r\n## Getting the source code\r\n```\r\n$ git clone -b clang-omp https://github.com/clang-omp/llvm\r\n$ git clone -b clang-omp https://github.com/clang-omp/clang llvm/tools/clang\r\n$ git clone -b clang-omp https://github.com/clang-omp/compiler-rt llvm/projects/compiler-rt\r\n```\r\nThe source code structure follows Clang/LLVM: <http://llvm.org/docs/GettingStarted.html>. \r\nAlso you need to get and build an [Intel® OpenMP* Runtime Library](http://www.openmprtl.org/).\r\n## Building\r\nTo build clang with OpenMP 3.1 support just follow standard building procedure of clang/LLVM compiler (see [Getting Started: Building and Running Clang](http://clang.llvm.org/get_started.html)).\r\n\r\n## Using\r\nTo use the newly installed compiler, add the following to your environment. On Mac OS X, replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.\r\n\r\n```\r\nexport PATH=/install/prefix/bin:$PATH\r\nexport C_INCLUDE_PATH=/install/prefix/include:\\<OpenMP include path\\>:$C_INCLUDE_PATH\r\nexport CPLUS_INCLUDE_PATH=/install/prefix/include:\\<OpenMP include path\\>:$CPLUS_INCLUDE_PATH\r\nexport LIBRARY_PATH=/install/prefix/lib:\\<OpenMP library path\\>:$LIBRARY_PATH\r\nexport LD_LIBRARY_PATH=/install/prefix/lib:\\<OpenMP library path\\>:$LD_LIBRARY_PATH\r\n```\r\nWhen you build a program that uses OpenMP®, add the following options to enable OpenMP support and link to the runtime library.\r\n```\r\n-Xclang -fopenmp -liomp5\r\n```\r\n## A simple example\r\n```\r\n#include <assert.h>\r\n#include <stdio.h>\r\nconst int N=4;\r\nint main(void) {\r\n int A[N][N] = {{2,5,4,5},\r\n {2,8,12,3},\r\n {83,3342,11,2},\r\n {23,67,0,-23}};\r\n int B[N][N] = {{43,67,9,4},\r\n {-12,324,0,45},\r\n {3,9,4,-7},\r\n {23,4,68,9}};\r\n int C[N][N], C1[N][N];\r\n int i, j, k;\r\n printf(\"---- Serial\\n\");\r\n for (i = 0; i < N; ++i) {\r\n for (j = 0; j < N; ++j) {\r\n int Sum = 0;\r\n for (k = 0; k < N; ++k) {\r\n Sum += A[i][k] * B[k][j];\r\n }\r\n C[i][j] = Sum;\r\n }\r\n }\r\n printf(\"---- Parallel\\n\");\r\n #pragma omp parallel for collapse(2)\r\n for (i = 0; i < N; ++i) {\r\n for (j = 0; j < N; ++j) {\r\n int Sum = 0;\r\n #pragma omp parallel for\r\n for (k = 0; k < N; ++k) {\r\n Sum += A[i][k] * B[k][j];\r\n }\r\n C1[i][j] = Sum;\r\n }\r\n }\r\n printf(\"---- Check\\n\");\r\n for (i = 0; i < N; i++) {\r\n for (j = 0; j < N; j++) {\r\n assert (C[i][j] == C1[i][j]);\r\n }\r\n }\r\n printf(\"Passed\\n\");\r\n return 0;\r\n}\r\n```\r\nConfirm that the compiler is working correctly by saving the above code code to a file.\r\n```\r\n$ clang -Xclang -fopenmp -liomp5 test.c -o test\r\n$ ./test\r\n```\r\n## Supported platforms\r\nOS: Linux or Mac OS X\r\nArchitecture: x86-64\r\n\r\n## Known issues\r\n1. Using variable-length arrays in a OpenMP regions does not work yet.\r\n\r\n## License\r\nLLVM, Clang, and Compiler-rt are distributed under LLVM's [\"UIUC\" BSD-Style license](http://llvm.org/docs/DeveloperPolicy.html#license). For details, including information about third-party components, see LICENSE.txt in the code repositories.\r\n\r\n## Contact\r\nIf you would like to report a bug, or make a feature request, you can submit an issue in Github [here](https://github.com/clang-omp/clang/issues).\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}