@@ -10,14 +10,23 @@ def print2logandstdo(message, mode='a+'):
1010
1111
1212class RingOfCPUs (object ):
13- def __init__ (self , sim_content , N_pieces_per_transfer = 1 , force_serial = False , comm = None ):
13+ def __init__ (self , sim_content , N_pieces_per_transfer = 1 , force_serial = False , comm = None ,
14+ N_buffer_float_size = 1000000 , N_buffer_int_size = 100 ):
1415
1516 self .sim_content = sim_content
1617 self .N_turns = sim_content .N_turns
1718 self .N_pieces_per_transfer = N_pieces_per_transfer
19+ self .N_buffer_float_size = N_buffer_float_size
20+ self .N_buffer_int_size = N_buffer_int_size
1821
1922 if hasattr (sim_content , 'N_pieces_per_transfer' ):
2023 self .N_pieces_per_transfer = sim_content .N_pieces_per_transfer
24+
25+ if hasattr (sim_content , 'N_buffer_float_size' ):
26+ self .N_buffer_float_size = sim_content .N_buffer_float_size
27+
28+ if hasattr (sim_content , 'N_buffer_int_size' ):
29+ self .N_buffer_int_size = sim_content .N_buffer_int_size
2130
2231
2332 self .sim_content .ring_of_CPUs = self
@@ -48,9 +57,9 @@ def __init__(self, sim_content, N_pieces_per_transfer=1, force_serial = False, c
4857 self .I_am_the_master = not (self .I_am_a_worker )
4958
5059 # allocate buffers for communication
51- self . N_buffer_float_size = 1000000
60+
5261 self .buf_float = np .array (self .N_buffer_float_size * [0. ])
53- self . N_buffer_int_size = 100
62+
5463 self .buf_int = np .array (self .N_buffer_int_size * [0 ])
5564
5665 self .sim_content .init_all ()
@@ -60,6 +69,8 @@ def __init__(self, sim_content, N_pieces_per_transfer=1, force_serial = False, c
6069 print2logandstdo (comm_info )
6170 print2logandstdo ('N_cores = %d' % self .N_nodes )
6271 print2logandstdo ('N_pieces_per_transfer = %d' % self .N_pieces_per_transfer )
72+ print2logandstdo ('N_buffer_float_size = %d' % self .N_buffer_float_size )
73+ print2logandstdo ('N_buffer_int_size = %d' % self .N_buffer_int_size )
6374 import socket
6475 import sys
6576 print2logandstdo ('Running on %s' % socket .gethostname ())
0 commit comments