Skip to content
Snippets Groups Projects
Commit aa9128da authored by Alexis GAMELIN's avatar Alexis GAMELIN
Browse files

Fix monitor flush.

Only print version information for one process.
parent 05bd1af9
No related branches found
No related tags found
2 merge requests!280.8.0,!23Fix monitor flush
......@@ -32,6 +32,8 @@ except:
dirty = False
def print_version():
print(("mbtrack2 version " + __version__))
if dirty:
print("(dirty git work tree)")
......@@ -46,3 +48,13 @@ print(
"[2] A. Gamelin, W. Foosang, and R. Nagaoka, “mbtrack2, a Collective Effect Library in Python”, presented at the 12th Int. Particle Accelerator Conf. (IPAC'21), Campinas, Brazil, May 2021, paper MOPAB070."
)
print("\n")
try:
from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
if rank == 0:
print_version()
except:
print_version()
......@@ -197,7 +197,6 @@ class Monitor(Element, metaclass=ABCMeta):
self.file[
self.group_name][key][slice_tuple] = self.__getattribute__(key)
self.file.flush()
self.write_count += 1
def to_buffer(self, object_to_save):
......@@ -944,7 +943,6 @@ class WakePotentialMonitor(Monitor):
self.buffer_size] = self.__getattribute__("dipole_" +
dim)
self.file.flush()
self.write_count += 1
def track(self, object_to_save, wake_potential_to_save):
......@@ -1304,7 +1302,6 @@ class BunchSpectrumMonitor(Monitor):
self.buffer_size:(self.write_count + 1) *
self.buffer_size] = self.coherent_o
self.file.flush()
self.write_count += 1
def get_incoherent_spectrum(self, positions):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment