Logo Cineca Logo SCAI
MARCONI status
GALILEO100 status
Marconi100 status

You are here

Hello World - Native mode (OpenMP)


Here you'll find a simple "hallo world" program using OpenMP directives.


First you have to load the correct compiler and fix the environment

module load intel (i.e. compiler suite)
source $INTEL_HOME/bin/compilervars.sh intel64 (to set up the environment variables)


Now you can cross-compile the code for running on the MIC coprocessor:

C: icc hello_opemp.c -openmp -mmic -o hello_opemp_C.x
Fortran: ifort hello_opemp.F90 -openmp -mmic -o hello_opemp_F.x


Now you have to enter, via ssh (see here) directly to the MIC reserved for you, and there you have to setup environment variables

export LD_LIBRARY_PATH=/cineca/prod/compilers/intel/cs-xe-2013/binary/lib/mic:${LD_LIBRARY_PATH}


Finally you can run the programs, setting the number of threads to use

export OMP_NUM_THREADS=120
Hello from 16
Hello from 76
Hello from 64
Hello from 4
Hello from 32
Hello from 0
Hello from 3
Hello from 114
Hello from 54


export OMP_NUM_THREADS=120
Hello from 39
Hello from 113
Hello from 53
Hello from 23
Hello from 83
Hello from 29
Hello from 103
Hello from 43