diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ef422f..c7b3581 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux") SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2") SET(CPACK_PACKAGE_VERSION_MAJOR "1") SET(CPACK_PACKAGE_VERSION_MINOR "2") -SET(CPACK_PACKAGE_VERSION_PATCH "2${EXTRA_VERSION}") +SET(CPACK_PACKAGE_VERSION_PATCH "3${EXTRA_VERSION}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") SET(CPACK_STRIP_FILES "lib/libCosmoTool.so") SET(CPACK_SOURCE_IGNORE_FILES diff --git a/MANIFEST.in b/MANIFEST.in index 8d92fca..5c4f363 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -86,6 +86,7 @@ include sample/testSmooth.cpp include sample/test_cosmopower.cpp include sample/test_fft_calls.cpp include sample/test_healpix_calls.cpp +include sample/test_special.cpp include sample/testkd.cpp include sample/testkd2.cpp include sample/testkd3.cpp @@ -167,3 +168,4 @@ include src/tf_fit.hpp include src/yorick.hpp include src/yorick_nc3.cpp include src/yorick_nc4.cpp +include src/special_math.hpp diff --git a/conda/conda_build_config.yaml b/conda/conda_build_config.yaml index 288df1f..1f026b6 100644 --- a/conda/conda_build_config.yaml +++ b/conda/conda_build_config.yaml @@ -1,8 +1,10 @@ python: - - 3.7 - - 3.8 - 3.9 + - 3.8 + - 3.7 numpy: - - 1.11 - 1.19 + +gsl: + - 2.4 diff --git a/conda/meta.yaml b/conda/meta.yaml index 249bebd..333a565 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -1,48 +1,50 @@ package: name: cosmotool - version: "1.2.2" + version: "1.2.3" source: - git_rev: 03033b6 + git_rev: a86c9a8 git_url: https://bitbucket.org/glavaux/cosmotool requirements: build: - - numpy >=1.11 + - python # [build_platform != target_platform] + - cross-python_{{ target_platform }} # [build_platform != target_platform] + - cython # [build_platform != target_platform] + - numpy # [build_platform != target_platform] - {{ compiler('c') }} - {{ compiler('cxx') }} - - python - - setuptools - - cython - - healpy - - numexpr - - cffi - - pyfftw - - gsl - - h5py + - llvm-openmp # [osx] + - libgomp # [linux] host: - python + - pip + - numpy + - pkgconfig - numexpr - cython - healpy - cffi - pyfftw - - gsl + - gsl {{ gsl }} - h5py - run: - - numpy - python + - {{ pin_compatible('numpy') }} - healpy - numexpr - cffi - pyfftw - h5py + - {{ pin_compatible('gsl') }} + - llvm-openmp test: imports: - cosmotool + requires: + - pip about: home: https://bitbucket.org/glavaux/cosmotool diff --git a/external/external_build.cmake b/external/external_build.cmake index 5459427..bbe3e77 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -8,7 +8,7 @@ SET(GENGETOPT_URL "ftp://ftp.gnu.org/gnu/gengetopt/gengetopt-2.22.5.tar.gz" CACH SET(HDF5_URL "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-1.8.18/src/hdf5-1.8.18.tar.bz2" CACHE STRING "URL to download HDF5 from") SET(NETCDF_URL "ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.5.0.tar.gz" CACHE STRING "URL to download NetCDF from") SET(NETCDFCXX_URL "https://github.com/Unidata/netcdf-cxx4/archive/v4.3.0.tar.gz" CACHE STRING "URL to download NetCDF-C++ from") -SET(BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.gz/download" CACHE STRING "URL to download Boost from") +SET(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2" CACHE STRING "URL to download Boost from") SET(GSL_URL "ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz" CACHE STRING "URL to download GSL from ") mark_as_advanced(FFTW_URL EIGEN_URL HDF5_URL NETCDF_URL BOOST_URL GSL_URL) @@ -234,6 +234,7 @@ if (INTERNAL_BOOST) ExternalProject_Add(boost URL ${BOOST_URL} PREFIX ${BUILD_PREFIX}/boost-prefix + URL_HASH MD5=da07ca30dd1c0d1fdedbd487efee01bd CONFIGURE_COMMAND ${BOOST_SOURCE_DIR}/bootstrap.sh --prefix=${CMAKE_BINARY_DIR}/ext_build/boost BUILD_IN_SOURCE 1 diff --git a/external/patch-omptl b/external/patch-omptl index 8d5887b..9ea9d28 100644 --- a/external/patch-omptl +++ b/external/patch-omptl @@ -1,6 +1,6 @@ -diff -ur omptl.orig/omptl_algorithm omptl/omptl_algorithm ---- omptl.orig/omptl_algorithm 2017-01-16 14:58:37.996690639 +0100 -+++ omptl/omptl_algorithm 2017-01-16 15:00:26.678641720 +0100 +diff -ur omptl.old/omptl_algorithm omptl/omptl_algorithm +--- omptl.old/omptl_algorithm 2012-04-22 16:29:41.000000000 +0200 ++++ omptl/omptl_algorithm 2021-06-20 15:40:29.000000000 +0200 @@ -20,7 +20,7 @@ #define OMPTL_ALGORITHM 1 @@ -22,9 +22,9 @@ diff -ur omptl.orig/omptl_algorithm omptl/omptl_algorithm #endif #endif /* OMPTL_ALGORITHM */ -diff -ur omptl.orig/omptl_algorithm_par.h omptl/omptl_algorithm_par.h ---- omptl.orig/omptl_algorithm_par.h 2017-01-16 14:58:37.996690639 +0100 -+++ omptl/omptl_algorithm_par.h 2017-01-16 14:59:57.974126410 +0100 +diff -ur omptl.old/omptl_algorithm_par.h omptl/omptl_algorithm_par.h +--- omptl.old/omptl_algorithm_par.h 2012-04-22 16:29:41.000000000 +0200 ++++ omptl/omptl_algorithm_par.h 2021-06-20 15:40:50.000000000 +0200 @@ -21,8 +21,8 @@ #include #include @@ -36,9 +36,18 @@ diff -ur omptl.orig/omptl_algorithm_par.h omptl/omptl_algorithm_par.h #include -diff -ur omptl.orig/omptl_numeric omptl/omptl_numeric ---- omptl.orig/omptl_numeric 2017-01-16 14:58:37.996690639 +0100 -+++ omptl/omptl_numeric 2017-01-16 15:00:57.051186974 +0100 +@@ -1700,7 +1700,7 @@ + + std::vector pivot_used(pivots.size(), false); // can't be bool due to parallel write + +- const unsigned max_depth = std::floor(std::tr1::log2(P)); ++ const unsigned max_depth = unsigned(std::floor(std::log2(P))); + assert(1u << max_depth <= P); + for (unsigned i = 0; i < max_depth; ++i) + { +diff -ur omptl.old/omptl_numeric omptl/omptl_numeric +--- omptl.old/omptl_numeric 2012-04-22 16:29:41.000000000 +0200 ++++ omptl/omptl_numeric 2021-06-20 15:40:29.000000000 +0200 @@ -19,7 +19,7 @@ #define OMPTL_NUMERIC 1 @@ -63,9 +72,9 @@ diff -ur omptl.orig/omptl_numeric omptl/omptl_numeric +#include "omptl_numeric_extensions.h" #endif /* OMPTL_NUMERIC */ -diff -ur omptl.orig/omptl_numeric_extensions.h omptl/omptl_numeric_extensions.h ---- omptl.orig/omptl_numeric_extensions.h 2017-01-16 14:58:37.996690639 +0100 -+++ omptl/omptl_numeric_extensions.h 2017-01-16 14:59:21.549472508 +0100 +diff -ur omptl.old/omptl_numeric_extensions.h omptl/omptl_numeric_extensions.h +--- omptl.old/omptl_numeric_extensions.h 2012-04-22 16:29:41.000000000 +0200 ++++ omptl/omptl_numeric_extensions.h 2021-06-20 15:40:29.000000000 +0200 @@ -51,9 +51,9 @@ } // namespace @@ -78,9 +87,9 @@ diff -ur omptl.orig/omptl_numeric_extensions.h omptl/omptl_numeric_extensions.h #endif namespace omptl -diff -ur omptl.orig/omptl_numeric_par.h omptl/omptl_numeric_par.h ---- omptl.orig/omptl_numeric_par.h 2017-01-16 14:58:37.996690639 +0100 -+++ omptl/omptl_numeric_par.h 2017-01-16 14:59:36.397739066 +0100 +diff -ur omptl.old/omptl_numeric_par.h omptl/omptl_numeric_par.h +--- omptl.old/omptl_numeric_par.h 2012-04-22 16:29:41.000000000 +0200 ++++ omptl/omptl_numeric_par.h 2021-06-20 15:40:29.000000000 +0200 @@ -23,8 +23,8 @@ #include #include @@ -92,15 +101,15 @@ diff -ur omptl.orig/omptl_numeric_par.h omptl/omptl_numeric_par.h namespace omptl { -diff -ur omptl.orig/omptl_algorithm_par.h omptl/omptl_algorithm_par.h ---- omptl.orig/omptl_algorithm_par.h 2021-05-09 14:26:47.227632829 +0300 -+++ omptl/omptl_algorithm_par.h 2021-05-09 14:27:02.815744567 +0300 -@@ -1700,7 +1700,7 @@ +diff -ur omptl.old/omptl_tools.h omptl/omptl_tools.h +--- omptl.old/omptl_tools.h 2012-04-22 16:29:41.000000000 +0200 ++++ omptl/omptl_tools.h 2021-06-20 15:40:42.000000000 +0200 +@@ -25,7 +25,7 @@ + #include + #include - std::vector pivot_used(pivots.size(), false); // can't be bool due to parallel write +-#include ++#include -- const unsigned max_depth = std::floor(std::tr1::log2(P)); -+ const unsigned max_depth = unsigned(std::floor(std::tr1::log2(P))); - assert(1u << max_depth <= P); - for (unsigned i = 0; i < max_depth; ++i) - { + namespace omptl + { diff --git a/requirements.txt b/requirements.txt index ef3f5d4..3a4577b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy +numpy<1.19 cffi numexpr pyfftw diff --git a/setup.py b/setup.py index b8c6925..da984f3 100644 --- a/setup.py +++ b/setup.py @@ -168,10 +168,16 @@ class BuildCMakeExt(build_ext): # Below is just an example set of arguments for building Blender as a Python module compilers=[] - if "CC" in os.environ: - compilers.append('-DCMAKE_C_COMPILER=' + os.environ["CC"]) - if "CXX" in os.environ: - compilers.append("-DCMAKE_CXX_COMPILER=" + os.environ["CXX"]) + fill_up_settings=[ + ("CMAKE_C_COMPILER", "CC"), + ("CMAKE_CXX_COMPILER", "CXX"), + ("CMAKE_C_FLAGS", "CFLAGS"), + ("CMAKE_EXE_LINKER_FLAGS_INIT", "LDFLAGS"), + ("CMAKE_SHARED_LINKER_FLAGS_INIT", "LDFLAGS"), + ("CMAKE_MODULE_LINKER_FLAGS_INIT", "LDFLAGS")] + for cmake_flag, os_flag in fill_up_settings: + if os_flag in os.environ: + compilers.append(f"-D{cmake_flag}={os.environ[os_flag]}") self.spawn(['cmake', '-H'+SOURCE_DIR, '-B'+self.build_temp, '-DENABLE_OPENMP=ON','-DINTERNAL_BOOST=ON','-DINTERNAL_EIGEN=ON', @@ -223,7 +229,7 @@ class BuildCMakeExt(build_ext): CosmoTool_extension = CMakeExtension(name="cosmotool") setup(name='cosmotool', - version='1.2.2', + version='1.2.3', packages=["cosmotool"], package_dir={'cosmotool': 'python/cosmotool'}, install_requires=['numpy','cffi','numexpr','pyfftw','h5py'], diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4f39695..c075396 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -38,6 +38,7 @@ if (HDF5_FOUND) h5_readFlash.cpp loadFlash.cpp ) + add_dependencies(CosmoHDF5 ${cosmotool_DEPS}) set_property(TARGET CosmoHDF5 PROPERTY POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}) target_include_directories(CosmoHDF5 BEFORE PRIVATE ${HDF5_INCLUDE_DIR}) else(HDF5_FOUND) diff --git a/src/hdf5_array.hpp b/src/hdf5_array.hpp index 9587189..db75a33 100644 --- a/src/hdf5_array.hpp +++ b/src/hdf5_array.hpp @@ -426,7 +426,7 @@ namespace CosmoTool { #define CTOOL_HDF5_INSERT_ELEMENT(r, STRUCT, element) \ { \ ::CosmoTool::get_hdf5_data_type t; \ - position = HOFFSET(STRUCT, BOOST_PP_TUPLE_ELEM(2, 1, element)); \ + long position = HOFFSET(STRUCT, BOOST_PP_TUPLE_ELEM(2, 1, element)); \ const char *field_name = BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(2, 1, element)); \ type.insertMember(field_name, position, t.type()); \ } @@ -439,7 +439,6 @@ namespace CosmoTool { \ \ TNAME() : type(sizeof(STRUCT)) \ { \ - long position; \ BOOST_PP_SEQ_FOR_EACH(CTOOL_HDF5_INSERT_ELEMENT, STRUCT, ATTRIBUTES) \ } \ \ @@ -471,7 +470,6 @@ namespace CosmoTool { \ \ TNAME() : type(sizeof(STRUCT)) \ { \ - long position; \ BOOST_PP_SEQ_FOR_EACH(CTOOL_HDF5_INSERT_ENUM_ELEMENT, STRUCT, ATTRIBUTES) \ } \ \