Commit 2f91ea96 authored by lmeinen's avatar lmeinen
Browse files

finished setup sequential deriche

parent f405f03d
......@@ -14,8 +14,6 @@ CONFIG_NAME = "compile_run_config.json"
# set placeholder to projname
RESULTS_NAME = "{0}(_r[0-9]+)?-result-[0-9]+.txt"
NUM_RUNS = 2
def compile_all(base_build_dir: str, kokkos_dir: str):
""" build all experiments """
......@@ -40,6 +38,7 @@ def run_all_single_node(base_build_dir: str):
for config in config_data['size-configs']])
for run_config in config_data['run-configs-single-node']:
build_dir = os.path.join(base_build_dir, run_config['build-dir'])
num_runs = run_config["num-runs"]
print(
"======================== {} ========================".format(build_dir))
for num_threads in config_data['bench-configs-single-node']:
......@@ -47,7 +46,7 @@ def run_all_single_node(base_build_dir: str):
num_threads), flush=True)
# resolve placeholders
run_cmd = run_config['run-cmd'].format(num_threads,
NUM_RUNS, size_configs)
num_runs, size_configs)
subprocess.call("cd {}; {}".format(build_dir, run_cmd), shell=True)
print("")
......@@ -60,6 +59,7 @@ def run_all_multi_node(base_build_dir: str):
for config in config_data['size-configs']])
for run_config in config_data['run-configs-multi-node']:
build_dir = os.path.join(base_build_dir, run_config['build-dir'])
num_runs = run_config["num-runs"]
print(
"======================== {} ========================".format(build_dir), flush=True)
for bench_config in config_data['bench-configs-multi-node']:
......@@ -69,7 +69,7 @@ def run_all_multi_node(base_build_dir: str):
num_nodes, num_threads), flush=True)
# resolve placeholders
run_cmd = run_config['run-cmd'].format(num_nodes,
num_threads, NUM_RUNS, size_configs)
num_threads, num_runs, size_configs)
subprocess.call("cd {}; {}".format(build_dir, run_cmd), shell=True)
print("", flush=True)
......
{
"build-configs": [
{
"build-dir": "sequential",
"build-cmd": "make -j4 deriche_bench"
},
{
"build-dir": "omp",
"build-cmd": "make -j4 deriche_bench"
},
{
"build-dir": "MPI_omp",
"build-cmd": "make -j4 deriche_bench"
},
{
"build-dir": "MPI_kokkos/build",
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release; make -j4"
},
{
"build-dir": "kokkos/build",
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release; make -j4"
}
],
"run-configs-multi-node": [
{
"build-dir": "MPI_omp",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./deriche_bench.o {1} {2} {3}",
"num-runs": 3
},
{
"build-dir": "MPI_kokkos/build",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./deriche_bench.o {1} {2} {3}",
"num-runs": 3
}
],
"run-configs-single-node": [
{
"build-dir": "sequential",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 3
},
{
"build-dir": "omp",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 3
},
{
"build-dir": "kokkos/build",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 3
}
],
"bench-configs-single-node": [
2,
4
],
"bench-configs-multi-node": [
],
"size-configs": [
{
"w": 1000,
"h": 1000
}
]
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
#include "bench_util.h"
/// Benchmark for sequential implementation
int bench_omp(int run_id, BenchUtil &bench, int num_runs, int w, int h)
int bench_seq(int run_id, BenchUtil &bench, int num_runs, int w, int h, int num_threads)
{
for (int i = 0; i < num_runs; i++)
......@@ -26,6 +26,7 @@ int bench_omp(int run_id, BenchUtil &bench, int num_runs, int w, int h)
init_array(w, h, &alpha, imgIn, imgOut);
bench.bench_param(run_id, "type", "Sequential");
bench.bench_param(run_id, "num_threads", std::to_string(num_threads));
bench.bench_param(run_id, "run", std::to_string(i));
bench.bench_param(run_id, "w", std::to_string(w));
bench.bench_param(run_id, "h", std::to_string(h));
......@@ -47,24 +48,26 @@ int bench_omp(int run_id, BenchUtil &bench, int num_runs, int w, int h)
return run_id;
}
/// call as: ./deriche_bench.o num_runs w_0 h_0 w_1 h_1 ...
/// call as: ./deriche_bench.o num_threads num_runs w_0 h_0 w_1 h_1 ...
int main(int argc, char **argv)
{
// init
BenchUtil bench("sequential");
if (argc < 2 || argc % 2 != 0)
if (argc < 3 || argc % 2 != 1)
{
printf("incorrect number of args\n");
printf("call as: ./deriche_bench.o num_runs w_0 h_0 w_1 h_1 ...\n");
printf("call as: ./deriche_bench.o num_threads num_runs w_0 h_0 w_1 h_1 ...\n");
return -1;
}
int num_runs = stoi(argv[1]);
int num_threads = stoi(argv[1]);
int num_runs = stoi(argv[2]);
int configs[(argc - 2) / 2][2];
for (int i = 2, j = 0; i < argc; i += 2, j++)
for (int i = 3, j = 0; i < argc; i += 2, j++)
{
configs[j][0] = stoi(argv[i]);
configs[j][1] = stoi(argv[i + 1]);
......@@ -77,7 +80,7 @@ int main(int argc, char **argv)
{
printf("Running measurements for img size %d x %d", config[0], config[1]);
fflush(stdout);
run_id = bench_omp(run_id, bench, num_runs, config[0], config[1]);
run_id = bench_seq(run_id, bench, num_runs, config[0], config[1], num_threads);
printf("done\n");
}
......
Supports Markdown
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