Can Cython Be Compiled With Icc?
Solution 1:
CC=icc
is not enough to build with icc. You should also link with icc (https://stackoverflow.com/a/10891764/196561; icc will add its internal libraries to ELF file), so find name of linker variable for your setup.py, probably LD
and set it to icc too LD=icc
(default is probably gcc).
Actually it is LINKCC
- https://github.com/cython/cython/blob/970c2fc0e676ca22016e14147ada0edba937dc6b/Cython/Build/BuildExecutable.py
CC = get_config_var('CC', os.environ.get('CC', ''))
CFLAGS = get_config_var('CFLAGS') + ' ' + os.environ.get('CFLAGS', '')
LINKCC = get_config_var('LINKCC', os.environ.get('LINKCC', CC))
So, correct build for cython with icc should be with CC=icc LINKCC=icc
, don't know how variables should be passed into setup.py, check How to tell distutils to use gcc? or try
CC=icc LINKCC=icc python3.4 setup.py
Update: According to message from gansub, "LDSHARED=icc
" env. variable will help to build cython: "You need to set the environment variable LDSHARED=icc" - https://chat.stackoverflow.com/transcript/message/31231907#31231907 and https://stackoverflow.com/a/37914227
Update from Syrtis Major: There is article "Thread Parallelism in Cython*" https://software.intel.com/en-us/articles/thread-parallelism-in-cython by Nguyen, Loc Q (Intel), December 15, 2016 with recommendation of LDSHARED="icc -shared" CC=icc
:
To explicitly use the Intel icc to compile this application, execute the setup.py file with the following command:
$ LDSHARED="icc -shared" CC=icc python setup.py build_ext --inplace
Post a Comment for "Can Cython Be Compiled With Icc?"