cpu_count
This commit is contained in:
parent
031a938252
commit
d9ed386767
@ -147,7 +147,7 @@ def simulate_craw_and_calendar(thread, nSimulations):
|
|||||||
|
|
||||||
ttt = time.time()
|
ttt = time.time()
|
||||||
|
|
||||||
if i%1000==0:
|
if i%100==0:
|
||||||
with open(f"{logfile}.log", "a") as f:
|
with open(f"{logfile}.log", "a") as f:
|
||||||
f.write(f"{thread}: {i} after {datetime.now()-now}\n")
|
f.write(f"{thread}: {i} after {datetime.now()-now}\n")
|
||||||
f.write(f"\tmbus_time: {mbus_time}\n")
|
f.write(f"\tmbus_time: {mbus_time}\n")
|
||||||
@ -356,13 +356,12 @@ def simulate_craw_and_calendar(thread, nSimulations):
|
|||||||
|
|
||||||
|
|
||||||
n = sys.maxsize
|
n = sys.maxsize
|
||||||
# n = 2500
|
# n = 1000
|
||||||
|
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
result = {}
|
result = {}
|
||||||
answer = {}
|
answer = {}
|
||||||
threads = cpu_count()
|
threads = cpu_count()//2
|
||||||
threads -= 2
|
|
||||||
|
|
||||||
for cpu in range(threads):
|
for cpu in range(threads):
|
||||||
result[cpu] = pool.apply_async(simulate_craw_and_calendar, args=(f'thread_{cpu}', n,))
|
result[cpu] = pool.apply_async(simulate_craw_and_calendar, args=(f'thread_{cpu}', n,))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user