Commit f31cb212 authored by Nicolas Winkler's avatar Nicolas Winkler
Browse files

Merge branch 'euler/bench' of https://gitlab.ethz.ch/umarka/dphpc_project into euler/bench

parents c688d9cc b54e5dea
......@@ -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 """
......@@ -27,7 +25,7 @@ def compile_all(base_build_dir: str, kokkos_dir: str):
build_cmd = config['build-cmd'].format(kokkos_dir)
print("======================== {} ========================".format(
build_dir), flush=True)
if subprocess.call("cd {}; {}".format(build_dir, build_cmd), shell=True) == -1:
if subprocess.call("mkdir {}; cd {}; {}".format(build_dir, build_dir, build_cmd), shell=True) == -1:
exit(-1)
print("", flush=True)
......@@ -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": 20
},
{
"build-dir": "MPI_kokkos/build",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./deriche_bench.o {1} {2} {3}",
"num-runs": 20
}
],
"run-configs-single-node": [
{
"build-dir": "sequential",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "omp",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "kokkos/build",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
}
],
"bench-configs-single-node": [],
"bench-configs-multi-node": [
{
"num-nodes": 2,
"num-threads": 4
},
{
"num-nodes": 4,
"num-threads": 4
},
{
"num-nodes": 8,
"num-threads": 4
},
{
"num-nodes": 12,
"num-threads": 4
},
{
"num-nodes": 16,
"num-threads": 4
},
{
"num-nodes": 24,
"num-threads": 4
},
{
"num-nodes": 32,
"num-threads": 4
}
],
"size-configs": [
{
"w": 1024,
"h": 1024
},
{
"w": 2048,
"h": 2048
},
{
"w": 4096,
"h": 4096
},
{
"w": 6144,
"h": 6144
},
{
"w": 8192,
"h": 8192
},
{
"w": 12288,
"h": 12288
}
]
}
\ No newline at end of file
{
"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": 20
},
{
"build-dir": "MPI_kokkos/build",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./deriche_bench.o {1} {2} {3}",
"num-runs": 20
}
],
"run-configs-single-node": [
{
"build-dir": "sequential",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "omp",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "kokkos/build",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
}
],
"bench-configs-single-node": [],
"bench-configs-multi-node": [
{
"num-nodes": 2,
"num-threads": 4
},
{
"num-nodes": 4,
"num-threads": 4
},
{
"num-nodes": 8,
"num-threads": 4
},
{
"num-nodes": 12,
"num-threads": 4
},
{
"num-nodes": 16,
"num-threads": 4
},
{
"num-nodes": 24,
"num-threads": 4
},
{
"num-nodes": 32,
"num-threads": 4
}
],
"size-configs": [
{
"w": 1024,
"h": 1024
},
{
"w": 2048,
"h": 2048
},
{
"w": 4096,
"h": 4096
},
{
"w": 6144,
"h": 6144
},
{
"w": 8192,
"h": 8192
},
{
"w": 12288,
"h": 12288
}
]
}
\ No newline at end of file
{
"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": 20
},
{
"build-dir": "MPI_kokkos/build",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./deriche_bench.o {1} {2} {3}",
"num-runs": 20
}
],
"run-configs-single-node": [
{
"build-dir": "sequential",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "omp",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "kokkos/build",
"run-cmd": "./deriche_bench.o {0} {1} {2}",
"num-runs": 20
}
],
"bench-configs-single-node": [
2,
4,
8,
12,
16,
24,
32
],
"bench-configs-multi-node": [],
"size-configs": [
{
"w": 1024,
"h": 1024
},
{
"w": 2048,
"h": 2048
},
{
"w": 4096,
"h": 4096
},
{
"w": 6144,
"h": 6144
},
{
"w": 8192,
"h": 8192
},
{
"w": 12288,
"h": 12288
}
]
}
\ 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");
}
......
......@@ -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 = 20
def compile_all(base_build_dir: str, kokkos_dir: str):
""" build all experiments """
......@@ -27,7 +25,7 @@ def compile_all(base_build_dir: str, kokkos_dir: str):
build_cmd = config["build-cmd"].format(kokkos_dir)
print("======================== {} ========================".format(
build_dir), flush=True)
if subprocess.call("cd {}; {}".format(build_dir, build_cmd), shell=True) == -1:
if subprocess.call("mkdir {}; cd {}; {}".format(build_dir, build_dir, build_cmd), shell=True) == -1:
exit(-1)
print("", flush=True)
......@@ -42,14 +40,17 @@ def run_all_single_node(base_build_dir: str):
# for config in config_data["size-configs"] if config['matrix-size'] < 4096])
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"]:
print("Setting number of threads to {}".format(
num_threads), flush=True)
os.environ["OMP_NUM_THREADS"] = str(num_threads)
# resolve placeholders
run_cmd = run_config["run-cmd"].format(num_threads,
NUM_RUNS, size_configs)
num_runs, size_configs)
if "kokkos" in build_dir:
run_cmd = run_cmd + "--kokkos-threads=" + str(num_threads)
subprocess.call("cd {}; {}".format(build_dir, run_cmd), shell=True)
......@@ -64,6 +65,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"]:
......@@ -73,7 +75,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)
......
......@@ -4,91 +4,90 @@
"build-dir": "lu_omp",
"build-cmd": "make -j4 lu_bench"
},
{
"build-dir": "lu_sequential",
"build-cmd": "make -j4 lu_bench"
},
{
"build-dir": "lu_mpi_omp",
"build-cmd": "make -j4 lu_bench"
},
{
"build-dir": "lu_mpi_kokkos/build",
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON; make -j4"
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release; make -j4"
},
{
"build-dir": "lu_kokkos/build",
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON; make -j4"
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release; make -j4"
},
{
"build-dir": "lu_kokkos_dag/build",
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON; make -j4"
"build-cmd": "cmake ../. -DKOKKOS_DIR={0} -DCMAKE_BUILD_TYPE=Release; make -j4"
}
],
"run-configs-multi-node": [
{
"build-dir": "lu_mpi_omp",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./lu_bench.o {1} {2} {3}"
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./lu_bench.o {1} {2} {3}",
"num-runs": 20
},
{
"build-dir": "lu_mpi_kokkos/build",
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./lu_bench.o {1} {2} {3}"
"run-cmd": "mpirun -n {0} --map-by node:PE=1 ./lu_bench.o {1} {2} {3}",
"num-runs": 20
}
],
"run-configs-single-node": [
{
"build-dir": "lu_omp",
"run-cmd": "./lu_bench.o {0} {1} {2}"
"run-cmd": "./lu_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "lu_kokkos/build",
"run-cmd": "./lu_bench.o {0} {1} {2}"
"run-cmd": "./lu_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "lu_kokkos_dag/build",
"run-cmd": "./lu_bench.o {0} {1} {2}"
"run-cmd": "./lu_bench.o {0} {1} {2}",
"num-runs": 20
},
{
"build-dir": "lu_sequential",
"run-cmd": "./lu_bench.o {0} {1} {2}",
"num-runs": 3
}
],
"bench-configs-single-node": [
1,
2,
4,
8,
16
16,
32
],
"bench-configs-multi-node": [
{
"num-nodes": 1,
"num-threads": 4
},
{
"num-nodes": 2,
"num-threads": 4
},
{
"num-nodes": 4,
"num-threads": 4
},
"bench-configs-multi-node": [],
"size-configs": [
{
"num-nodes": 8,
"num-threads": 4
"matrix-size": 1024,
"block-size": 4
},
{
"num-nodes": 16,
"num-threads": 4
}
],
"size-configs": [
{
"matrix-size": 256,
"block-size": 128
"matrix-size": 2048,
"block-size": 4
},
{
"matrix-size": 512,
"block-size": 128
"matrix-size": 4096,
"block-size": 4
},
{
"matrix-size": 1024,
"block-size": 128
"matrix-size": 6144,
"block-size": 4
},
{
"matrix-size": 4096,
"block-size": 128
"matrix-size": 8192,
"block-size": 4
}
]
}
}
\ No newline at end of file