diff --git a/CMakeLists.txt b/CMakeLists.txt index 02a93d5..80b1743 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,6 @@ ENDIF(BUILD_PYTHON) MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module") -find_package(ZLIB) find_library(ZLIB_LIBRARY z) find_library(DL_LIBRARY dl) find_library(RT_LIBRARY rt) @@ -83,7 +82,7 @@ SET(CPACK_PACKAGE_VERSION_MINOR "3") SET(CPACK_PACKAGE_VERSION_PATCH "4${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 +SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\\\.git/;/\\\\.svn/;\\\\.swp$;\\\\.#;/#;.*~;cscope.*;/CMakeFiles/;.*\\\\.cmake;Makefile") add_subdirectory(src) diff --git a/MANIFEST.in b/MANIFEST.in index 105a2d6..5c4f363 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,4 @@ include .gitignore -include pyproject.toml include CMakeLists.txt include FindNumPy.cmake include FindPyLibs.cmake @@ -17,17 +16,14 @@ include doc/source/cpplibrary.rst include doc/source/index.rst include doc/source/intro.rst include doc/source/pythonmodule.rst -include external/config.guess -include external/config.sub include external/external_build.cmake -include external/libsharp-8d51946.tar.gz +include external/libsharp-6077806.tar.gz include external/omptl-20120422.tar.bz2 include external/patch-omptl include python/CMakeLists.txt include python/_cosmo_bispectrum.cpp include python/_cosmo_cic.pyx include python/_cosmo_power.pyx -include python/_cosmomath.pyx include python/_cosmotool.pyx include python/_fast_interp.pyx include python/_project.pyx @@ -97,7 +93,6 @@ include sample/testkd3.cpp include setup.py include src/CMakeLists.txt include src/algo.hpp -include src/numpy_adaptors.hpp include src/bqueue.hpp include src/bqueue.tcc include src/bsp_simple.hpp diff --git a/builder/build-wheels.sh b/builder/build-wheels.sh index 8f529dd..60a8bfc 100755 --- a/builder/build-wheels.sh +++ b/builder/build-wheels.sh @@ -16,7 +16,7 @@ ln -fs /usr/bin/cmake3 /usr/bin/cmake test -d /io/wheelhouse || mkdir /io/wheelhouse test -d /io/wheelhouse/fix || mkdir /io/wheelhouse/fix -ALL_PYTHON="cp39-cp39 cp310-cp310" +ALL_PYTHON="cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310" # Compile wheels for pkg in $ALL_PYTHON; do @@ -24,11 +24,11 @@ for pkg in $ALL_PYTHON; do # "${PYBIN}/pip" install -r /io/dev-requirements.txt "${PYBIN}/pip" install setuptools wheel Cython "${PYBIN}/pip" install -r /io/requirements.txt - "${PYBIN}/pip" wheel -vvv /io/ -w /io/wheelhouse/ + "${PYBIN}/pip" wheel -vvv /io/ -w wheelhouse/ done # Bundle external shared libraries into the wheels -for whl in /io/wheelhouse/cosmotool*linux*.whl; do +for whl in /io/wheelhouse/cosmotool*.whl; do auditwheel repair "$whl" --plat $PLAT -w /io/wheelhouse/fix done diff --git a/builder/start.sh b/builder/start.sh index 31f95f0..9fbc185 100755 --- a/builder/start.sh +++ b/builder/start.sh @@ -9,4 +9,4 @@ if ! [ -e ${d}/setup.py ] ; then exit 1 fi -podman run -ti --rm -e PLAT=manylinux2014_x86_64 -v ${d}:/io:Z quay.io/pypa/manylinux2014_x86_64 /io/builder/build-wheels.sh +podman run -ti --rm -e PLAT=manylinux2010_x86_64 -v ${d}:/io:Z quay.io/pypa/manylinux2010_x86_64 /io/builder/build-wheels.sh diff --git a/external/external_build.cmake b/external/external_build.cmake index 997cc4d..65ee8b8 100644 --- a/external/external_build.cmake +++ b/external/external_build.cmake @@ -206,7 +206,6 @@ if (INTERNAL_NETCDF) DOWNLOAD_DIR ${SOURCE_PREFIX}/downloads URL ${NETCDFCXX_URL} CMAKE_ARGS - -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_ALT_SEP} -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBUILD_SHARED_LIBS=OFF diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 7a031e7..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build-system] -requires = ["setuptools","wheel","cython"] -build-backend = "setuptools.build_meta" - - -[tool.towncrier] -directory = "changes" - diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 1b3fe10..368eed6 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -2,7 +2,7 @@ set(CMAKE_SHARED_MODULE_PREFIX) set(PYTHON_INCLUDES ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/python) -include_directories(${CMAKE_SOURCE_DIR}/python ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) +include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) IF(CYTHON) add_custom_command( diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index 6d019a7..03709a7 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -1,8 +1,4 @@ SET(tolink ${CosmoTool_local} ${CosmoTool_LIBS} ${GSL_LIBRARIES} ${DL_LIBRARY}) -if (RT_LIBRARY) - SET(tolink ${tolink} ${RT_LIBRARY}) -endif() - include_directories(${CMAKE_SOURCE_DIR}/src) include_directories(${FFTW3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${GSL_INCLUDE_PATH}) if(YORICK_SUPPORT) diff --git a/setup.py b/setup.py index 0b98cce..7c07d3a 100644 --- a/setup.py +++ b/setup.py @@ -237,10 +237,10 @@ class BuildCMakeExt(build_ext): CosmoTool_extension = CMakeExtension(name="cosmotool") setup(name='cosmotool', - version='1.3.6', + version='1.3.5', packages=["cosmotool"], package_dir={'cosmotool': 'python/cosmotool'}, - install_requires=['cython','numpy','cffi','numexpr','h5py'], + install_requires=['numpy','cffi','numexpr','h5py'], setup_requires=['cython','cffi','numpy','numexpr'], ext_modules=[CosmoTool_extension], description='A small cosmotool box of useful functions', diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 38c1901..c075396 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,7 +39,7 @@ if (HDF5_FOUND) loadFlash.cpp ) add_dependencies(CosmoHDF5 ${cosmotool_DEPS}) - set_property(TARGET CosmoHDF5 PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET CosmoHDF5 PROPERTY POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS}) target_include_directories(CosmoHDF5 BEFORE PRIVATE ${HDF5_INCLUDE_DIR}) else(HDF5_FOUND) add_library(CosmoHDF5 OBJECT diff --git a/src/hdf5_array.hpp b/src/hdf5_array.hpp index 55dc87b..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; \ - long position = offsetof(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()); \ } diff --git a/src/sphSmooth.hpp b/src/sphSmooth.hpp index f9c468b..fdada71 100644 --- a/src/sphSmooth.hpp +++ b/src/sphSmooth.hpp @@ -72,9 +72,7 @@ namespace CosmoTool { void fetchNeighbours(const typename SPHTree::coords &c, SPHState *state = 0); - void fetchNeighbours( - const typename SPHTree::coords &c, uint32_t newNsph, - SPHState *state = 0); + void fetchNeighbours(const typename SPHTree::coords &c, uint32_t newNsph); void fetchNeighboursOnVolume( const typename SPHTree::coords &c, ComputePrecision radius); const typename SPHTree::coords &getCurrentCenter() const { diff --git a/src/sphSmooth.tcc b/src/sphSmooth.tcc index 6643dd3..c163feb 100644 --- a/src/sphSmooth.tcc +++ b/src/sphSmooth.tcc @@ -35,38 +35,32 @@ namespace CosmoTool { template void SPHSmooth::fetchNeighbours( - const typename SPHTree::coords &c, uint32_t newNngb, SPHState *state) { + const typename SPHTree::coords &c, uint32_t newNngb) { ComputePrecision d2, max_dist = 0; uint32_t requested = newNngb; - if (state != 0) { - state->distances = boost::shared_ptr(new CoordType[newNngb]); - state->ngb = boost::shared_ptr(new SPHCell *[newNngb]); - } else { - state = &internal; - if (requested > maxNgb) { - maxNgb = requested; - internal.ngb = boost::shared_ptr(new P_SPHCell[maxNgb]); - internal.distances = - boost::shared_ptr(new CoordType[maxNgb]); - } + if (requested > maxNgb) { + maxNgb = requested; + internal.ngb = boost::shared_ptr(new P_SPHCell[maxNgb]); + internal.distances = + boost::shared_ptr(new CoordType[maxNgb]); } - memcpy(state->currentCenter, c, sizeof(c)); + memcpy(internal.currentCenter, c, sizeof(c)); tree->getNearestNeighbours( - c, requested, (SPHCell **)state->ngb.get(), - (CoordType *)state->distances.get()); + c, requested, (SPHCell **)internal.ngb.get(), + (CoordType *)internal.distances.get()); - state->currentNgb = 0; - for (uint32_t i = 0; i < requested && (state->ngb)[i] != 0; - i++, state->currentNgb++) { - state->distances[i] = sqrt(state->distances[i]); - d2 = state->distances[i]; + internal.currentNgb = 0; + for (uint32_t i = 0; i < requested && (internal.ngb)[i] != 0; + i++, internal.currentNgb++) { + internal.distances[i] = sqrt(internal.distances[i]); + d2 = internal.distances[i]; if (d2 > max_dist) max_dist = d2; } - state->smoothRadius = max_dist / 2; + internal.smoothRadius = max_dist / 2; } template @@ -212,7 +206,7 @@ namespace CosmoTool { ComputePrecision d = state->distances[i]; SPHCell &cell = *(state->ngb[i]); double kernel_value = getKernel(d / state->smoothRadius) / r3; -#pragma omp atomic update +#pragma omp atomic cell.val.weight += kernel_value; } } @@ -247,4 +241,5 @@ namespace CosmoTool { const SPHSmooth &s2) { return (s1.getSmoothingLen() < s2.getSmoothingLen()); } + }; // namespace CosmoTool