Skip to content

Commit 9af66f4

Browse files
committed
Removed double mpi4py import and introduced logfile
1 parent 9f56654 commit 9af66f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ring_of_CPUs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from mpi4py import MPI
2-
31
import numpy as np
42

53
import communication_helpers as ch
@@ -72,6 +70,9 @@ def __init__(self, sim_content, N_pieces_per_transfer=1, single_CPU_mode = False
7270

7371
def run(self):
7472
if self.I_am_the_master:
73+
with open('logfile.txt', 'a+') as fid:
74+
import socket
75+
fid.writelines(['Running on %s\n'%socket.gethostname()])
7576
import time
7677
t_last_turn = time.mktime(time.localtime())
7778
while True: #(it will be stopped with a break)
@@ -115,6 +116,8 @@ def run(self):
115116

116117
t_now = time.mktime(time.localtime())
117118
print 'Turn %d, %d s'%(self.i_turn,t_now-t_last_turn)
119+
with open('logfile.txt', 'a+') as fid:
120+
fid.writelines(['Turn %d, %d s\n'%(self.i_turn,t_now-t_last_turn)])
118121
t_last_turn = t_now
119122

120123
# prepare next turn

0 commit comments

Comments
 (0)