Made python really optional

This commit is contained in:
Guilhem Lavaux 2016-04-26 13:10:24 +02:00
parent 984aa5e209
commit 9131e815c7
3 changed files with 12 additions and 9 deletions

View File

@ -8,11 +8,6 @@ include(ExternalProject)
include(FindPkgConfig)
include(FindPackageHandleStandardArgs)
include(FindPythonInterp)
set(NumPy_FIND_REQUIRED TRUE)
include(${CMAKE_SOURCE_DIR}/FindPyLibs.cmake)
include(${CMAKE_SOURCE_DIR}/FindNumPy.cmake)
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
option(BUILD_STATIC_LIBS "Build static libraries." ON)
option(ENABLE_SHARP "Enable SHARP support." ON)
@ -27,6 +22,13 @@ IF(USE_GIT_VERSION)
SET(EXTRA_VERSION "-${GIT_VER}")
ENDIF(USE_GIT_VERSION)
IF(BUILD_PYTHON)
include(FindPythonInterp)
set(NumPy_FIND_REQUIRED TRUE)
include(${CMAKE_SOURCE_DIR}/FindPyLibs.cmake)
include(${CMAKE_SOURCE_DIR}/FindNumPy.cmake)
ENDIF(BUILD_PYTHON)
#IF(NOT BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
# SET(CosmoTool_local CosmoTool_static)

View File

@ -71,6 +71,7 @@ if (INTERNAL_HDF5)
SET(HDF5_ROOTDIR ${HDF5_BIN_DIR})
SET(CONFIGURE_LDFLAGS "${CONFIGURE_LDFLAGS} -L${HDF5_BIN_DIR}/lib")
SET(CONFIGURE_LIBS "${CONFIGURE_LIBS} -ldl")
MESSAGE("Internal HDF5 directory: $ENV{HDF5_ROOT}")
else (INTERNAL_HDF5)
if(HDF5_ROOTDIR)
SET(ENV{HDF5_ROOT} ${HDF5_ROOTDIR})

View File

@ -854,16 +854,16 @@ def spherical_projection(int Nside,
N0 = outm.size
if booster < 0:
booster = 1000
booster = 1#000
job_done = view.array(shape=(N,), format="i", itemsize=sizeof(int))
job_done[:] = 0
theta,phi = hp.pix2ang(Nside, np.arange(N0))
with nogil, parallel():
if True:#nogil, parallel():
tid = smp_get_thread_id()
for i in prange(N0,schedule='dynamic',chunksize=256):
for i in range(N0):#prange(N0,schedule='dynamic',chunksize=256):
if progress != 0 and (i%booster) == 0:
with gil:
# with gil:
p.update(_mysum(job_done))
outm[i] = _spherical_projloop(theta[i], phi[i], density_view, min_distance, max_distance, shifter, integrator_id)
job_done[tid] += 1