Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@robjmcgibbon
Copy link
Collaborator

This PR contains a couple of test fixes for #53 and #57. I've also added a script that will run all the tests, since some need to be run with mpi instead of with pytest.

#57 was an MPI error. I've added a fix, but I'm not sure what was causing the problem. The error is only thrown when I run io_test.py, I'm not able to trigger it when I actually run SOAP. If I multiply the array by 1 the error doesn't occur. Inserting the following code in shared_mesh.py

a = pos_min_local.value * 1
b = pos_min_local.value
print('Array equal:', np.array_equal(a, b))
print('Array dtypes:', a.dtype, b.dtype)
print(a.flags, '\n', b.flags)
c = np.empty_like(a)
try:
    comm.Allreduce(b, c, op=MPI.MIN)
except KeyError:
    traceback.print_exc()
    comm.Allreduce(a, c, op=MPI.MIN)
    print('a was reduced, b was not')

gives the following output:

Array equal: True
Array dtypes: float64 float64
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False
 
   C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : True
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False

Traceback (most recent call last):
  File "/cosma/home/dp004/dc-mcgi1/clean/SOAP/shared_mesh.py", line 53, in __init__
    comm.Allreduce(b, c, op=MPI.MIN)
  File "mpi4py/MPI/Comm.pyx", line 876, in mpi4py.MPI.Comm.Allreduce
  File "mpi4py/MPI/msgbuffer.pxi", line 754, in mpi4py.MPI._p_msg_cco.for_allreduce
  File "mpi4py/MPI/msgbuffer.pxi", line 692, in mpi4py.MPI._p_msg_cco.for_cro_send
  File "mpi4py/MPI/msgbuffer.pxi", line 203, in mpi4py.MPI.message_simple
  File "mpi4py/MPI/msgbuffer.pxi", line 145, in mpi4py.MPI.message_basic
KeyError: '<d'
a was reduced, b was not

@robjmcgibbon robjmcgibbon requested a review from jchelly January 3, 2024 15:38
@robjmcgibbon robjmcgibbon self-assigned this Jan 3, 2024
This was linked to issues Jan 3, 2024
@robjmcgibbon robjmcgibbon merged commit 8256fa8 into master Jan 10, 2024
@robjmcgibbon robjmcgibbon deleted the test_fixes branch January 10, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug in io_test.py Bug in SO_properties.py

2 participants