Skip to content

Commit

Permalink
parallel run, 2 clients 2 servers
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-marqh authored May 22, 2024
1 parent dd49dcc commit 65ca0fd
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions xios_examples/write_domain_parallel/test_write_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ def test_parallel_write(self):
# run the compiled Fortran XIOS programme
with open('{}/xios.xml'.format(self.test_dir)) as cxml:
print(cxml.read(), flush=True)
self.run_mpi_xios()
self.run_mpi_xios(nclients=2, nservers=2)
outputfile_1 = self.transient_outputs[0]

# Check the expected output file exists
runfile_1 = '{}/{}'.format(self.test_dir, outputfile_1)
assert(os.path.exists(runfile_1))
self.assertTrue(os.path.exists(runfile_1))

# Checks for output file

rootgrp = netCDF4.Dataset(runfile_1, 'r')
file_1_data = rootgrp['global_field_1']

# Check file has 10 times
assert(file_1_data.shape[0] == 10)
self.assertTrue(file_1_data.shape[0] == 10)
# Check average value of file for level 1, time 1
expected = 2.8
result = np.average(file_1_data[-1,0,:])
Expand All @@ -45,10 +45,6 @@ def test_parallel_write(self):
'differs from the actual result\n {res} \n '
'with diff \n {diff}\n')
msg = msg.format(exp=expected, res=result, diff=diff)
if not np.allclose(result, expected, rtol=self.rtol):
# print message for fail case,
# as expected failures do not report msg.
print(msg)
self.assertTrue(np.allclose(result, expected, rtol=self.rtol), msg=msg)


Expand Down

0 comments on commit 65ca0fd

Please sign in to comment.