mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-08 15:05:15 +02:00
Fixes Cython compilation on Mac OS X
This commit is contained in:
parent
e7a9b53506
commit
d904045663
2 changed files with 19 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#ifndef __APPLE__
|
||||
#include <omp.h>
|
||||
#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);
|
||||
|
|
|
|||
21
setup.py
21
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'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue