-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Can I run separate mvp solver instances in different threads simultaneously? I tried using python's multiprocessing module for this. Every time I keep the number of processes/threads as 1, it works as expected but when I increase the number of threads, I get this error:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpp105vrd2/1.tmp'
Here's the code for reference:
from pyvpsolver import VPSolver, MVP
def func(i):
instance = MVP.from_file('demo.mvp')
out, solution = VPSolver.script(
"vpsolver_gurobi.sh", instance, verbose=False, options="Threads=12"
)
print(solution)
from multiprocessing import Pool
def run_parallel():
list_ranges = [i for i in range(2)]
pool = Pool(processes=len(list_ranges))
pool.map(func, list_ranges)
if __name__ == '__main__':
run_parallel()
MVP file (demo.mvp)
4
5
8 4 50 10 1 1
16 8 50 20 1 1
32 16 100 50 1 1
64 32 128 50 1 1
128 64 130 100 1 1
5
1 1
2 2 25 5
1 1
6 8 40 5
1 1
10 16 40 20
1 1
10 16 120 50
1 1
15 12 90 50
Metadata
Metadata
Assignees
Labels
No labels