I am working on a python project that uses cython and c to speed up time sensitive operations. In several of our cython routines, we use openmp to speed things up if free kernels are available.
This leads to some annoying situation in OS X, since the default compiler for recent OS versions (llvm / clang on 10.7 and 10.8) does not support openmp. Our great solution is to tell people how to install gcc as their compiler when they are created. We really would like to do this programmatically, since clang can do the rest without any problems.
At the moment, compilation will fail:
clang: error: linker command failed with exit code 1 (use -v to see invocation) error: Command "cc -bundle -undefined dynamic_lookup -L/usr/local/lib -L/usr/local/opt/sqlite/lib build/temp.macosx-10.8-x86_64-2.7/yt/utilities/lib/geometry_utils.o -lm -o yt/utilities/lib/geometry_utils.so -fopenmp" failed with exit status 1
The relevant part of our installation script is as follows:
config.add_extension("geometry_utils", ["yt/utilities/lib/geometry_utils.pyx"], extra_compile_args=['-fopenmp'], extra_link_args=['-fopenmp'], libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
The full setup.py file is here .
Is there a way to programmatically test openmp support from within a script installation?
python openmp distutils
ngoldbaum
source share