Skip to content

Commit

Permalink
initial script
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamonDinoia committed Aug 19, 2024
1 parent 38a9c62 commit 3b3388e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 24 deletions.
59 changes: 39 additions & 20 deletions perftest/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,48 @@ def build_args(args):
args_list.append(key + '=' + value)
return args_list

versions = ['2.2.0', 'master']
versions = ['v2.2.0', 'v2.3.0-rc1']
fft = ['fftw', 'ducc']

# clone the repository
run_command('git', ['clone', 'https://github.com/DiamonDinoia/finufft.git'])
run_command('git', ['-C','finufft', 'fetch'])
run_command('git', ['-C','finufft', 'checkout', 'v2.2.0'])
# checkout folder perftest from master branch
run_command('git', ['-C','finufft', 'checkout', 'perftests', '--', 'perftest'])
run_command('cmake', ['-S', 'finufft', '-B', 'build', '-DFINUFFT_BUILD_TESTS=ON'])
run_command('cmake', ['--build', 'build', '-j', str(os.cpu_count()), '--target', 'perftest'])
args = {'--prec': 'f',
'--n_runs': '5',
'--method': '0',
'--sort': '1',
'--N1': '16777216',
# '--N1': '256',
# '--N2': '256',
# '--N3': '256',
'--kerevalmethod': '1',
'--M': '1E5',
'--tol': '1E-6'}

print(run_command('build/perftest/perftest', build_args(args)))

all_data = pd.DataFrame()

for version in versions:
run_command('git', ['-C','finufft', 'checkout', version])
# checkout folder perftest from master branch
run_command('git', ['-C','finufft', 'checkout', 'origin/perftests', '--', 'perftest'])
run_command('cmake', ['-S', 'finufft', '-B', 'build', '-DFINUFFT_BUILD_TESTS=ON'])
run_command('cmake', ['--build', 'build', '-j', str(os.cpu_count()), '--target', 'perftest'])
args = {'--prec': 'f',
'--n_runs': '1',
'--sort': '1',
'--N1': '320',
'--N2': '320',
'--N3': '1',
'--ntransf': '1',
'--thread': '1',
'--M': '1E6',
'--tol': '1E-5'}

out, _ = run_command('build/perftest/perftest', build_args(args))

# parse the output, escape all the lines that start with #
out = io.StringIO(out)
lines = out.readlines()
conf = [line for line in lines if line.startswith('#')]
print(*conf, sep='')
stdout = '\n'.join([line for line in lines if not line.startswith('#')])
# convert stdout to a dataframe from csv string
dt = pd.read_csv(io.StringIO(stdout), sep=',')
# add columns with version and configuration
dt['version'] = version[1:]
for key, value in args.items():
dt[key[2:]] = value
print(dt)
all_data = pd.concat((all_data, dt), ignore_index=True)
print(all_data)

if __name__ == '__main__':
pass
4 changes: 0 additions & 4 deletions perftest/perftest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct test_options_t {
int M;
int ntransf;
int kerevalmethod;
int method;
int sort;
int threads;
double tol;
Expand All @@ -52,7 +51,6 @@ struct test_options_t {
{"M", required_argument, 0, 0},
{"ntransf", required_argument, 0, 0},
{"tol", required_argument, 0, 0},
{"method", required_argument, 0, 0},
{"kerevalmethod", required_argument, 0, 0},
{"threads", required_argument, 0, 0},
{"sort", required_argument, 0, 0},
Expand Down Expand Up @@ -84,7 +82,6 @@ struct test_options_t {
N[2] = std::stof(get_or(options_map, "N3", "1"));
M = std::stof(get_or(options_map, "M", "2E6"));
ntransf = std::stoi(get_or(options_map, "ntransf", "1"));
method = std::stoi(get_or(options_map, "method", "1"));
kerevalmethod = std::stoi(get_or(options_map, "kerevalmethod", "1"));
sort = std::stoi(get_or(options_map, "sort", "1"));
threads = std::stoi(get_or(options_map, "threads", "0"));
Expand All @@ -103,7 +100,6 @@ struct test_options_t {
<< "# N3 = " << opts.N[2] << "\n"
<< "# M = " << opts.M << "\n"
<< "# ntransf = " << opts.ntransf << "\n"
<< "# method = " << opts.method << "\n"
<< "# kerevalmethod = " << opts.kerevalmethod << "\n"
<< "# sort = " << opts.sort << "\n"
<< "# threads = " << opts.threads << "\n"
Expand Down

0 comments on commit 3b3388e

Please sign in to comment.