forked from giadarol/PyParaSlice
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathutil.py
More file actions
34 lines (24 loc) · 874 Bytes
/
util.py
File metadata and controls
34 lines (24 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from .ring_of_CPUs import RingOfCPUs
class DummyComm(object):
def __init__(self, N_cores_pretend, pretend_proc_id):
self.N_cores_pretend = N_cores_pretend
self.pretend_proc_id = pretend_proc_id
def Get_size(self):
return self.N_cores_pretend
def Get_rank(self):
return self.pretend_proc_id
def Barrier(self):
pass
def get_sim_instance(sim_content, N_cores_pretend,
id_pretend, init_sim_objects_auto=True):
myCPUring = RingOfCPUs(
sim_content,
comm=DummyComm(N_cores_pretend, id_pretend),
init_sim_objects_auto=init_sim_objects_auto,
)
return myCPUring.sim_content
def get_serial_CPUring(sim_content, init_sim_objects_auto=True):
myCPUring = RingOfCPUs(
sim_content, force_serial=True, init_sim_objects_auto=init_sim_objects_auto
)
return myCPUring