Add omp parallelization for bessel function
This commit is contained in:
parent
67c609a422
commit
84a1d3bf47
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,4 +1,9 @@
|
|||||||
*~
|
*~
|
||||||
|
.eggs/
|
||||||
|
dist/
|
||||||
|
wheelhouse/
|
||||||
|
cosmotool.egg-info/
|
||||||
|
build/
|
||||||
*.o
|
*.o
|
||||||
*.prog
|
*.prog
|
||||||
*.pyc
|
*.pyc
|
||||||
|
@ -70,8 +70,8 @@ SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A toolbox for impatient cosmologists")
|
|||||||
SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux")
|
SET(CPACK_PACKAGE_VENDOR "Guilhem Lavaux")
|
||||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2")
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENCE_CeCILL_V2")
|
||||||
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
|
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
|
||||||
SET(CPACK_PACKAGE_VERSION_MINOR "0")
|
SET(CPACK_PACKAGE_VERSION_MINOR "1")
|
||||||
SET(CPACK_PACKAGE_VERSION_PATCH "0${EXTRA_VERSION}")
|
SET(CPACK_PACKAGE_VERSION_PATCH "1${EXTRA_VERSION}")
|
||||||
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CosmoToolbox-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
|
||||||
SET(CPACK_STRIP_FILES "lib/libCosmoTool.so")
|
SET(CPACK_STRIP_FILES "lib/libCosmoTool.so")
|
||||||
SET(CPACK_SOURCE_IGNORE_FILES
|
SET(CPACK_SOURCE_IGNORE_FILES
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#cython: language_level=3
|
||||||
import numpy as np
|
import numpy as np
|
||||||
cimport numpy as np
|
cimport numpy as np
|
||||||
|
|
||||||
@ -7,15 +8,21 @@ np.import_ufunc()
|
|||||||
cdef extern from "sys/types.h":
|
cdef extern from "sys/types.h":
|
||||||
ctypedef np.int64_t int64_t
|
ctypedef np.int64_t int64_t
|
||||||
|
|
||||||
|
cdef extern from "numpy/npy_common.h":
|
||||||
|
ctypedef npy_intp
|
||||||
|
|
||||||
cdef extern from "special_math.hpp" namespace "CosmoTool":
|
cdef extern from "special_math.hpp" namespace "CosmoTool":
|
||||||
T log_modified_bessel_first_kind[T](T v, T z) nogil except +
|
T log_modified_bessel_first_kind[T](T v, T z) nogil except +
|
||||||
|
|
||||||
|
cdef extern from "numpy_adaptor.hpp" namespace "CosmoTool":
|
||||||
|
void parallel_ufunc_dd_d[T,IT](char **args, IT* dimensions, IT* steps, void *func)
|
||||||
|
|
||||||
|
|
||||||
cdef np.PyUFuncGenericFunction loop_func[1]
|
cdef np.PyUFuncGenericFunction loop_func[1]
|
||||||
cdef char input_output_types[3]
|
cdef char input_output_types[3]
|
||||||
cdef void *elementwise_funcs[1]
|
cdef void *elementwise_funcs[1]
|
||||||
|
|
||||||
loop_func[0] = np.PyUFunc_dd_d
|
loop_func[0] = <np.PyUFuncGenericFunction>parallel_ufunc_dd_d[double,npy_intp]
|
||||||
|
|
||||||
input_output_types[0] = np.NPY_DOUBLE
|
input_output_types[0] = np.NPY_DOUBLE
|
||||||
input_output_types[1] = np.NPY_DOUBLE
|
input_output_types[1] = np.NPY_DOUBLE
|
||||||
|
2
setup.py
2
setup.py
@ -218,7 +218,7 @@ class BuildCMakeExt(build_ext):
|
|||||||
CosmoTool_extension = CMakeExtension(name="cosmotool")
|
CosmoTool_extension = CMakeExtension(name="cosmotool")
|
||||||
|
|
||||||
setup(name='cosmotool',
|
setup(name='cosmotool',
|
||||||
version='1.1.0',
|
version='1.1.1',
|
||||||
packages=["cosmotool"],
|
packages=["cosmotool"],
|
||||||
package_dir={'cosmotool': 'python/cosmotool'},
|
package_dir={'cosmotool': 'python/cosmotool'},
|
||||||
install_requires=['numpy','cffi','numexpr','pyfftw','h5py'],
|
install_requires=['numpy','cffi','numexpr','pyfftw','h5py'],
|
||||||
|
Loading…
Reference in New Issue
Block a user