| 84 | |
| 85 | == How to compile OpenMP C programs ? == |
| 86 | === GCC === |
| 87 | Env: gcc version 4.2.3 (Debian 4.2.3-5) [[BR]] |
| 88 | Example: /home/rider/openmp/examples/omp_hello.c [[BR]] |
| 89 | rider@hd05:~/openmp/example$ gcc -fopenmp -g omp_hello.c -o hello [[BR]] |
| 90 | |
| 91 | === icc (Intel® Compiler) === |
| 92 | Env: icc version 10.1 [[BR]] |
| 93 | Example: /home/rider/openmp/examples/omp_hello.c [[BR]] |
| 94 | rider@hd05:~/openmp/example$ icc hello -openmp -o omp_hello.c [[BR]] |
| 95 | |
| 96 | == How to compile OpenMP Fortran programs ? == |
| 97 | === ifort (Intel® Compiler) === |
| 98 | Env: ifort version 10.1 [[BR]] |
| 99 | Example: /home/rider/openmp/examples/omp_hello.c [[BR]] |
| 100 | rider@hd05:~/openmp/example$ ifort hello -openmp -o omp_hello.f [[BR]] |
| 101 | |
| 102 | Caution: [[BR]] |
| 103 | To activate the OpenMP extensions for C/C++ and Fortran, the compile-time flag '''-fopenmp''' must be specified. This enables the OpenMP directive #pragma omp in C/C++ and !$omp directives in free form, c$omp, *$omp and !$omp directives in fixed form, !$ conditional compilation sentinels in free form and c$, *$ and !$ sentinels in fixed form, for Fortran. The flag also arranges for automatic linking of the OpenMP runtime library. [[BR]] |
| 104 | |
| 105 | Reference: GCC 4.2.3 GNU OpenMP Manual -> http://gcc.gnu.org/onlinedocs/gcc-4.2.3/libgomp/ [[BR]] |
| 106 | |
| 107 | |