Skip to content

Commit 597e7a5

Browse files
author
Taina Coleman
committed
Adds core assignment to processes
1 parent eec964d commit 597e7a5

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

wfcommons/wfperf/data_gen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def generate_sys_data(num_files: int, file_total_size: int, test_mode: str = "se
1313
f"--file-total-size={file_total_size}G",
1414
f"--file-test-mode={test_mode}"
1515
]
16+
print(" ".join(["sysbench","fileio", *params,"prepare"]))
1617
proc = subprocess.Popen(["sysbench","fileio", *params,"prepare"], stdout=subprocess.PIPE)
1718
proc.wait()
1819
out, _ = proc.communicate()

wfcommons/wfperf/perf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def create(self,
8585

8686
if verbose:
8787
print("Generating system files.")
88-
generate_sys_data(num_sys_files, data_footprint)
88+
generate_sys_data(num_sys_files, file_size)
8989

9090

9191
with open(f'{save_dir.joinpath(workflow.name)}.json', 'w') as fp:

wfcommons/wfperf/wfperf_benchmark.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,35 @@ def main():
4343
proc = subprocess.Popen(["sysbench", "fileio", *sysbench_file_input_args, "cleanup"], stdout=fp, stderr=fp)
4444
proc.wait()
4545

46-
with save_dir.joinpath(f"{name}_cpu.txt").open("w+") as fp_cpu, save_dir.joinpath(f"{name}_memory.txt").open("w+") as fp_mem:
46+
with save_dir.joinpath(f"{name}_cpu.txt").open("w+") as fp_cpu, save_dir.joinpath(f"{name}_memory.txt").open("w+") as fp_mem, save_dir.joinpath(f"{name}_ps_log.txt").open("w+") as fp_ps:
4747
num_cores = os.cpu_count()
4848
cpu_threads = int(args.percent_cpu*10)
4949
mem_threads = int(10 - cpu_threads)
5050

5151
print(cpu_threads, mem_threads)
5252

53-
for _ in range(num_cores):
53+
for i in range(num_cores):
5454
print("Starting CPU benchmark...")
55-
sysbench_cpu_args = [arg for arg in other if arg.startswith("--cpu")] + [f"--threads={cpu_threads}"]
55+
sysbench_cpu_args = [arg for arg in other if arg.startswith("--cpu")] + [f"--time={args.time}", f"--threads={cpu_threads}"]
5656
proc_cpu = subprocess.Popen(
5757
[
58-
"time", "timeout", f"{args.time}s", "sysbench", "cpu",
58+
"sysbench", "cpu", "--forced-shutdown=0", #time", "timeout", f"{args.time}s",
5959
*sysbench_cpu_args, "run"
6060
],
6161
stdout=fp_cpu, stderr=fp_cpu
6262
)
63+
os.sched_setaffinity(proc_cpu.pid, {i})
6364

6465
print("Starting Memory benchmark...")
6566
sysbench_mem_args = [arg for arg in other if arg.startswith("--memory")] + [f"--time={args.time}", f"--threads={mem_threads}"]
6667
proc_mem = subprocess.Popen(
67-
["time", "sysbench", "memory", "run",*sysbench_mem_args],
68+
["sysbench", "memory", "run",*sysbench_mem_args], #"time",
6869
stdout=fp_mem, stderr=fp_mem
6970
)
70-
71+
os.sched_setaffinity(proc_mem.pid, {i})
72+
73+
proc = subprocess.Popen(["ps", "-o","pid,psr,comm,thcount"], stdout=fp_ps)
74+
proc.wait()
7175
proc_cpu.wait()
7276
proc_mem.wait()
7377

0 commit comments

Comments
 (0)