Skip to content

Commit

Permalink
Small fixes before merge
Browse files Browse the repository at this point in the history
  • Loading branch information
paugier committed Feb 5, 2024
1 parent 6f4ed15 commit ee1a61a
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 48 deletions.
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ tests_mpi:
- job: "image:build"
optional: true
script:
- ls /usr/lib/x86_64-linux-gnu/libfftw3*
- nox -s "tests(with_cov=True, with_mpi=True)"


Expand Down
17 changes: 0 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,6 @@ tests_mpi:
tests_mpi4:
mpirun -np 4 pytest -s tests

_tests_coverage:
mkdir -p .coverage
coverage run -p -m pytest -s tests
TRANSONIC_NO_REPLACE=1 coverage run -p -m pytest -s tests
# Using TRANSONIC_NO_REPLACE with mpirun in docker can block the tests
mpirun -np 2 --oversubscribe coverage run -p -m unittest discover tests

_report_coverage:
coverage combine
coverage report
coverage html
coverage xml
@echo "Code coverage analysis complete. View detailed report:"
@echo "file://${PWD}/.coverage/index.html"

coverage: _tests_coverage _report_coverage

clang-format:
find src_cpp/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i

Expand Down
3 changes: 1 addition & 2 deletions doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ perform Fast Fourier Transform (FFT) with different libraries, in particular
- [pfft](https://github.com/mpip/pfft)
- [p3dfft](https://github.com/sdsc/p3dfft)
- [mpi4py-fft](https://bitbucket.org/mpi4py/mpi4py-fft)
- [cufft](https://developer.nvidia.com/cufft) (fft library by CUDA
running on GPU)

[pfft](https://github.com/mpip/pfft), [p3dfft](https://github.com/sdsc/p3dfft) and [mpi4py-fft](https://bitbucket.org/mpi4py/mpi4py-fft) are specialized in computing FFT
efficiently on several cores of big clusters. The data can be split in pencils
Expand Down Expand Up @@ -110,6 +108,7 @@ journal = {Journal of Open Research Software}
overview
install
plugins
tutorials
examples
bench
Expand Down
8 changes: 8 additions & 0 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

# Installation and advice

```{danger}
We are working on a very deep reorganization of Fluidfft. Fluidfft 0.4.0, which
should be released in the beginning of 2024, will work with plugins. This
documentation is valid for Fluidfft <= 0.3.5. The new documentation should come soon.
```

## Installation with pip

To install fluidfft, you need a recent Python (>= 3.6) and a C++11 compiler
Expand Down
1 change: 1 addition & 0 deletions doc/plugins.md
1 change: 0 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ platforms = ["linux-64", "win-64", "osx-64"]

[tasks]
# use as `pixi run install-editable`
# install-dependencies = "pixi install && pip install -e ./lib && pip install ../transonic"
install-dependencies = "pixi install && pip install -e plugins/fluidfft-builder"
install-editable = {cmd = "pip install -e . -v --no-build-isolation --no-deps", depends_on = ["install-dependencies"]}
install-fftw = "pip install -e plugins/fluidfft-fftw --no-build-isolation -v"
Expand Down
30 changes: 24 additions & 6 deletions plugins/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
# Fluidfft plugins

Directory containing the plugins, i.e. Python packages declaring the
`fluidfft.plugins` entry point.
The main Fluidfft package only contains pure Python FFT classes using other
packages to perform the transforms.

We should have
The classes using in the background C++ Fluidfft classes are implemented in
Fluidfft plugins. A plugin is a small Python packages defining entry points
`fluidfft.plugins`.

For example, the plugin `fluidfft-fftw` defines 3 sequential methods declared
in its `pyproject.toml` file like this:

```toml
[project.entry-points."fluidfft.plugins"]

"fft2d.with_fftw1d" = "fluidfft_fftw.fft2d.with_fftw1d"
"fft2d.with_fftw2d" = "fluidfft_fftw.fft2d.with_fftw2d"
"fft3d.with_fftw3d" = "fluidfft_fftw.fft3d.with_fftw3d"
```

The following plugins are implemented in Fluidfft repository:

- [x] fluidfft-mpi4pyfft (cannot be tested because mpi4py-fft installation fails)
- [x] fluidfft-fftw
- [x] fluidfft-mpi_with_fftw
- [x] fluidfft-fftwmpi
- [x] fluidfft-mpi_with_fftw (parallel methods using the sequential FFTW3 library)
- [x] fluidfft-fftwmpi (methods using the library `libfftw_mpi`)
- [x] fluidfft-mpi4pyfft (cannot be tested because mpi4py-fft installation fails)

We plan to soon also have:

- [ ] fluidfft-p3dfft
- [ ] fluidfft-pfft
- [ ] fluidfft-pyvkfft (https://pyvkfft.readthedocs.io)
12 changes: 9 additions & 3 deletions plugins/fluidfft-fftw/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@ py_mod = import('python')
py = py_mod.find_installation('python3', pure: false)
py_dep = py.dependency()

incdir_numpy = run_command('transonic-get-include', 'numpy', check: true).stdout().strip()
incdir_numpy = run_command(
'transonic-get-include', 'numpy', check: true
).stdout().strip()
inc_np = include_directories(incdir_numpy)
np_dep = declare_dependency(include_directories: inc_np)

fftw_dep = dependency('fftw3', static: false)

dependencies = [fftw_dep, np_dep]

include_path_fluidfft_builder = run_command('fluidfft-builder-print-include-dir').stdout().strip()
include_path_fluidfft_builder = run_command(
'fluidfft-builder-print-include-dir', check: true
).stdout().strip()

include_path_cy = run_command('fluidfft-builder-print-include-dir-cython').stdout().strip()
include_path_cy = run_command(
'fluidfft-builder-print-include-dir-cython', check: true
).stdout().strip()
add_project_arguments('-I', include_path_cy, language : 'cython')

subdir('src/fluidfft_fftw')
2 changes: 1 addition & 1 deletion plugins/fluidfft-fftw/src/fluidfft_fftw/fft2d/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ foreach dim : ['1', '2']
subdir: 'fluidfft_fftw/fft2d',
)

endforeach
endforeach
12 changes: 9 additions & 3 deletions plugins/fluidfft-fftwmpi/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,22 @@ py_mod = import('python')
py = py_mod.find_installation('python3', pure: false)
py_dep = py.dependency()

incdir_numpy = run_command('transonic-get-include', 'numpy', check: true).stdout().strip()
incdir_numpy = run_command(
'transonic-get-include', 'numpy', check: true
).stdout().strip()
inc_np = include_directories(incdir_numpy)
np_dep = declare_dependency(include_directories: inc_np)

dependencies = [fftw_dep, mpi_dep, fftwmpi_dep, np_dep]
link_args = ['-lfftw3_mpi']

include_path_fluidfft_builder = run_command('fluidfft-builder-print-include-dir').stdout().strip()
include_path_fluidfft_builder = run_command(
'fluidfft-builder-print-include-dir', check: true
).stdout().strip()

include_path_cy = run_command('fluidfft-builder-print-include-dir-cython').stdout().strip()
include_path_cy = run_command(
'fluidfft-builder-print-include-dir-cython', check: true
).stdout().strip()
add_project_arguments('-I', include_path_cy, language : 'cython')

subdir('src/fluidfft_fftwmpi')
12 changes: 9 additions & 3 deletions plugins/fluidfft-mpi_with_fftw/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@ py_dep = py.dependency()
fftw_dep = dependency('fftw3', static: false)
mpi_dep = dependency('mpi', language: 'cpp')

incdir_numpy = run_command('transonic-get-include', 'numpy', check: true).stdout().strip()
incdir_numpy = run_command(
'transonic-get-include', 'numpy', check: true
).stdout().strip()
inc_np = include_directories(incdir_numpy)
np_dep = declare_dependency(include_directories: inc_np)

dependencies = [fftw_dep, mpi_dep, np_dep]

include_path_fluidfft_builder = run_command('fluidfft-builder-print-include-dir').stdout().strip()
include_path_fluidfft_builder = run_command(
'fluidfft-builder-print-include-dir', check: true
).stdout().strip()

include_path_cy = run_command('fluidfft-builder-print-include-dir-cython').stdout().strip()
include_path_cy = run_command(
'fluidfft-builder-print-include-dir-cython', check: true
).stdout().strip()
add_project_arguments('-I', include_path_cy, language : 'cython')

subdir('src/fluidfft_mpi_with_fftw')
16 changes: 5 additions & 11 deletions plugins/pure_cpp/2d/run_benchs.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,16 @@ def call_bash(commands):

for cls in classes:
src += (
"\nnb_procs['"
+ cls
+ "'] = "
f"\nnb_procs['{cls}'] = "
+ repr(np.array(nb_procs[cls]))
+ "\ntimes_fft['"
+ cls
+ "'] = "
+ f"\ntimes_fft['{cls}'] = "
+ repr(np.array(times_fft[cls]))
+ "\ntimes_ifft['"
+ cls
+ "'] = "
+ "\ntimes_ifft['{cls}'] = "
+ repr(np.array(times_ifft[cls]))
)

if not os.path.exists(output_dir):
os.mkdir(output_dir)

with open(output_dir + "/bench.py", "w") as f:
f.write(src + "\n")
with open(output_dir + "/bench.py", "w", encoding="utf8") as file:
file.write(src + "\n")

0 comments on commit ee1a61a

Please sign in to comment.