Skip to content

Commit

Permalink
Update dependencies and fix GSL library usage
Browse files Browse the repository at this point in the history
  • Loading branch information
fbriol committed Feb 15, 2024
1 parent 8b9c546 commit dec3266
Show file tree
Hide file tree
Showing 24 changed files with 18 additions and 428 deletions.
23 changes: 0 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,6 @@ if(CONDA_FORGE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a" ".so" ".dylib")
endif()

# GSL
find_package(GSL 2.0 REQUIRED)
include_directories(${GSL_INCLUDE_DIRS})
if(WIN32)
add_compile_definitions(GSL_DLL)
endif()

# We restore the suffixes of the libraries to be found.
if(CONDA_FORGE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${__CMAKE_FIND_LIBRARY_SUFFIXES})
Expand Down Expand Up @@ -243,14 +236,6 @@ if(BLAS_FOUND)
add_definitions(-DMKL_LP64)
include_directories(${MKL_INCLUDE_DIR})
endif()
# If a BLAS library has been found, it is used instead of the BLAS library
# provided with GSL.
set_target_properties(
GSL::gsl
PROPERTIES IMPORTED_LOCATION "${GSL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}")
endif()
else()
set(BLA_VENDOR_LIST "Apple" "OpenBLAS" "Generic")
Expand All @@ -263,14 +248,6 @@ else()
endforeach()
if(BLAS_FOUND)
add_definitions(-DEIGEN_USE_BLAS)
# If a BLAS library has been found, it is used instead of the BLAS library
# provided with GSL.
set_target_properties(
GSL::gsl
PROPERTIES IMPORTED_LOCATION "${GSL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GSL_INCLUDE_DIRS}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}")
else()
message(
WARNING
Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ You can also apply for a data `binning
bivariate area by simple or linear binning.

The library core is written in C++ using the `Boost C++ Libraries
<https://www.boost.org/>`_, `Eigen3 <http://eigen.tuxfamily.org/>`_, `GNU
Scientific Library <https://www.gnu.org/software/gsl/>`_, and `pybind11
<https://github.com/pybind/pybind11/>`_ libraries.
<https://www.boost.org/>`_, `Eigen3 <http://eigen.tuxfamily.org/>`_ and
`pybind11 <https://github.com/pybind/pybind11/>`_ libraries.

This software also uses `CMake <https://cmake.org/>`_ to configure the project
and `Googletest <https://github.com/google/googletest>`_ to perform unit testing
Expand Down
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
displayName: Install mamba
- bash: |
source activate Build
mamba install --yes --quiet -c conda-forge dask cmake coverage eigen gsl boost-cpp mkl-devel numpy pytest-cov setuptools xarray
mamba install --yes --quiet -c conda-forge dask cmake coverage eigen boost-cpp mkl-devel numpy pytest-cov setuptools xarray
displayName: Install build requirements
- bash: |
source activate Build
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
displayName: Install mamba
- bash: |
source activate Build
mamba install --yes --quiet -c conda-forge dask cmake coverage eigen gsl boost-cpp mkl-devel numpy pytest-cov setuptools xarray
mamba install --yes --quiet -c conda-forge dask cmake coverage eigen boost-cpp mkl-devel numpy pytest-cov setuptools xarray
displayName: Install build requirements
- bash: |
source activate Build
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
displayName: Install mamba
- bash: |
source activate Build
mamba install --yes --quiet -c conda-forge dask cmake coverage eigen gsl boost-cpp numpy pytest-cov setuptools xarray
mamba install --yes --quiet -c conda-forge dask cmake coverage eigen boost-cpp numpy pytest-cov setuptools xarray
displayName: Install build requirements
- bash: |
source activate Build
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
displayName: Install mamba
- script: |
call activate Build
mamba install --yes --quiet -c conda-forge dask cmake eigen gsl boost-cpp mkl-devel mkl numpy pytest setuptools xarray
mamba install --yes --quiet -c conda-forge dask cmake eigen boost-cpp mkl-devel mkl numpy pytest setuptools xarray
displayName: Install build requirements
- script: |
call activate Build
Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- jupyter
- numcodecs
- pandas
- pyinterp>=2024.2.0
- pyinterp>=2024.2.0.dev4
- pytest
- sphinx-gallery
- sphinx-inline-tabs
2 changes: 1 addition & 1 deletion conda/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- numcodecs
- pandas
- pip
- pyinterp>=2024.2.0
- pyinterp>=2024.2.0.dev4
- pypandoc
- pytest
- python=3.9
Expand Down
4 changes: 1 addition & 3 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "pyinterp" %}
{% set version = "2024.2.0" %}
{% set version = "2024.2.0.dev4" %}

package:
name: {{ name|lower }}
Expand All @@ -17,7 +17,6 @@ build:
ignore_run_exports:
- mkl # [blas == "mkl"]
- openblas # [blas == "openblas"]
- gsl

requirements:
build:
Expand All @@ -31,7 +30,6 @@ requirements:
host:
- dask
- eigen
- gsl >=2.7
- boost-cpp >=1.79.0
- mkl
- numpy
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
author = 'CNES/CLS'

# The short X.Y version
version = '2024.2.0'
version = '2024.2.0.dev4'
# The full version, including alpha/beta/rc tags
release = '2024.2.0'
release = '2024.2.0.dev4'

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 0 additions & 2 deletions docs/source/setup/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ C++, you must have Python 3, at least Python version 3.6, a C++ compiler and
The compiling C++ requires the following development library:
* `Boost C++ Libraries <https://www.boost.org/>`_
* `Eigen3 <http://eigen.tuxfamily.org/>`_
* `GNU Scientific Library <https://www.gnu.org/software/gsl/>`_

You can install these packages on Ubuntu by typing the following command:

Expand Down Expand Up @@ -55,7 +54,6 @@ You can specify, among other things, the following options:
* ``--cxx-compiler`` to select the C++ compiler to use.
* ``--debug`` to compile the C++ library in Debug mode.
* ``--eigen-root`` to specify the Eigen3 include directory.
* ``--gsl-root`` to specify the Preferred GSL installation prefix.
* ``--mkl-root`` to specify the MKL directory.
* ``--mkl`` to use MKL as BLAS library
* ``--reconfigure`` to force CMake to reconfigure the project.
Expand Down
3 changes: 1 addition & 2 deletions examples/ex_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@
#
# To interpolate data points on a regular two-dimensional grid. The interpolated
# surface is smoother than the corresponding surfaces obtained by bilinear
# interpolation. Spline functions provided by `GSL
# <https://www.gnu.org/software/gsl/>`_ achieve bicubic interpolation.
# interpolation.
#
# .. warning::
#
Expand Down
22 changes: 0 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ class BuildExt(setuptools.command.build_ext.build_ext):
('cxx-compiler=', None, 'Preferred C++ compiler'),
('eigen-root=', None, 'Preferred Eigen3 include directory'),
('generator=', None, 'Selected CMake generator'),
('gsl-root=', None, 'Preferred GSL installation prefix'),
('mkl-root=', None, 'Preferred MKL installation prefix'),
('mkl=', None, 'Using MKL as BLAS library'),
('reconfigure', None, 'Forces CMake to reconfigure this project')
Expand Down Expand Up @@ -250,20 +249,6 @@ def run(self) -> None:
self.build_cmake(ext)
super().run()

def gsl(self) -> Optional[str]:
"""Get the default boost path in Anaconda's environment."""
gsl_root = sys.prefix
if pathlib.Path(gsl_root, 'include', 'gsl').exists():
return f'-DGSL_ROOT_DIR={gsl_root}'
gsl_root = pathlib.Path(sys.prefix, 'Library')
if not gsl_root.joinpath('include', 'gsl').exists():
if self.conda_forge:
raise RuntimeError(
'Unable to find the GSL library in the conda distribution '
'used.')
return None
return f'-DGSL_ROOT_DIR={gsl_root}'

def boost(self) -> Optional[List[str]]:
"""Get the default boost path in Anaconda's environment."""
# Do not search system for Boost & disable the search for boost-cmake
Expand Down Expand Up @@ -346,13 +331,6 @@ def set_cmake_user_options(self) -> List[str]:
if cmake_variable:
result += cmake_variable

if self.gsl_root is not None:
result.append('-DGSL_ROOT_DIR=' + self.gsl_root)
elif is_conda:
cmake_variable = self.gsl()
if cmake_variable:
result.append(cmake_variable)

if self.eigen_root is not None:
result.append('-DEIGEN3_INCLUDE_DIR=' + self.eigen_root)
elif is_conda:
Expand Down
2 changes: 1 addition & 1 deletion src/pyinterp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ file(GLOB_RECURSE SOURCES "module/*.cpp")
pybind11_add_module(core ${SOURCES})
target_link_libraries(
core
PRIVATE pyinterp GSL::gsl
PRIVATE pyinterp ${BLAS_LIBRARIES}
PUBLIC cpp_coverage)

if(GTest_FOUND)
Expand Down
40 changes: 0 additions & 40 deletions src/pyinterp/core/include/pyinterp/detail/gsl/accelerator.hpp

This file was deleted.

20 changes: 0 additions & 20 deletions src/pyinterp/core/include/pyinterp/detail/gsl/error_handler.hpp

This file was deleted.

113 changes: 0 additions & 113 deletions src/pyinterp/core/include/pyinterp/detail/gsl/interpolate1d.hpp

This file was deleted.

Loading

0 comments on commit dec3266

Please sign in to comment.