diff --git a/GPy/kern/_src/stationary_utils.h b/GPy/kern/_src/stationary_utils.h index 9c9745fb..948362ff 100644 --- a/GPy/kern/_src/stationary_utils.h +++ b/GPy/kern/_src/stationary_utils.h @@ -1,3 +1,5 @@ +#ifndef __APPLE__ #include +#endif void _grad_X(int N, int D, int M, double*X, double* X2, double* tmp, double* grad); void _lengthscale_grads(int N, int D, int M, double* X, double* X2, double* tmp, double* grad); diff --git a/setup.py b/setup.py index b806a559..ef51cd3e 100644 --- a/setup.py +++ b/setup.py @@ -12,18 +12,31 @@ version = '0.6.1' def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() -#compile_flags = ["-march=native", '-fopenmp', '-O3', ] -compile_flags = [ '-fopenmp', '-O3', ] +#Mac OS X Clang doesn't support OpenMP th the current time. +#This detects if we are building on a Mac +def ismac(): + platform = sys.platform + ismac = False + if platform[:6] == 'darwin': + ismac = True + return ismac + +if ismac(): + compile_flags = [ '-O3', ] + link_args = [''] +else: + compile_flags = [ '-fopenmp', '-O3', ] + link_args = ['-lgomp'] ext_mods = [Extension(name='GPy.kern._src.stationary_cython', sources=['GPy/kern/_src/stationary_cython.c','GPy/kern/_src/stationary_utils.c'], include_dirs=[np.get_include()], extra_compile_args=compile_flags, - extra_link_args = ['-lgomp']), + extra_link_args = link_args), Extension(name='GPy.util.choleskies_cython', sources=['GPy/util/choleskies_cython.c'], include_dirs=[np.get_include()], - extra_link_args = ['-lgomp'], + extra_link_args = link_args, extra_compile_args=compile_flags), Extension(name='GPy.util.linalg_cython', sources=['GPy/util/linalg_cython.c'],