Skip to content
Snippets Groups Projects
Commit 92db7645 authored by Ashwin Vishnu's avatar Ashwin Vishnu
Browse files

Script to make profile figs: WIP - need to get sequential profile data.

parent f4f82949
No related branches found
No related tags found
No related merge requests found
......@@ -645,7 +645,7 @@
an array shape of $320\times640\times640$ is not far from the ideal linear
trend. The fastest library is \codeinline{fftwmpi3d} for this case. As expected
from FFT algorithms, there is a slight drop in speedup when the array size is
not exactly divisible by the number of processes, i.e.\~with 12 processes. The
not exactly divisible by the number of processes, i.e.\ with 12 processes. The
speedup declines rapidly when more than one node is employed (above 20
processes). This effect can be attributed to the latency introduced by
inter-node communications, a hardware limitation.
......
......@@ -28,6 +28,13 @@
doit: vimtex $(name).pdf
zathura $(name).pdf &
figdata:
python Python/sync.py
figures: figdata tmp/fig_compare_with_ns3d.pdf
Python/make_fig_profile.py
$(name).pdf: tmp/fig_compare_with_ns3d.pdf $(name).log
@# $(LATEX) $(name).tex
@if [ `grep "Package rerunfilecheck Warning: File" $(name).log | wc -l` != 0 ]; then $(LATEX) $(name).tex; fi
......
......@@ -2,7 +2,7 @@
import os
from fluiddyn.output.rcparams import set_rcparams
from fluiddyn.output.rcparams import set_rcparams
import pylab as pl
import matplotlib.pyplot as plt
titles = ['({})'.format(a) for a in ascii_lowercase]
......@@ -12,14 +12,11 @@
def matplotlib_rc(
fontsize=8, dpi=300, tex=True, interactive=False):
# pl.rc('text', usetex=tex)
# _font = get_font(fontsize)
# pl.rc('font', **_font)
# set_rcparams(fontsize)
pl.rc('font', size=fontsize)
pl.rc('figure', dpi=dpi)
pl.rc('xtick', direction='in')
pl.rc('ytick', direction='in')
# set_rcparams(fontsize, for_article=True, for_beamer=False)
plt.rc('legend', fontsize=fontsize-2)
plt.rc('font', size=fontsize)
plt.rc('figure', dpi=dpi)
plt.rc('xtick', direction='in')
plt.rc('ytick', direction='in')
if interactive:
......@@ -24,4 +21,4 @@
if interactive:
pl.ion()
plt.ion()
else:
......@@ -27,2 +24,2 @@
else:
pl.ioff()
plt.ioff()
#!/usr/bin/env python
import os
from glob import glob
import getpass
from pathlib import Path
import matplotlib.pyplot as plt
from fluidsim.util.console import profile as pf
from base import matplotlib_rc, titles, curdir
......@@ -13,4 +14,8 @@
figx = 8 # 20 / 2.54
figy = 2 # 6 / 2.54
root = Path('/tmp') / getpass.getuser() / 'fluidsim-bench-results'/ 'profiles'
if not os.path.exists(root):
raise FileNotFoundError('Run sync.py')
patterns2d = [
......@@ -16,6 +21,6 @@
patterns2d = [
'../Profiles/profiles/snic_beskow_2d/*np=1*fftw1d*',
'../Profiles/profiles/snic_beskow_2d/*np=16*fftwmpi2d*',
(root / 'beskow_1024x1024/').glob('*np=2*fftwmpi2d*'), # TODO: replace np=1 case
(root / 'beskow_1024x1024/').glob('*np=16*fftwmpi2d*'),
]
patterns3d = [
......@@ -19,10 +24,10 @@
]
patterns3d = [
'../Profiles/profiles/snic_beskow_3d/*np=1*fftw3d*',
'../Profiles/profiles/snic_beskow_3d/*np=16*fftwmpi3d*',
'../Profiles/profiles/snic_beskow_3d/*np=128*fftwmpi3d*',
'../Profiles/profiles/snic_beskow_3d/*np=1024*fftwmpi3d*',
(root / 'beskow_128x128x128/').glob('*np=2*fftwmpi3d*'), # TODO: replace np=1 case
(root / 'beskow_128x128x128/').glob('*np=16*fftwmpi3d*'),
(root / 'beskow_512x512x512/').glob('*np=128*fftwmpi3d*'),
(root / 'beskow_1024x1024x1024/').glob('*np=1024*fftwmpi3d*'),
]
def paths_from_patterns(patterns):
......@@ -26,5 +31,4 @@
]
def paths_from_patterns(patterns):
patterns = [os.path.abspath(curdir + '/' + p) for p in patterns]
try:
......@@ -30,9 +34,9 @@
try:
path_stats = [glob(p)[0] for p in patterns]
except IndexError:
raise ValueError('Bad glob pattern or path does not exist')
path_stats = [str(next(p)) for p in patterns]
except StopIteration:
raise ValueError('Bad glob pattern or path does not exist.')
return path_stats
def plot(path, ax, title='', **kwargs):
path_dir = os.path.dirname(path)
......@@ -34,7 +38,7 @@
return path_stats
def plot(path, ax, title='', **kwargs):
path_dir = os.path.dirname(path)
nb_dim = int(path_dir[-2])
nb_dim = path_dir.split('_')[1].count('x') + 1
times, long_functions = pf.analyze_stats(path, nb_dim)
......@@ -40,4 +44,9 @@
times, long_functions = pf.analyze_stats(path, nb_dim)
pie = pf.plot_pie(
color_map = plt.get_cmap('Pastel1')
num_of_colors = len(long_functions) + 1
colors = color_map([x/num_of_colors for x in range(num_of_colors)])
patches, texts, autotexts = pf.plot_pie(
times, long_functions, ax, startangle=0, times_descending=True,
explode=0.5, textprops=textprops, counterclock=False, pctdistance=0.8,
......@@ -42,4 +51,4 @@
times, long_functions, ax, startangle=0, times_descending=True,
explode=0.5, textprops=textprops, counterclock=False, pctdistance=0.8,
**kwargs)
colors=colors, **kwargs)
ax.set_title(title, loc='left')
......@@ -45,5 +54,4 @@
ax.set_title(title, loc='left')
return pie
pies2d = []
fig2d, axes2d = plt.subplots(1, 2)
......
import os
import getpass
from subprocess import call
import matplotlib.pyplot as plt
from fluiddyn.util import modification_date
here = os.path.abspath(os.path.dirname(__file__))
here_tmp = os.path.join(here, '../tmp')
if not os.path.exists(here_tmp):
os.mkdir(here_tmp)
path_tmp = os.path.join('/tmp', getpass.getuser())
if not os.path.exists(path_tmp):
os.mkdir(path_tmp)
repo_fluidsim_bench_results = \
'https://bitbucket.org/fluiddyn/fluidsim-bench-results'
path_fluidsim_bench_results = os.path.join(path_tmp, 'fluidsim-bench-results')
has_to_pull = True
if os.path.exists(path_fluidsim_bench_results):
if has_to_pull:
os.chdir(path_fluidsim_bench_results)
call(['hg', 'pull', '-u'])
else:
os.chdir(path_tmp)
call(['hg', 'clone', repo_fluidsim_bench_results])
os.chdir(here)
def save_fig_scaling(dir_name, dim, n0, n1, n2=None):
path_dir = os.path.join(path_fluidsim_bench_results, dir_name)
path_fig = os.path.join(here_tmp, 'fig_' + dir_name + '.pdf')
if not os.path.exists(path_fig) or \
modification_date(path_dir) > modification_date(path_fig):
print('make fig', path_fig)
fig = plot_scaling(path_dir, None, dim, n0, n1, n2, show=False,
for_latex=True)
fig.set_size_inches(10, 5)
fig.suptitle('')
fig.tight_layout(
pad=1.02, h_pad=None, w_pad=None, rect=(-0.01, -0.02, 1, 1)
)
fig.savefig(path_fig, dpi=800)
#
# save_fig_scaling('legi_cluster8_320x640x640', '3d', 320, 640, 640)
# save_fig_scaling('legi_cluster8_2160x2160', '2d', 2160, 2160)
# save_fig_scaling('occigen_384x1152x1152', '3d', 384, 1152, 1152)
# save_fig_scaling('beskow_384x1152x1152', '3d', 384, 1152, 1152)
# save_fig_scaling('occigen_1152x1152x1152', '3d', 1152, 1152, 1152)
# save_fig_scaling('beskow_1152x1152x1152', '3d', 1152, 1152, 1152)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment