Skip to content
Snippets Groups Projects
Commit 07dfa7d8 authored by Dominik Krupke's avatar Dominik Krupke
Browse files

parallel for intel

parent 1505b95e
No related branches found
No related tags found
No related merge requests found
import json
import math
import os
import sys
......@@ -21,10 +22,29 @@ print_context()
print_readme(10)
result_db = "./01_results.json"
timelimit = 30 # seconds
timelimit = 10 # seconds
solvers = [ CpSolver(Integralizer(1_000_000), threads=i) for i in [1,2,4,8,16]]
def clean_long_runners(path):
if not os.path.exists(path):
return
with open(path, "r") as f:
data =list(json.load(f))
data_cleaned = []
cleaned = False
print(f"{len(data)} entries.")
for i, e in enumerate(data):
if "CPU" not in e:
if "algry" in e["hostname"].lower():
e["CPU"] = "AMD Ryzen7 5800X"
cleaned = True
else:
data_cleaned.append(e)
if cleaned:
with open(path, "w") as f:
json.dump(data_cleaned, f)
for p in os.listdir("../../instance_based_pn_msc"):
print(p)
if not p.endswith("json"):
......@@ -39,7 +59,9 @@ for p in os.listdir("../../instance_based_pn_msc"):
ub = None
for solver in solvers:
if exists(result_db, {"instance": p, "solver": solver.identifier(), "threads": solver.threads, "timelimit": timelimit}):
cpu = "Intel i7-6700K" if "algpc" in m["hostname"].lower() else None
assert cpu
if exists(result_db, {"instance": p, "solver": solver.identifier(), "threads": solver.threads, "timelimit": timelimit, "CPU": cpu}):
print("skip", p, solver.identifier())
continue
if ub is None:
......@@ -57,6 +79,7 @@ for p in os.listdir("../../instance_based_pn_msc"):
m["LB"] = bound
m["ub"] = ub
m["opt"] = opt
m["CPU"] = cpu
m["timelimit"] = timelimit
m["solution"] = to_json(sol)
m.save_seconds("runtime")
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment