Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Compiling and Runing an OpenMP code with Intel Fortran 11.1 on Mac OS X from the command line

Andreas_Hoffie
Beginner
652 Views

Hi All,

I am trying to compile and run an OpenMP code (that worked under Linux) from the command line from Mac without success so far:

to compile I enter (F77):

" ifort -o 'executable' 'sourcecode.f' -openmp "

export OMP variable (for example):

" export OMP_NUM_THREADS=2 "

and to run the code:

" ./'executable' "

This gives me the following error message:

"

dyld: Library not loaded: libiomp5.dylib
Referenced from: /Users/andreasf/2_CLASSES/fall2009/MAE_609-HighPerformanceComputing/HW-2_OMP&MPI/./pi
Reason: image not found
Trace/BPT trap

"

What am I doing wrong?

Does the path for the omp libraries have to be included in the .bashrc? This is the line in my .bashrc so far:/opt/intel/Compiler/11.1/080/bin/ifortvars.sh intel64.

How does the procedure look like, if F90 is used?

Thank you!

Andreas

0 Kudos
3 Replies
Xiaoping_D_Intel
Employee
652 Views

The error was caused by missing ifort environment variables. The correct line is:

source /opt/intel/Compiler/11.1/080/bin/ifortvars.sh intel64

If you want to set it up in your login shell the line needs to be put into ".bash_login" or ".bash_profile" instead of ".bashrc".

0 Kudos
Andreas_Hoffie
Beginner
652 Views
Its working. Thank you!
0 Kudos
ILeao
Novice
652 Views

 

 I found two simple solutions for this drawback:

Solution 1 : using install_name_tool  fort for libiomp5.dylib in your executable file only (if you recompile you'll need to do this again...)

 

install_name_tool -change libiomp5.dylib /opt/intel/composer_xe_2013_sp1.2.139/compiler/lib/libiomp5.dylib /executable_file

 

solution 2 : it's a similar solution provided by xiaoping-duan (valid until reboot only) if you don't use any other fortran compile on mac as I, put it .bash_profile. Take care only .bash_profile to run on MAC OS x is a little bit weird! Please check the following link http://apple.stackexchange.com/questions/107441/os-x-mavericks-bash-profile-paths-dont-work

 

 

source /opt/intel/composer_xe_2013_sp1.2.139/bin/ifortvars.sh  intel64

 

and now it`s working fine...

 

Best wishes,

 

ileao

 

 

 

0 Kudos
Reply