Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Trouble with example makefile

Michael_Stauffer
Beginner
607 Views
MKL for OSX, installed as a part of Intel C++ Compiler Pro 11

I had a little trouble with the cblas makefile for the examples. The RTLlibiomp5.dylib was not found when the makefile runs the example program. Had to add the top-level lib folder to DYLD_LIBRARY_PATH in the makefile like so:

...
MKL_TOP_LIB = /opt/intel/Compiler/11.0/059/lib
...
$(RES): %.res: %.c
mkdir -p ./$(RES_DIR)
$(CC) -w $(OPT_M64) $(COPTS) -I$(MKLROOT)/include $< source/common_func.c -L$(MKL_PATH) $(MKL_LIBS) -lpthread -lm -o $(RES_DIR)/$*.out
export DYLD_LIBRARY_PATH=$(MKL_PATH):$(MKL_TOP_LIB):$(DYLD_LIBRARY_PATH); $(RES_DIR)/$*.out data/$*.d >$(RES_DIR)/$@
...

I figure this is from a different dir layout between the standalone MKL install and the Compiler install?
A quick check looks like it's the same for other makefiles.

An aside about thescripts for settingenvironment variables in tools/environment (mklvars32.sh, etc.): I'm basically a shell newbie again (it's been a very long time) so please help me out. How are these scripts useful? If I run them on their own, the env vars that they set are not exported to the calling script or shell, so I'd have to add my build script into these scripts to have the exports be usable. What am I missing? Thanks.

Cheers,
Michael
0 Kudos
3 Replies
Andrey_Bespalov
New Contributor I
607 Views
Please, use compilers scripts (like iccvars.sh) to correctly set compiler's environment.
In particular this script set correct path to libiomp5.dylib.

0 Kudos
TimP
Honored Contributor III
607 Views
With the current compiler, it should be sufficient to "source" the compiler script
source /opt/intel/Compiler/11.0/059/bin/iccvars.sh intel64|ia32
in order to set PATHs for both compiler and MKL.
If you don't like to do this, it's up to you to choose your alternate method, no point in complaining here if your choice is more awkward. The most common customer adjustment would be to add that source command to a login profile.
0 Kudos
Michael_Stauffer
Beginner
607 Views
Quoting - tim18
With the current compiler, it should be sufficient to "source" the compiler script
source /opt/intel/Compiler/11.0/059/bin/iccvars.sh intel64|ia32
in order to set PATHs for both compiler and MKL.
If you don't like to do this, it's up to you to choose your alternate method, no point in complaining here if your choice is more awkward. The most common customer adjustment would be to add that source command to a login profile.

Thanks to you both, the iccvars.sh and the 'source' builtin are the answer. It's not that I didn't want to do it this way, but I didn't know how to do it this way, so thanks for helping me.

Cheers
0 Kudos
Reply