From 8b2f0f755784e0a21c0893a36dbf9043283accc1 Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sat, 26 Nov 2016 21:43:49 +0100 Subject: [PATCH] Fixed boost dependency. Fixed I/O in test bispectrum --- external/external_build.cmake | 2 ++ python/CMakeLists.txt | 4 +++- python_sample/test_bispectrum.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/external/external_build.cmake b/external/external_build.cmake index 4502eca..ae8242a 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -155,9 +155,11 @@ if (INTERNAL_BOOST) set(Boost_INCLUDE_DIRS ${BOOST_SOURCE_DIR} CACHE STRING "Boost path" FORCE) set(Boost_LIBRARIES ${BOOST_SOURCE_DIR}/stage/lib/libboost_python.a CACHE STRING "Boost libraries" FORCE) set(Boost_FOUND YES) + set(Boost_DEP boost) ELSE (INTERNAL_BOOST) find_package(Boost 1.53) + set(Boost_DEP) endif (INTERNAL_BOOST) mark_as_advanced(Boost_INCLUDE_DIRS Boost_LIBRARIES) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index da3aaac..da703d4 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -54,7 +54,9 @@ if (Boost_FOUND) include_directories(${Boost_INCLUDE_DIRS}) add_library(_cosmo_bispectrum MODULE _cosmo_bispectrum.cpp) target_link_libraries(_cosmo_bispectrum ${MATH_LIBRARY}) - add_dependencies(_cosmo_bispectrum boost) + if (Boost_DEP) + add_dependencies(_cosmo_bispectrum ${Boost_DEP}) + endif() SET(ct_TARGETS ${ct_TARGETS} _cosmo_bispectrum) endif() diff --git a/python_sample/test_bispectrum.py b/python_sample/test_bispectrum.py index 1737a04..2d509f0 100644 --- a/python_sample/test_bispectrum.py +++ b/python_sample/test_bispectrum.py @@ -17,7 +17,7 @@ def myfun(N): y = BB/x - np.savez("bispec_%d.npy" % N, y=y, B=B, P=P, rho=rho); + np.savez("bispec_%d.npz" % N, y=y, B_nt=B[0], B_r=B[1], P_n=P[0], P=P[1], rho=rho); print( timeit.timeit('from __main__ import myfun; myfun(16)', number=1) )