Read about our upcoming Code of Conduct on this issue

Commit b3858e5a authored by Pierre Augier's avatar Pierre Augier
Browse files

Include benchmarks in the documentation

parent 26b28fcfa81d
......@@ -3,6 +3,9 @@
Benchmarking
============
Command-line utilities
----------------------
One of the advantage of using fluidfft is to be able to use the fastest fft
library for a particular problem and in a particular (super)computer.
......@@ -26,3 +29,20 @@ processes (if you want to use MPI), you can analyze the results for example
with::
fluidfft-bench-analysis 1024 -d 2
Benchmarks on `LEGI <http://www.legi.grenoble-inp.fr>`_ clusters
----------------------------------------------------------------
.. figure:: tmp/fig_legi_cluster7_2d.png
:scale: 80 %
:alt: Benchmarks at LEGI on cluster7.
Speedup computed from the median of the elapsed times for 2d fft (1024x1024,
left: fft and right: ifft) at LEGI on cluster7 (2014, 16 nodes Xeon DELL
C6220, 16 cores per node). We see that the scaling is not far from linear
for intra-node computation. In contrast, the speedup is really bad for
computations involving inter-node computation.
The benchmark is not sufficiently accurate to measure the cost of calling
the functions from Python. The method fft2dmpiwithfftw1d is slower and seems
less regular.
......@@ -16,11 +16,31 @@ import os
import subprocess
from runpy import run_path
from fluidrtd.ipynb_maker import ipynb_to_rst
import fluidfft
import fluidfft.bench_analysis
from fluidfft.bench_analysis import plot_scaling
here = os.path.dirname(__file__)
tmp = os.path.join(here, 'tmp')
def save_fig_scaling(dir_name, n0, n1, dim):
path_dir = os.path.join(here, 'benchmarks', dir_name)
path_fig = os.path.join(tmp, 'fig_' + dir_name + '.png')
fig = plot_scaling(path_dir, None, n0, n1, dim, show=False)
fig.savefig(path_fig)
tmp = os.path.join(os.path.dirname(__file__), 'tmp')
if not os.path.exists(tmp):
os.mkdir(tmp)
from fluidrtd.ipynb_maker import ipynb_to_rst
ipynb_to_rst()
save_fig_scaling('legi_cluster7_2d', 1024, 1024, '2d')
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
......
......@@ -7,7 +7,8 @@ This package provides C++ classes and their Python wrapper classes written in
Cython useful to perform Fast Fourier Transform (FFT) with different libraries,
in particular
- fftw3 and fftw3-mpi
- `fftw3 <http://www.fftw.org/>`_ and `fftw3-mpi
<http://www.fftw.org/fftw3_doc/Distributed_002dmemory-FFTW-with-MPI.html>`_
- `pfft <https://github.com/mpip/pfft>`_
......
......@@ -42,7 +42,7 @@ def filter_by_shape(df, n0, n1):
return df[df.columns.difference(['n0', 'n1'])]
def plot_scaling(path_dir, hostname, n0, n1, dim):
def plot_scaling(path_dir, hostname, n0, n1, dim, show=True):
df = load_bench(path_dir, hostname, dim)
df = filter_by_shape(df, n0, n1)
......@@ -53,7 +53,8 @@ def plot_scaling(path_dir, hostname, n0, n1, dim):
if df.empty:
raise ValueError('No benchmarks corresponding to the input parameters')
print(df)
if show:
print(df)
nb_proc_min = df.nb_proc.min()
......@@ -81,7 +82,7 @@ def plot_scaling(path_dir, hostname, n0, n1, dim):
t_min_ifft, name_min_ifft, key_min_ifft = get_min(
df_ifft_nb_proc_min)
plt.figure(figsize=[15, 5])
fig = plt.figure(figsize=[15, 5])
ax0 = plt.subplot(121)
ax1 = plt.subplot(122)
......@@ -111,15 +112,17 @@ def plot_scaling(path_dir, hostname, n0, n1, dim):
ax.set_xscale('log')
ax.set_yscale('log')
ax0.set_title('best for {} procs: {}, {}'.format(
nb_proc_min, name_min_fft, key_min_fft))
ax1.set_title('best for {} procs: {}, {}'.format(
nb_proc_min, name_min_ifft, key_min_ifft))
ax0.set_title('Best for {} procs: {}, {} ({:.2f} ms)'.format(
nb_proc_min, name_min_fft, key_min_fft, t_min_fft*1000))
ax1.set_title('Best for {} procs: {}, {} ({:.2f} ms)'.format(
nb_proc_min, name_min_ifft, key_min_ifft, t_min_ifft*1000))
ax0.legend()
ax1.legend()
plt.show()
if show:
plt.show()
return fig
def run():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment