Skip to content

Commit

Permalink
Merge branch 'topic/default/adapt-fluidfft-0.4.0' into 'branch/default'
Browse files Browse the repository at this point in the history
Try fluidfft 0.4.0rc1

See merge request fluiddyn/fluidsim!373
  • Loading branch information
paugier committed Feb 12, 2024
2 parents caf2339 + 262ba40 commit fece897
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 179 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ pixi-test:
# it is quite unnecessary to run on every invocation.
image:build:
stage: image
needs: []
tags:
- container-registry-push
rules:
Expand Down
3 changes: 0 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ build:
tools:
python: "3.11"
apt_packages:
# workaround: bad fluidfft with false hard dependency to mpi4py
- libopenmpi-dev
- graphviz
jobs:
post_create_environment:
- pip install pdm pip -U
post_install:
- pdm use -f $READTHEDOCS_VIRTUALENV_PATH
- FLUIDFFT_TRANSONIC_BACKEND="python" pip install fluidfft
- pdm sync -G doc -G fft -G test --no-self
- pip install . --config-settings=setup-args=-Dtransonic-backend=python

Expand Down
7 changes: 6 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ See also the [unreleased changes].

% Security Security in case of vulnerabilities.

## [0.8.1] (2024-02-12)

- Few fixes for Fluidfft 0.4.0

## [0.8.0] (2024-01-31)

- Build and upload wheels on PyPI with Github Actions!
Expand Down Expand Up @@ -323,4 +327,5 @@ Merge with geofluidsim (Ashwin Vishnu Mohanan repository)
[0.7.3]: https://foss.heptapod.net/fluiddyn/fluidsim/-/compare/0.7.2...0.7.3
[0.7.4]: https://foss.heptapod.net/fluiddyn/fluidsim/-/compare/0.7.3...0.7.4
[0.8.0]: https://foss.heptapod.net/fluiddyn/fluidsim/-/compare/0.7.4...0.8.0
[unreleased changes]: https://foss.heptapod.net/fluiddyn/fluidsim/-/compare/0.8.0...branch%2Fdefault
[0.8.1]: https://foss.heptapod.net/fluiddyn/fluidsim/-/compare/0.8.0...0.8.1
[unreleased changes]: https://foss.heptapod.net/fluiddyn/fluidsim/-/compare/0.8.1...branch%2Fdefault
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ MPI_NUM_PROCS ?= 2
.PHONY: black black_check clean clean_pyc clean_so cleantransonic coverage_short develop dist lint _report_coverage shortlog tests _tests_coverage tests_mpi

develop: sync
pdm run pip install -e . -v --no-build-isolation --no-deps

sync:
pdm sync --clean --no-self
pdm sync --clean

install_fluidfft_plugins:
pdm run pip install fluidfft-fftw fluidfft-fftwmpi fluidfft-mpi_with_fftw

lock:
pdm lock -G :all
pdm lock

clean_so:
find fluidsim -name "*.so" -delete
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/simul_ns3dbouss_initfields_in_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# fft = 'p3dfft'

# for sequential runs, just comment these 2 lines
params.oper.type_fft = "fluidfft.fft3d.mpi_with_" + fft
params.oper.type_fft = "fft3d.mpi_with_" + fft
params.short_name_type_run = fft

r"""
Expand Down
5 changes: 2 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ RUN mkdir -p $HOME/.local/lib
RUN ln -s /usr/include/fftw* $HOME/.local/include
RUN ln -s /usr/lib/x86_64-linux-gnu/libfftw3* $HOME/.local/lib

ENV LD_LIBRARY_PATH=$HOME/.local/lib
ENV PATH=$HOME/.local/bin:$PATH
ENV LIBRARY_PATH=$HOME/.local/lib
ENV CPATH=$HOME/.local/include:$CPATH
ENV LD_LIBRARY_PATH=$HOME/.local/lib

RUN mkdir -p $HOME/.config/matplotlib
RUN echo 'backend : agg' > $HOME/.config/matplotlib/matplotlibrc

RUN wget https://foss.heptapod.net/fluiddyn/fluidfft/raw/branch/default/site.cfg.files/site.cfg.docker_mpi -O ~/.fluidfft-site.cfg

RUN wget https://foss.heptapod.net/fluiddyn/fluidfft/raw/branch/default/doc/install/install_p3dfft.sh -O ./install_p3dfft.sh
RUN chmod +x install_p3dfft.sh
RUN export FCFLAGS="-w -fallow-argument-mismatch -O2" && \
Expand Down
2 changes: 1 addition & 1 deletion fluidsim/operators/test/test_operators3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def xfail_if_fluidfft_class_not_importable(func):
if not FLUIDFFT_INSTALLED or "FLUIDSIM_TYPE_FFT" not in os.environ:
return func

from fluidfft.fft3d import import_fft_class
from fluidfft import import_fft_class

try:
import_fft_class(os.environ["FLUIDSIM_TYPE_FFT"])
Expand Down
36 changes: 15 additions & 21 deletions fluidsim/util/console/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


path_results = "/tmp/fluidsim_bench"
old_print = print
builtins_print = print
print = mpi.printby0
rank = mpi.rank
nb_proc = mpi.nb_proc
Expand Down Expand Up @@ -96,31 +96,24 @@ def get_opfft(n0, n1, n2=None, dim=None, type_fft=None, only_dict=False):
elif isinstance(n2, int) or dim == "3d":
from fluidfft.fft3d import get_classes_mpi

if mpi.rank == 0:
d = get_classes_mpi()
else:
d = {}

if mpi.nb_proc > 1:
d = mpi.comm.bcast(d)
d = get_classes_mpi()

if only_dict:
return d

else:
if type_fft not in d:
raise ConsoleError(f"{type_fft} not in {list(d.keys())}")
if type_fft not in d:
raise ConsoleError(f"{type_fft} not in {list(d.keys())}")

ClassFFT = d[type_fft]
if ClassFFT is None:
raise RuntimeError(f"Class {type_fft} is not available")
ClassFFT = d[type_fft]
if ClassFFT is None:
raise RuntimeError(f"Class {type_fft} is not available")

if n2 is None:
opfft = ClassFFT(n0, n1)
else:
opfft = ClassFFT(n0, n1, n2)
if n2 is None:
opfft = ClassFFT(n0, n1)
else:
opfft = ClassFFT(n0, n1, n2)

return opfft
return opfft


def estimate_shapes_weak_scaling(
Expand Down Expand Up @@ -206,7 +199,7 @@ def print_shape_loc(n0, n1, n2=None, type_fft=None):
shapeK_loc = opfft.get_shapeK_loc()
print("-" * 8)
print("type fft = ", type_fft)
old_print(
builtins_print(
f"rank {rank}: shapeX_loc = {shapeX_loc}, shapeK_loc = {shapeK_loc}"
)

Expand Down Expand Up @@ -257,7 +250,8 @@ def run(args):
if args.list_type_fft:
print("FFT classes available for", args.dim.upper())
d = get_opfft(args.n0, args.n1, args.n2, dim=args.dim, only_dict=True)
info._print_dict(d)
if rank == 0:
info._print_dict(d)
elif args.print_shape_loc:
if args.type_fft is None:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion lib/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = 'fluidsim-core'
version = "0.8.0"
version = "0.8.1"
description = "Pure-Python core library for FluidSim framework"
requires-python = ">=3.9"
authors = [
Expand Down
22 changes: 7 additions & 15 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,11 @@ def _test(session, env=None):
def test_without_fft_and_pythran(session):
command = "pdm sync --clean -G dev -G test -G mpi --no-self"
session.run_always(*command.split(), external=True)
session.install(
".", "-C", "setup-args=-Dtransonic-backend=python", "--no-deps"
)
session.install(".", "-C", "setup-args=-Dtransonic-backend=python", "--no-deps")

_test(session, env={"TRANSONIC_BACKEND": "python", "TRANSONIC_NO_REPLACE": "1"})


def _install_fluidfft(session):
# first install fluidfft without Pythran compilation
session.install(
"fluidfft", "--no-deps", env={"FLUIDFFT_TRANSONIC_BACKEND": "python"}
)


time_last = 0


Expand All @@ -66,10 +57,6 @@ def print_times(task: str):
print(f"Session started since {timedelta(seconds=time_now - time_start)}")
time_last = time_now

_install_fluidfft(session)

print_times("installing fluidfft")

command = "pdm sync --clean -G dev -G test -G fft -G mpi --no-self"
session.run_always(*command.split(), external=True)

Expand All @@ -82,14 +69,19 @@ def print_times(task: str):

print_times("installing fluidsim")

short_names = ["fftw", "mpi_with_fftw", "fftwmpi"]
if "GITLAB_CI" in os.environ:
short_names.extend(["pfft", "p3dfft"])
for short_name in short_names:
session.install(f"fluidfft-{short_name}")

_test(session)

print_times("tests")


@nox.session
def doc(session):
_install_fluidfft(session)
command = "pdm sync -G doc -G fft -G test --no-self"
session.run_always(*command.split(), external=True)
session.install(".", "-C", "setup-args=-Dtransonic-backend=python", "--no-deps")
Expand Down
Loading

0 comments on commit fece897

Please sign in to comment.