From 9131e815c7486585bf674783d82fd2756c7092e5 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Tue, 26 Apr 2016 13:10:24 +0200 Subject: [PATCH] Made python really optional --- CMakeLists.txt | 12 +++++++----- external/external_build.cmake | 1 + python/_project.pyx | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d80ba35..d8b4c96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/external/external_build.cmake b/external/external_build.cmake index a1878d9..8c7ad4f 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -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}) diff --git a/python/_project.pyx b/python/_project.pyx index 9c52e99..253b369 100644 --- a/python/_project.pyx +++ b/python/_project.pyx @@ -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