Compare commits
14 commits
Author | SHA1 | Date | |
---|---|---|---|
70f6f88802 | |||
736531e9fd | |||
fb51ffd35e | |||
924047de22 | |||
be64c7fd7a | |||
|
47d63a25ce | ||
|
4bcc5f3270 | ||
|
1d59533b17 | ||
|
1548fd8450 | ||
|
1151d0c8b6 | ||
|
1db266b4ea | ||
|
f2a5092cf1 | ||
|
54a59b5246 | ||
883c338c08 |
12 changed files with 54 additions and 28 deletions
|
@ -42,6 +42,7 @@ ENDIF(BUILD_PYTHON)
|
||||||
|
|
||||||
MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module")
|
MESSAGE(STATUS "Using the target ${CosmoTool_local} to build python module")
|
||||||
|
|
||||||
|
find_package(ZLIB)
|
||||||
find_library(ZLIB_LIBRARY z)
|
find_library(ZLIB_LIBRARY z)
|
||||||
find_library(DL_LIBRARY dl)
|
find_library(DL_LIBRARY dl)
|
||||||
find_library(RT_LIBRARY rt)
|
find_library(RT_LIBRARY rt)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
include .gitignore
|
include .gitignore
|
||||||
|
include pyproject.toml
|
||||||
include CMakeLists.txt
|
include CMakeLists.txt
|
||||||
include FindNumPy.cmake
|
include FindNumPy.cmake
|
||||||
include FindPyLibs.cmake
|
include FindPyLibs.cmake
|
||||||
|
@ -16,14 +17,17 @@ include doc/source/cpplibrary.rst
|
||||||
include doc/source/index.rst
|
include doc/source/index.rst
|
||||||
include doc/source/intro.rst
|
include doc/source/intro.rst
|
||||||
include doc/source/pythonmodule.rst
|
include doc/source/pythonmodule.rst
|
||||||
|
include external/config.guess
|
||||||
|
include external/config.sub
|
||||||
include external/external_build.cmake
|
include external/external_build.cmake
|
||||||
include external/libsharp-6077806.tar.gz
|
include external/libsharp-8d51946.tar.gz
|
||||||
include external/omptl-20120422.tar.bz2
|
include external/omptl-20120422.tar.bz2
|
||||||
include external/patch-omptl
|
include external/patch-omptl
|
||||||
include python/CMakeLists.txt
|
include python/CMakeLists.txt
|
||||||
include python/_cosmo_bispectrum.cpp
|
include python/_cosmo_bispectrum.cpp
|
||||||
include python/_cosmo_cic.pyx
|
include python/_cosmo_cic.pyx
|
||||||
include python/_cosmo_power.pyx
|
include python/_cosmo_power.pyx
|
||||||
|
include python/_cosmomath.pyx
|
||||||
include python/_cosmotool.pyx
|
include python/_cosmotool.pyx
|
||||||
include python/_fast_interp.pyx
|
include python/_fast_interp.pyx
|
||||||
include python/_project.pyx
|
include python/_project.pyx
|
||||||
|
@ -93,6 +97,7 @@ include sample/testkd3.cpp
|
||||||
include setup.py
|
include setup.py
|
||||||
include src/CMakeLists.txt
|
include src/CMakeLists.txt
|
||||||
include src/algo.hpp
|
include src/algo.hpp
|
||||||
|
include src/numpy_adaptors.hpp
|
||||||
include src/bqueue.hpp
|
include src/bqueue.hpp
|
||||||
include src/bqueue.tcc
|
include src/bqueue.tcc
|
||||||
include src/bsp_simple.hpp
|
include src/bsp_simple.hpp
|
||||||
|
|
|
@ -16,7 +16,7 @@ ln -fs /usr/bin/cmake3 /usr/bin/cmake
|
||||||
test -d /io/wheelhouse || mkdir /io/wheelhouse
|
test -d /io/wheelhouse || mkdir /io/wheelhouse
|
||||||
test -d /io/wheelhouse/fix || mkdir /io/wheelhouse/fix
|
test -d /io/wheelhouse/fix || mkdir /io/wheelhouse/fix
|
||||||
|
|
||||||
ALL_PYTHON="cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310"
|
ALL_PYTHON="cp39-cp39 cp310-cp310"
|
||||||
|
|
||||||
# Compile wheels
|
# Compile wheels
|
||||||
for pkg in $ALL_PYTHON; do
|
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 -r /io/dev-requirements.txt
|
||||||
"${PYBIN}/pip" install setuptools wheel Cython
|
"${PYBIN}/pip" install setuptools wheel Cython
|
||||||
"${PYBIN}/pip" install -r /io/requirements.txt
|
"${PYBIN}/pip" install -r /io/requirements.txt
|
||||||
"${PYBIN}/pip" wheel -vvv /io/ -w wheelhouse/
|
"${PYBIN}/pip" wheel -vvv /io/ -w /io/wheelhouse/
|
||||||
done
|
done
|
||||||
|
|
||||||
# Bundle external shared libraries into the wheels
|
# Bundle external shared libraries into the wheels
|
||||||
for whl in /io/wheelhouse/cosmotool*.whl; do
|
for whl in /io/wheelhouse/cosmotool*linux*.whl; do
|
||||||
auditwheel repair "$whl" --plat $PLAT -w /io/wheelhouse/fix
|
auditwheel repair "$whl" --plat $PLAT -w /io/wheelhouse/fix
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,4 @@ if ! [ -e ${d}/setup.py ] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
podman run -ti --rm -e PLAT=manylinux2010_x86_64 -v ${d}:/io:Z quay.io/pypa/manylinux2010_x86_64 /io/builder/build-wheels.sh
|
podman run -ti --rm -e PLAT=manylinux2014_x86_64 -v ${d}:/io:Z quay.io/pypa/manylinux2014_x86_64 /io/builder/build-wheels.sh
|
||||||
|
|
1
external/external_build.cmake
vendored
1
external/external_build.cmake
vendored
|
@ -206,6 +206,7 @@ if (INTERNAL_NETCDF)
|
||||||
DOWNLOAD_DIR ${SOURCE_PREFIX}/downloads
|
DOWNLOAD_DIR ${SOURCE_PREFIX}/downloads
|
||||||
URL ${NETCDFCXX_URL}
|
URL ${NETCDFCXX_URL}
|
||||||
CMAKE_ARGS
|
CMAKE_ARGS
|
||||||
|
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH_ALT_SEP}
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
-DBUILD_SHARED_LIBS=OFF
|
-DBUILD_SHARED_LIBS=OFF
|
||||||
|
|
8
pyproject.toml
Normal file
8
pyproject.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools","wheel","cython"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.towncrier]
|
||||||
|
directory = "changes"
|
||||||
|
|
|
@ -2,7 +2,7 @@ set(CMAKE_SHARED_MODULE_PREFIX)
|
||||||
|
|
||||||
|
|
||||||
set(PYTHON_INCLUDES ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/python)
|
set(PYTHON_INCLUDES ${NUMPY_INCLUDE_DIRS} ${PYTHON_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/python)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src)
|
include_directories(${CMAKE_SOURCE_DIR}/python ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src)
|
||||||
|
|
||||||
IF(CYTHON)
|
IF(CYTHON)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
SET(tolink ${CosmoTool_local} ${CosmoTool_LIBS} ${GSL_LIBRARIES} ${DL_LIBRARY})
|
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(${CMAKE_SOURCE_DIR}/src)
|
||||||
include_directories(${FFTW3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${GSL_INCLUDE_PATH})
|
include_directories(${FFTW3_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS} ${GSL_INCLUDE_PATH})
|
||||||
if(YORICK_SUPPORT)
|
if(YORICK_SUPPORT)
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -237,10 +237,10 @@ class BuildCMakeExt(build_ext):
|
||||||
CosmoTool_extension = CMakeExtension(name="cosmotool")
|
CosmoTool_extension = CMakeExtension(name="cosmotool")
|
||||||
|
|
||||||
setup(name='cosmotool',
|
setup(name='cosmotool',
|
||||||
version='1.3.5',
|
version='1.3.6',
|
||||||
packages=["cosmotool"],
|
packages=["cosmotool"],
|
||||||
package_dir={'cosmotool': 'python/cosmotool'},
|
package_dir={'cosmotool': 'python/cosmotool'},
|
||||||
install_requires=['numpy','cffi','numexpr','h5py'],
|
install_requires=['cython','numpy','cffi','numexpr','h5py'],
|
||||||
setup_requires=['cython','cffi','numpy','numexpr'],
|
setup_requires=['cython','cffi','numpy','numexpr'],
|
||||||
ext_modules=[CosmoTool_extension],
|
ext_modules=[CosmoTool_extension],
|
||||||
description='A small cosmotool box of useful functions',
|
description='A small cosmotool box of useful functions',
|
||||||
|
|
|
@ -426,7 +426,7 @@ namespace CosmoTool {
|
||||||
#define CTOOL_HDF5_INSERT_ELEMENT(r, STRUCT, element) \
|
#define CTOOL_HDF5_INSERT_ELEMENT(r, STRUCT, element) \
|
||||||
{ \
|
{ \
|
||||||
::CosmoTool::get_hdf5_data_type<BOOST_PP_TUPLE_ELEM(2, 0, element)> t; \
|
::CosmoTool::get_hdf5_data_type<BOOST_PP_TUPLE_ELEM(2, 0, element)> t; \
|
||||||
long position = HOFFSET(STRUCT, BOOST_PP_TUPLE_ELEM(2, 1, element)); \
|
long position = offsetof(STRUCT, BOOST_PP_TUPLE_ELEM(2, 1, element)); \
|
||||||
const char *field_name = BOOST_PP_STRINGIZE(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()); \
|
type.insertMember(field_name, position, t.type()); \
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,9 @@ namespace CosmoTool {
|
||||||
void
|
void
|
||||||
fetchNeighbours(const typename SPHTree::coords &c, SPHState *state = 0);
|
fetchNeighbours(const typename SPHTree::coords &c, SPHState *state = 0);
|
||||||
|
|
||||||
void fetchNeighbours(const typename SPHTree::coords &c, uint32_t newNsph);
|
void fetchNeighbours(
|
||||||
|
const typename SPHTree::coords &c, uint32_t newNsph,
|
||||||
|
SPHState *state = 0);
|
||||||
void fetchNeighboursOnVolume(
|
void fetchNeighboursOnVolume(
|
||||||
const typename SPHTree::coords &c, ComputePrecision radius);
|
const typename SPHTree::coords &c, ComputePrecision radius);
|
||||||
const typename SPHTree::coords &getCurrentCenter() const {
|
const typename SPHTree::coords &getCurrentCenter() const {
|
||||||
|
|
|
@ -35,32 +35,38 @@ namespace CosmoTool {
|
||||||
|
|
||||||
template <typename ValType, int Ndims>
|
template <typename ValType, int Ndims>
|
||||||
void SPHSmooth<ValType, Ndims>::fetchNeighbours(
|
void SPHSmooth<ValType, Ndims>::fetchNeighbours(
|
||||||
const typename SPHTree::coords &c, uint32_t newNngb) {
|
const typename SPHTree::coords &c, uint32_t newNngb, SPHState *state) {
|
||||||
ComputePrecision d2, max_dist = 0;
|
ComputePrecision d2, max_dist = 0;
|
||||||
uint32_t requested = newNngb;
|
uint32_t requested = newNngb;
|
||||||
|
|
||||||
if (requested > maxNgb) {
|
if (state != 0) {
|
||||||
maxNgb = requested;
|
state->distances = boost::shared_ptr<CoordType[]>(new CoordType[newNngb]);
|
||||||
internal.ngb = boost::shared_ptr<P_SPHCell[]>(new P_SPHCell[maxNgb]);
|
state->ngb = boost::shared_ptr<SPHCell *[]>(new SPHCell *[newNngb]);
|
||||||
internal.distances =
|
} else {
|
||||||
boost::shared_ptr<CoordType[]>(new CoordType[maxNgb]);
|
state = &internal;
|
||||||
|
if (requested > maxNgb) {
|
||||||
|
maxNgb = requested;
|
||||||
|
internal.ngb = boost::shared_ptr<P_SPHCell[]>(new P_SPHCell[maxNgb]);
|
||||||
|
internal.distances =
|
||||||
|
boost::shared_ptr<CoordType[]>(new CoordType[maxNgb]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(internal.currentCenter, c, sizeof(c));
|
memcpy(state->currentCenter, c, sizeof(c));
|
||||||
tree->getNearestNeighbours(
|
tree->getNearestNeighbours(
|
||||||
c, requested, (SPHCell **)internal.ngb.get(),
|
c, requested, (SPHCell **)state->ngb.get(),
|
||||||
(CoordType *)internal.distances.get());
|
(CoordType *)state->distances.get());
|
||||||
|
|
||||||
internal.currentNgb = 0;
|
state->currentNgb = 0;
|
||||||
for (uint32_t i = 0; i < requested && (internal.ngb)[i] != 0;
|
for (uint32_t i = 0; i < requested && (state->ngb)[i] != 0;
|
||||||
i++, internal.currentNgb++) {
|
i++, state->currentNgb++) {
|
||||||
internal.distances[i] = sqrt(internal.distances[i]);
|
state->distances[i] = sqrt(state->distances[i]);
|
||||||
d2 = internal.distances[i];
|
d2 = state->distances[i];
|
||||||
if (d2 > max_dist)
|
if (d2 > max_dist)
|
||||||
max_dist = d2;
|
max_dist = d2;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal.smoothRadius = max_dist / 2;
|
state->smoothRadius = max_dist / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ValType, int Ndims>
|
template <typename ValType, int Ndims>
|
||||||
|
@ -206,7 +212,7 @@ namespace CosmoTool {
|
||||||
ComputePrecision d = state->distances[i];
|
ComputePrecision d = state->distances[i];
|
||||||
SPHCell &cell = *(state->ngb[i]);
|
SPHCell &cell = *(state->ngb[i]);
|
||||||
double kernel_value = getKernel(d / state->smoothRadius) / r3;
|
double kernel_value = getKernel(d / state->smoothRadius) / r3;
|
||||||
#pragma omp atomic
|
#pragma omp atomic update
|
||||||
cell.val.weight += kernel_value;
|
cell.val.weight += kernel_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,5 +247,4 @@ namespace CosmoTool {
|
||||||
const SPHSmooth<ValType2, Ndims> &s2) {
|
const SPHSmooth<ValType2, Ndims> &s2) {
|
||||||
return (s1.getSmoothingLen() < s2.getSmoothingLen());
|
return (s1.getSmoothingLen() < s2.getSmoothingLen());
|
||||||
}
|
}
|
||||||
|
|
||||||
}; // namespace CosmoTool
|
}; // namespace CosmoTool
|
||||||
|
|
Loading…
Add table
Reference in a new issue