= OpenMP Usage = == OpenMP Installation == OpenMP Compilers: http://openmp.org/wp/openmp-compilers/ == Omni OpenMP Compiler Installation == Env: '''Debian 4.0 amd64 2.6.20-krg SMP with Kerrighed 2.3.0''' [[BR]] Step1: rider@hd05:~$ wget http://www.hpcc.jp/Omni/ftp/Omni/Omni-1.6.tar.gz [[BR]] Step2: rider@hd05:~$ tar zxvf Omni-1.6.tar.gz[[BR]] Step3: rider@hd05:~$ cd Omni-1.6[[BR]] Step4: rider@hd05:~$ ./configure --prefix=/opt/openmp[[BR]] Step5: rider@hd05:~$ make & make install[[BR]] Step6: rider@hd05:~$ export OMPC_NUM_PROCS=16 (Kerrighed_machines: node0~node4) [[BR]] Step7: rider@hd05:~$ export OMPC_BIND_PROCS=true [[BR]] Step8: rider@hd05:~$ export OMPC_LOG=1 (for debug)[[BR]] == Omni OpenMP Compiler Installation with enable-Kerrighed patch == Step4: rider@hd05:~$ wget http://131.254.254.17/download/Omni-1.4-krg-0.72.patch (Need to make some changes - revising) [[BR]] Step5: rider@hd05:~$ patch -p1 -d Omni1.6 < Omni-1.4-krg-0.72.patch[[BR]] Step6: rider@hd05:~$ cd Omni-1.6[[BR]] Step7: rider@hd05:~$ ./configure --with-thread=pthread --enable-gcc --enable-kerrighed --enable-shmem --with-lock=mutex --prefix=/opt/openmp [[BR]] Step8: rider@hd05:~$ make & make install[[BR]] Step9: rider@hd05:~$ export OMPC_NUM_PROCS=16 (Kerrighed_machines: node0~node4) [[BR]] Step10: rider@hd05:~$ export OMPC_BIND_PROCS=true [[BR]] Step11: rider@hd05:~$ export OMPC_LOG=1 (for debug)[[BR]] Note: [[BR]] rider@hd05:~/openmp/Omni-1.6$ gcc -v [[BR]] Using built-in specs. [[BR]] Target: x86_64-linux-gnu [[BR]] Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-libmudflap --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu [[BR]] Thread model: posix [[BR]] '''Caution: gcc version 4.2.3 (Debian 4.2.3-5)''' [[BR]] === Directions Part1 === OpenMP e-Learning: https://computing.llnl.gov/tutorials/openMP/ [[BR]] OpenMP Omni Environment Variables: http://phase.hpcc.jp/Omni/Omni-doc/environment.html [[BR]] OpenMP Omni OpenMP C Compiler: http://phase.hpcc.jp/Omni/Omni-doc/omcc.html [[BR]] OpenMP Omni OpenMP C Compile: http://phase.hpcc.jp/Omni/Omni-doc/ompcc.html [[BR]] OpenMP Exercise: https://computing.llnl.gov/tutorials/openMP/exercise.html [[BR]] === Directions Part2 === -- The environment variable OMPC_NUM_PROCS specifies the number of threads to execute the program. For example, you want to use 4 threads, setenv OMPC_NUM_PROCS 4 -- If the environment variable OMPC_NUM_PROCS is not set, check the number of physical processors in your platform. The same number of threads are created as the number of physical processor. In Linux and Solaris platforms, the runtime system checks the number of processors. Otherwise, the current version uses a compile-time constant N_PROC_DEFALUT (currently 4) in "ompclib.h" as the number of threads. [[BR]] -- If the environment variable OMP_NUM_THREADS is set and its value is greater than the number of threads described above, the value of OMP_NUM_THREADS is used as the max number of threads. == Intel C++ Compiler Installation == Step1: Download the Intel C++ Compiler from http://www.intel.com/cd/software/products/asmo-na/eng/340679.htm [[BR]] Step2: rider@hd05:~$ tar zxvf l_cc_p_10.1.015_intel64.tar.gz (ver: Intel(R)64) [[BR]] Step3: rider@hd05:~$ cd l_cc_p_10.1.015_intel64 [[BR]] Step4: rider@hd05:~$ ./install.sh ( Follow the installation steps -> Free code: NZCR-FZ66ZWWD [[BR]] Step5: Confirm your installation path: /opt/intel/cce/10.1.015/ [[BR]] Step6: source /opt/intel/cce/10.1.015/bin/iccvars.sh or export PATH=$PATH:/opt/intel/cce/10.1.015/bin to your /etc/profile [[BR]] Step7: icc -help (If it works fine than it's done) [[BR]] == Intel Fortran Compiler Installation == Step1: Download the Intel Fortran Compiler from http://www.intel.com/cd/software/products/asmo-na/eng/340679.htm [[BR]] Step2: rider@hd05:~$ tar zxvf l_fc_p_10.1.015_intel64.tar.gz [[BR]] Step3: rider@hd05:~$ cd l_fc_p_10.1.015_intel64 [[BR]] Step4: rider@hd05:~$ ./install.sh ( Follow the installation steps -> Free code: NRDN-29Z6K5WT [[BR]] Step5: Confirm your installation path: /opt/intel/fce/10.1.015/ [[BR]] Step6: source /opt/intel/fce/10.1.015/bin/ifortvars.sh or export PATH=$PATH:/opt/intel/fce/10.1.015/bin [[BR]] Step7: ifort -help (If it works fine than it's done) [[BR]] == Intel Threading Analysis Tool == Step1: Donwload the Intel Threading Analysis Tool from https://registrationcenter.intel.com/RegCenter/AutoGen.aspx?ProductID=893&AccountID=&ProgramID=&RequestDt=&rm=EVAL&lang= [[BR]] Step2: rider@hd05:~$ tar zxvf Tcheck3.1_009cli_lin.tar.gz [[BR]] Step3: rider@hd05:~$ sudo chmod -R a+rx Tcheck3.1_009cli_lin [[BR]] Step4: rider@hd05:~$ cd Tcheck3.1_009cli_lin [[BR]] Step5: rider@hd05:~$ ./install.sh [[BR]] Step6: Confirm your installation path: /opt/intel/itt [[BR]] Step7: source /opt/intel/itt/tcheck/bin/32e/tcheckvars.sh [[BR]] Step8: tcheck_cl -help (If it works fine than it's done) [[BR]] == How to compile OpenMP C programs ? == === GCC === Env: gcc version 4.2.3 (Debian 4.2.3-5) [[BR]] Example: /home/rider/openmp/examples/omp_hello.c [[BR]] rider@hd05:~/openmp/example$ gcc -fopenmp -g omp_hello.c -o hello [[BR]] === icc (Intel® Compiler) === Env: icc version 10.1 [[BR]] Example: /home/rider/openmp/examples/omp_hello.c [[BR]] rider@hd05:~/openmp/example$ icc hello -openmp -o omp_hello.c [[BR]] == How to compile OpenMP Fortran programs ? == === ifort (Intel® Compiler) === Env: ifort version 10.1 [[BR]] Example: /home/rider/openmp/examples/omp_hello.c [[BR]] rider@hd05:~/openmp/example$ ifort hello -openmp -o omp_hello.f [[BR]] Caution: [[BR]] 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]] Reference: GCC 4.2.3 GNU OpenMP Manual -> http://gcc.gnu.org/onlinedocs/gcc-4.2.3/libgomp/ [[BR]] == Example OpenMP Code Structure == === Fortran - General Code Structure === {{{ PROGRAM HELLO //Program_Name: HELLO // OpenMP Directives INTEGER VAR1, VAR2, VAR3 Serial code . . . Beginning of parallel section. Fork a team of threads. Specify variable scoping !$OMP PARALLEL PRIVATE(VAR1, VAR2) SHARED(VAR3) // OpenMP Directives Parallel section executed by all threads . . // Parallel Region . All threads join master thread and disband !$OMP END PARALLEL // OpenMP Directives Resume serial code . . . END }}} === C / C++ - General Code Structure === {{{ #include //include the OpenMP header main () { int var1, var2, var3; Serial code . . . Beginning of parallel section. Fork a team of threads. Specify variable scoping #pragma omp parallel private(var1, var2) shared(var3) // OpenMP Directives { Parallel section executed by all threads . . // Parallel Region . All threads join master thread and disband } Resume serial code . . . } }}} [[BR]] '''Conclusion''': EZ Code Revision - All you need to do is just parallelize the loop in your code by following the structure. Enjoy Using OpenMP ! [[BR]] [[BR]] =================================================================================================[[BR]] '''More Information from Kerrighed Dev Team''' Information for Kerrighed & OpenMP Users [[BR]] From: DR. Renaud Lottiaux [[BR]] To: Rider [[BR]] Kerlabs [[BR]] B漮iment Germanium [[BR]] 80, avenue des buttes de Co褭mes [[BR]] 35700 Rennes - France [[BR]] Phone : (+33|0)6 80 89 19 34 [[BR]] Fax : (+33|0)2 99 84 71 71 [[BR]] Email : Renaud.Lottiaux@kerlabs.com [[BR]] Web : http://www.kerlabs.com/ [[BR]] Hi ! Currently, the openMP support has been disabled. More generally, the support for distributed threads is no more functionnal. We plan to re-enable this feature in the future, but we don't yet have a release date for this. Regards. R. Rider: [[BR]] This is the mail wrote to DR.Renaud Lottiaux for kerrighed help, and it seems that kerrighed no longer support OpenMP for now. Maybe in the future kerrighed will enable it. [[BR]]