Commit b5fce974 authored by Ashwin Vishnu's avatar Ashwin Vishnu
Browse files

Triolith benchmarks for 2D, check_openmp with timeit module

parent 10e180d40e01
# OMP_NUM_THREADS=1 python check_openmp.py
# OMP_NUM_THREADS=$(nproc) python check_openmp.py
import sys
import timeit
import numpy as np
from numpy.distutils.system_info import get_info
from fluidfft.fft2d.util_pythran import divfft_from_vecfft
shape = (1024,)*2
info = get_info('blas_opt')
print('BLAS info:')
for kk, vv in info.items():
print(' * ' + kk + ' ' + str(vv))
a_fft = np.ones(shape, dtype=np.complex128)
b_fft = np.ones(shape, dtype=np.complex128)
kx = np.ones(shape, dtype=np.float64)
ky = np.ones(shape, dtype=np.float64)
setup = (
'import numpy as np',
'from fluidfft.fft2d.util_pythran import divfft_from_vecfft',
'shape = (1024,)*2',
'a_fft = np.ones(shape, dtype=np.complex128)',
'b_fft = np.ones(shape, dtype=np.complex128)',
'kx = np.ones(shape, dtype=np.float64)',
'ky = np.ones(shape, dtype=np.float64)',
)
setup = ';'.join(setup)
cmd = 'div_fft = divfft_from_vecfft(a_fft, b_fft, kx, ky)'
for i in range(2000):
div_fft = divfft_from_vecfft(a_fft, b_fft, kx, ky)
nb_iter = 2000
t = timeit.Timer(cmd, setup=setup)
print('divfft_from_vecfft: {} sec / iteration for {} iterations'.format(
t.timeit(nb_iter) / nb_iter, nb_iter))
#!/usr/bin/env python
import os
import numpy as np
from fluiddyn.clusters.snic import ClusterSNIC as Cluster
import fluidfft
argv = ('2D', '1024 -d 2') # 2D benchmarks
# argv = ('3D', '960 960 240') # 3D benchmarks
# mode = 'intra'
mode = 'inter'
def init_cluster():
global output_dir
cluster = Cluster()
if cluster.name_cluster == 'beskow':
cluster.default_project = '2016-34-10'
interactive=False
else:
cluster.default_project = 'SNIC2016-34-10'
interactive=True
output_dir = os.path.abspath('{}/../doc/benchmarks/snic_{}_{}'.format(
os.path.split(fluidfft.__file__)[0], cluster.name_cluster, argv[0]))
if not os.path.exists(output_dir):
os.makedirs(output_dir)
print('Output directory: ', output_dir)
cluster.commands_unsetting_env.extend([
'fluidinfo -o ' + output_dir])
return cluster, interactive
def submit(cluster, interactive, nb_nodes, nb_cores_per_node=None):
if nb_cores_per_node is None:
nb_cores_per_node = cluster.nb_cores_per_node
nb_mpi = nb_cores_per_node * nb_nodes
cluster.submit_command(
'fluidfft-bench ' + argv[1] + ' -o ' + output_dir,
name_run='bench_{}_{}'.format(argv[0], nb_mpi),
nb_nodes=nb_nodes,
nb_cores_per_node=nb_cores_per_node,
walltime='00:01:00',
nb_mpi_processes=nb_mpi, omp_num_threads=1,
ask=False, bash=False, interactive=interactive)
cluster, interactive = init_cluster()
if mode == 'intra':
nb_nodes = 1
# nb_cores = [2, 4, 8, 12, 16, 20, 24, 28, 32]
nb_cores = 4 * np.arange(0, 9)
nb_cores[0] = 2
for nb_cores_per_node in nb_cores:
if nb_cores_per_node > cluster.nb_cores_per_node:
continue
submit(cluster, interactive, nb_nodes, nb_cores_per_node)
else:
nodes = [2, 4, 8]
for nb_nodes in nodes:
submit(cluster, interactive, nb_nodes)
{"benchmarks_classes": [{"name": "fft2dmpiwithfftw1d", "t_fft_as_arg": 0.0014765262603759766, "t_fft_cpp": 0.0014684199999999991, "t_fft_return": 0.0014996528625488281, "t_ifft_as_arg": 0.0015676021575927734, "t_ifft_cpp": 0.0015398, "t_ifft_return": 0.0017620325088500977}, {"name": "fft2dmpiwithfftwmpi2d", "t_fft_as_arg": 0.0014134645462036133, "t_fft_cpp": 0.0013965800000000001, "t_fft_return": 0.0014519691467285156, "t_ifft_as_arg": 0.0016205310821533203, "t_ifft_cpp": 0.0016082799999999997, "t_ifft_return": 0.0043828487396240234}], "hostname": "n1256", "n0": 1024, "n1": 1024, "nb_proc": 16, "pid": 17418, "time_as_str": "2017-10-09_23-44-51"}
{"benchmarks_classes": [{"name": "fft2dmpiwithfftw1d", "t_fft_as_arg": 0.011350274085998535, "t_fft_cpp": 0.011465939999999999, "t_fft_return": 0.011484980583190918, "t_ifft_as_arg": 0.01351618766784668, "t_ifft_cpp": 0.01542378, "t_ifft_return": 0.014298677444458008}, {"name": "fft2dmpiwithfftwmpi2d", "t_fft_as_arg": 0.008397698402404785, "t_fft_cpp": 0.0085577, "t_fft_return": 0.008768796920776367, "t_ifft_as_arg": 0.009399652481079102, "t_ifft_cpp": 0.00985622, "t_ifft_return": 0.009251594543457031}], "hostname": "n123", "n0": 1024, "n1": 1024, "nb_proc": 2, "pid": 34354, "time_as_str": "2017-10-09_23-42-51"}
{"benchmarks_classes": [{"name": "fft2dmpiwithfftw1d", "t_fft_as_arg": 0.0011435747146606445, "t_fft_cpp": 0.007818199999999999, "t_fft_return": 0.0011587142944335938, "t_ifft_as_arg": 0.0011222362518310547, "t_ifft_cpp": 0.0011065, "t_ifft_return": 0.0018898248672485352}, {"name": "fft2dmpiwithfftwmpi2d", "t_fft_as_arg": 0.0011756420135498047, "t_fft_cpp": 0.0011598799999999999, "t_fft_return": 0.0011742115020751953, "t_ifft_as_arg": 0.0013475418090820312, "t_ifft_cpp": 0.0012308, "t_ifft_return": 0.002980470657348633}], "hostname": "n123", "n0": 1024, "n1": 1024, "nb_proc": 32, "pid": 39855, "time_as_str": "2017-10-10_01-07-47"}
{"benchmarks_classes": [{"name": "fft2dmpiwithfftw1d", "t_fft_as_arg": 0.005479693412780762, "t_fft_cpp": 0.00563798, "t_fft_return": 0.005263566970825195, "t_ifft_as_arg": 0.006963610649108887, "t_ifft_cpp": 0.007656619999999999, "t_ifft_return": 0.007580757141113281}, {"name": "fft2dmpiwithfftwmpi2d", "t_fft_as_arg": 0.004790067672729492, "t_fft_cpp": 0.00467772, "t_fft_return": 0.004674792289733887, "t_ifft_as_arg": 0.0048950910568237305, "t_ifft_cpp": 0.00504158, "t_ifft_return": 0.010772109031677246}], "hostname": "n123", "n0": 1024, "n1": 1024, "nb_proc": 4, "pid": 34439, "time_as_str": "2017-10-09_23-42-51"}
{"benchmarks_classes": [{"name": "fft2dmpiwithfftw1d", "t_fft_as_arg": 0.002596735954284668, "t_fft_cpp": 0.0025700199999999997, "t_fft_return": 0.002608180046081543, "t_ifft_as_arg": 0.002918839454650879, "t_ifft_cpp": 0.00287302, "t_ifft_return": 0.002969503402709961}, {"name": "fft2dmpiwithfftwmpi2d", "t_fft_as_arg": 0.0022919178009033203, "t_fft_cpp": 0.00228098, "t_fft_return": 0.0022524595260620117, "t_ifft_as_arg": 0.0022832155227661133, "t_ifft_cpp": 0.00233784, "t_ifft_return": 0.005821824073791504}], "hostname": "n1150", "n0": 1024, "n1": 1024, "nb_proc": 8, "pid": 18712, "time_as_str": "2017-10-09_23-42-51"}
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