-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
850 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
develop: | ||
pip install -e . -vv --no-build-isolation --no-deps | ||
|
||
clean: | ||
rm -rf build | ||
|
||
test: | ||
mpirun -np 2 pytest --exitfirst -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Fluidfft plugin for parallel FFTs using P3DFFT | ||
|
||
This plugin provides a method for parallel FFTs using P3DFFT: | ||
`fft3d.mpi_with_p3dfft`. | ||
|
||
## Environment variables | ||
|
||
The default include path can be expanded with `CPATH` for GCC/Clang and | ||
`INCLUDE` for MSVC. | ||
|
||
The default library search path can be expanded with `LIBRARY_PATH` for | ||
GCC/Clang and `LIB` for MSVC. | ||
|
||
Alternatively, one could define `PFFT_DIR` or `PFFT_LIB_DIR` and | ||
`PFFT_INCLUDE_DIR`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
project( | ||
'fluidfft-p3dfft', | ||
'cpp', | ||
'cython', | ||
license: 'CeCILL', | ||
meson_version: '>= 1.1.0', | ||
default_options: [ | ||
'buildtype=release', | ||
'c_std=c99', | ||
'cpp_std=c++11', | ||
], | ||
) | ||
|
||
py_mod = import('python') | ||
py = py_mod.find_installation('python3', pure: false) | ||
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() | ||
inc_np = include_directories(incdir_numpy) | ||
np_dep = declare_dependency(include_directories: inc_np) | ||
|
||
compiler = meson.get_compiler('cpp') | ||
# fftw_mpi is not found on Ubuntu | ||
fftwmpi_dep = compiler.find_library('fftw_mpi', required: false) | ||
|
||
|
||
PFFT_DIR = run_command( | ||
py, '-c', 'import os; print(os.environ.get("PFFT_DIR", ""))', | ||
check: true | ||
).stdout().strip() | ||
message('PFFT_DIR=' + PFFT_DIR) | ||
|
||
if PFFT_DIR != '' | ||
PFFT_LIB_DIR = PFFT_DIR + '/lib' | ||
PFFT_INCLUDE_DIR = PFFT_DIR + '/include' | ||
else | ||
PFFT_LIB_DIR = run_command( | ||
py, '-c', 'import os; print(os.environ.get("PFFT_LIB_DIR", ""))', | ||
check: true | ||
).stdout().strip() | ||
message('PFFT_LIB_DIR=' + PFFT_LIB_DIR) | ||
|
||
PFFT_INCLUDE_DIR = run_command( | ||
py, '-c', 'import os; print(os.environ.get("PFFT_INCLUDE_DIR", ""))', | ||
check: true | ||
).stdout().strip() | ||
message('PFFT_INCLUDE_DIR=' + PFFT_INCLUDE_DIR) | ||
endif | ||
|
||
dirs = [] | ||
if PFFT_LIB_DIR != '' | ||
dirs += [PFFT_LIB_DIR] | ||
endif | ||
|
||
include_directories = [] | ||
if PFFT_INCLUDE_DIR != '' | ||
include_directories = include_directories(PFFT_INCLUDE_DIR) | ||
endif | ||
|
||
p3dfft_dep = compiler.find_library( | ||
'p3dfft', | ||
dirs: dirs, | ||
has_headers: ['p3dfft.h'], | ||
header_include_directories: include_directories, | ||
required: true, | ||
) | ||
link_args = ['-lfftw3_mpi'] | ||
|
||
dependencies = [fftw_dep, mpi_dep, np_dep, fftwmpi_dep, p3dfft_dep] | ||
|
||
include_path_fluidfft_builder = run_command( | ||
'fluidfft-builder-print-include-dir', check: true | ||
).stdout().strip() | ||
|
||
include_directories = [include_directories, include_path_fluidfft_builder] | ||
|
||
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_p3dfft') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[build-system] | ||
requires = [ | ||
"meson-python", "numpy", "fluidfft-builder>=0.0.1", "cython", "mpi4py", "transonic>=0.6.1" | ||
] | ||
build-backend = 'mesonpy' | ||
|
||
[project] | ||
name = "fluidfft-p3dfft" | ||
version = "0.0.1" | ||
description = "Fluidfft plugin for MPI FFTs using fftw" | ||
authors = [{name = "Pierre Augier", email = "pierre.augier@univ-grenoble-alpes.fr"}] | ||
license = {file = "LICENSE"} | ||
classifiers = ["License :: OSI Approved :: MIT License"] | ||
dependencies = ["fluidfft"] | ||
readme = "README.md" | ||
|
||
[project.urls] | ||
Home = "https://foss.heptapod.net/fluiddyn/fluidfft" | ||
|
||
[project.entry-points."fluidfft.plugins"] | ||
|
||
"fft3d.mpi_with_p3dfft" = "fluidfft_p3dfft.mpi_with_p3dfft" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
py.install_sources('__init__.py', subdir: 'fluidfft_p3dfft') | ||
|
||
pyx = custom_target( | ||
'mpi_with_p3dfft.pyx', | ||
output: 'mpi_with_p3dfft.pyx', | ||
command: ['fluidfft-builder-make-file', '@OUTPUT@', 'FFT3DMPIWithP3DFFT'], | ||
) | ||
|
||
pxd = custom_target( | ||
'fft3dmpi_with_p3dfft.pxd', | ||
output: 'fft3dmpi_with_p3dfft.pxd', | ||
command: ['fluidfft-builder-make-file', '@OUTPUT@', 'FFT3DMPIWithP3DFFT'], | ||
) | ||
|
||
py.extension_module( | ||
'mpi_with_p3dfft', | ||
pyx, | ||
pxd, | ||
'fft3dmpi_with_p3dfft.cpp', | ||
'fft3dmpi_with_p3dfft.h', | ||
include_path_fluidfft_builder / 'base_fft.cpp', | ||
include_path_fluidfft_builder / 'base_fft3d.cpp', | ||
include_path_fluidfft_builder / 'base_fftmpi.cpp', | ||
include_path_fluidfft_builder / 'base_fft3dmpi.cpp', | ||
dependencies: dependencies, | ||
override_options : ['cython_language=cpp'], | ||
include_directories: include_directories, | ||
link_args: link_args, | ||
install: true, | ||
subdir: 'fluidfft_p3dfft', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from unittest import TestCase | ||
|
||
from fluidfft.fft3d.testing import complete_test_class_3d | ||
|
||
|
||
class Tests(TestCase): | ||
pass | ||
|
||
|
||
complete_test_class_3d("fft3d.mpi_with_p3dfft", Tests) |