Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python binding ectrans4py #205

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2411323
equivalent to ectrans in CY48T3_mrg48R1.02:contrib/
AlexandreMary Oct 11, 2022
3e2cefc
Variable LALL_FFTW to perform fftw transforms in one bunch of all fi…
RyadElKhatibMF Nov 13, 2023
63cab62
Added LAM transforms and LAM benchmark.
ddegrauwe May 30, 2024
e4f0a1a
cleaned installation a bit: only one library (trans) instead of separ…
ddegrauwe May 30, 2024
82537df
removed reference to etrans from trans/CMakeLists.txt
ddegrauwe Jun 10, 2024
1bd0e01
moved ellips to fiat
ddegrauwe Sep 3, 2024
dcda941
fixed ETRANS=ON: (i) follow single/double precision mechanism from tr…
ddegrauwe Dec 3, 2024
3db60a2
Added LAM test
ddegrauwe Dec 3, 2024
de52f21
added license information to etrans sources
ddegrauwe Dec 3, 2024
783d90f
removed fft992 sources
ddegrauwe Dec 5, 2024
6c1ac5d
Touch up etrans tests
samhatfield Dec 5, 2024
d5f6e2a
Enable etrans temporarily for testing
samhatfield Jan 28, 2025
8a94d2e
Fix type of KPOINTERS dummy argument
samhatfield Jan 28, 2025
8f57c77
add ectrans python interface ectrans4py
walidchikhi Oct 19, 2024
b2bb7e1
ectrans4py version is same as ectrans
AlexandreMary Oct 30, 2024
74c0005
cleaner python package
AlexandreMary Oct 30, 2024
05513ed
fix extension of ectrans4py/gp2sp_lam4py
AlexandreMary Dec 20, 2024
e4e1bbf
clean MANIFEST.in
AlexandreMary Dec 20, 2024
5d546d4
label 1.2.51
AlexandreMary Dec 20, 2024
5565090
add tests for ectrans4py
AlexandreMary Jan 22, 2025
ac182bb
add sp2gp/gp2sp tests
AlexandreMary Jan 23, 2025
bb8d62e
add info about ectrans4py in README
AlexandreMary Jan 23, 2025
b900eed
adapt compilectrans4py build: fftw and omp
AlexandreMary Jan 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ build/*
install/*
env.sh
*.DS_Store

*.py[co~]
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,17 @@ ecbuild_add_option( FEATURE GPU_STATIC
DEFAULT ${GPU_STATIC_DEFAULT}
DESCRIPTION "Compile GPU library as static library")

ecbuild_add_option( FEATURE ETRANS
DEFAULT ON
DESCRIPTION "Include Limited-Area-Model Transforms" )


ecbuild_add_option( FEATURE ECTRANS4PY
DEFAULT OFF
CONDITION HAVE_ETRANS
DESCRIPTION "Compile ectrans4py interface routines for python binding w/ ctypesForFortran" )


ectrans_find_lapack()

ecbuild_add_option( FEATURE TESTS
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
recursive-include cmake
exclude MANIFEST.in
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,28 @@ The benchmark drivers are found in the bin directory.
A brief description of available command-line arguments can be obtained with e.g.
ectrans-benchmark-cpu-sp --help

Building `ectrans4py`
---------------------

The python wheel can be built from the root of the project, assuming above-mentioned variables are defined (`fiat_ROOT` etc...):
```
python -m build --wheel
```
and then:
```
python -m auditwheel
```
The built python wheel is then to be found in directory `wheelhouse/` and can be locally installed by pip:
```
pip install wheelhouse/ectrans4py-<x.y.z>(...).whl
```
The `_skbuild` and `dist` directories can be deleted.

Tests can be run from `tests/test_ectrans4py/`:
```
python -m pytest
```

Reporting Bugs
==============

Expand Down
23 changes: 23 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[project]
name = "ectrans4py"
dynamic = ["version"]
description = "ECTRANS interface for Python"
readme = "README.md"
requires-python = ">=3.10"
dependencies=["numpy", "ctypesForFortran<2.0.0"]
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: Unix',
]

[build-system]
requires = ["setuptools", "wheel", "scikit-build"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "ectrans4py.__version__"}
25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import ast
from skbuild import setup

_version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "VERSION")
with open(_version_file, "r") as f:
__version__ = f.read().strip()

setup(
name="ectrans4py",
version=__version__,
packages=['ectrans4py'],
cmake_minimum_required_version="3.13",
cmake_args=[
'-DENABLE_ETRANS=ON',
'-DENABLE_ECTRANS4PY=ON',
'-DENABLE_SINGLE_PRECISION=OFF',
'-DENABLE_OMP=ON',
'-DFFTW_USE_STATIC_LIBS=ON',
],
package_dir={"": "src"},
cmake_install_dir="src/ectrans4py",
setup_requires=["scikit-build", "setuptools"],
install_requires=["numpy", "ctypesforfortran==1.1.3"],
)
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ add_subdirectory( programs )
if( HAVE_TRANSI )
add_subdirectory(transi)
endif()
if( HAVE_ETRANS )
add_subdirectory(etrans)
endif()
if(HAVE_ECTRANS4PY)
add_subdirectory(ectrans4py)
endif()
20 changes: 20 additions & 0 deletions src/ectrans4py/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
if(HAVE_ETRANS)
# (using CMAKE_CURRENT_SOURCE_DIR is necessary because sources are in a different directory than the target library (trans_${prec}))
ecbuild_list_add_pattern(
LIST ectrans4py_src
GLOB ${CMAKE_CURRENT_SOURCE_DIR}/*.F90
QUIET
)

set(HAVE_dp ${HAVE_DOUBLE_PRECISION})
set(prec dp)

if(HAVE_${prec})
# Add sources
target_sources(trans_${prec} PRIVATE ${ectrans4py_src})
endif()

else()
ecbuild_critical("To activate the ectrans Python interface, you must enable the ETRANS option.")
endif()

Loading