Fixes to compile on OSX
This commit is contained in:
parent
170e7b7020
commit
bf0874bbd3
@ -1,5 +1,6 @@
|
||||
set(CMAKE_SHARED_MODULE_PREFIX)
|
||||
|
||||
|
||||
include_directories(${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src ${CMAKE_SOURCE_DIR}/python)
|
||||
|
||||
IF(CYTHON)
|
||||
@ -39,7 +40,10 @@ add_library(_project MODULE ${CMAKE_CURRENT_BINARY_DIR}/_project.cpp)
|
||||
|
||||
|
||||
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Bsymbolic-functions")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Bsymbolic-functions")
|
||||
if(APPLE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
|
||||
target_link_libraries(_cosmotool ${CosmoTool_local} ${PYTHON_LIBRARIES} ${GSL_LIBRARIES})
|
||||
target_link_libraries(_cosmo_power ${CosmoTool_local} ${PYTHON_LIBRARIES} ${GSL_LIBRARIES})
|
||||
|
@ -1,4 +1,6 @@
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/multi_array.hpp>
|
||||
@ -171,7 +173,11 @@ void CosmoTool_compute_bispectrum(
|
||||
{
|
||||
// First remap to multi_array for easy access
|
||||
size_t kNz = Nz/2+1;
|
||||
#ifdef _OPENMP
|
||||
int Ntasks = omp_get_max_threads();
|
||||
#else
|
||||
int Ntasks = 1;
|
||||
#endif
|
||||
boost::multi_array_ref<std::complex<double>, 3> a_delta(reinterpret_cast<std::complex<double>*>(delta_hat), boost::extents[Nx][Ny][kNz]);
|
||||
boost::multi_array_ref<size_t, 3> a_Nt(Ntriangles, boost::extents[Nk][Nk][Nk]);
|
||||
boost::multi_array_ref<std::complex<double>, 3> a_B(reinterpret_cast<std::complex<double>*>(B), boost::extents[Nk][Nk][Nk]);
|
||||
@ -190,6 +196,7 @@ void CosmoTool_compute_bispectrum(
|
||||
delta_mirror[n1.i1][n1.i2][n1.i3] = std::conj(delta_mirror[n2.i1][n2.i2][n2.i3]);
|
||||
}
|
||||
|
||||
#ifdef _OPENMP
|
||||
// First loop over m1
|
||||
#pragma omp parallel
|
||||
{
|
||||
@ -236,6 +243,9 @@ void CosmoTool_compute_bispectrum(
|
||||
a_B_p[q] += b_B_p[q];
|
||||
}
|
||||
}
|
||||
#else
|
||||
#warning Serial version not implemented
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,6 +9,9 @@ cimport cython
|
||||
|
||||
np.import_array()
|
||||
|
||||
cdef extern from "sys/types.h":
|
||||
ctypedef np.int64_t int64_t
|
||||
|
||||
cdef extern from "loadSimu.hpp" namespace "CosmoTool":
|
||||
|
||||
cdef cppclass SimuData:
|
||||
@ -20,7 +23,7 @@ cdef extern from "loadSimu.hpp" namespace "CosmoTool":
|
||||
np.float_t Omega_Lambda
|
||||
np.int64_t TotalNumPart
|
||||
np.int64_t NumPart
|
||||
np.int64_t *Id
|
||||
int64_t *Id
|
||||
float *Pos[3]
|
||||
float *Vel[3]
|
||||
int *type
|
||||
@ -323,7 +326,7 @@ cdef object wrap_array(void *p, np.uint64_t s, int typ):
|
||||
cdef object wrap_float_array(float *p, np.uint64_t s):
|
||||
return wrap_array(<void *>p, s, np.NPY_FLOAT32)
|
||||
|
||||
cdef object wrap_int64_array(np.int64_t* p, np.uint64_t s):
|
||||
cdef object wrap_int64_array(int64_t* p, np.uint64_t s):
|
||||
return wrap_array(<void *>p, s, np.NPY_INT64)
|
||||
|
||||
cdef object wrap_int_array(int* p, np.uint64_t s):
|
||||
@ -501,7 +504,7 @@ def writeGadget(str filename, object simulation):
|
||||
simdata.Vel[j] = <float *>vel.data
|
||||
|
||||
ids = simulation.getIdentifiers()
|
||||
simdata.Id = <np.int64_t *>ids.data
|
||||
simdata.Id = <int64_t *>ids.data
|
||||
simdata.BoxSize = simulation.getBoxsize()
|
||||
simdata.time = simulation.getTime()
|
||||
simdata.Hubble = simulation.getHubble()
|
||||
|
Loading…
Reference in New Issue
Block a user