Error in unit tests with v0.3.0
mbkumar opened this issue · 6 comments
I am seeing the below errors when running the units.
======================================================================
ERROR: test_communicate_micro_output (test_adaptivity_parallel.TestGlobalAdaptivity)
Test functionality to communicate micro output from active sims to their associated inactive sims, for a global adaptivity setting.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/bharatmedasani/Software/reviews/micro-manager-0.3.0/tests/unit/test_adaptivity_parallel.py", line 115, in test_communicate_micro_output
adaptivity_controller.communicate_micro_output(is_sim_active, sim_is_associated_to, sim_output)
File "/Users/bharatmedasani/miniconda3/envs/tmp38/lib/python3.8/site-packages/micro_manager/adaptivity/global_adaptivity.py", line 153, in communicate_micro_output
recv_reqs = self._p2p_comm(assoc_active_ids, micro_output)
File "/Users/bharatmedasani/miniconda3/envs/tmp38/lib/python3.8/site-packages/micro_manager/adaptivity/global_adaptivity.py", line 316, in _p2p_comm
req = self._comm.irecv(bufsize, source=recv_rank, tag=tag)
File "mpi4py/MPI/Comm.pyx", line 1502, in mpi4py.MPI.Comm.irecv
File "mpi4py/MPI/msgpickle.pxi", line 417, in mpi4py.MPI.PyMPI_irecv
mpi4py.MPI.Exception: MPI_ERR_RANK: invalid rank
======================================================================
ERROR: test_update_inactive_sims_global_adaptivity (test_adaptivity_parallel.TestGlobalAdaptivity)
Test functionality to update inactive simulations in a particular setting, for a global adaptivity setting.
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/bharatmedasani/Software/reviews/micro-manager-0.3.0/tests/unit/test_adaptivity_parallel.py", line 70, in test_update_inactive_sims_global_adaptivity
is_sim_active, sim_is_associated_to = adaptivity_controller._update_inactive_sims(
File "/Users/bharatmedasani/miniconda3/envs/tmp38/lib/python3.8/site-packages/micro_manager/adaptivity/global_adaptivity.py", line 230, in _update_inactive_sims
recv_reqs = self._p2p_comm(list(to_be_activated_map.keys()), sim_states_and_global_ids)
File "/Users/bharatmedasani/miniconda3/envs/tmp38/lib/python3.8/site-packages/micro_manager/adaptivity/global_adaptivity.py", line 316, in _p2p_comm
req = self._comm.irecv(bufsize, source=recv_rank, tag=tag)
File "mpi4py/MPI/Comm.pyx", line 1502, in mpi4py.MPI.Comm.irecv
File "mpi4py/MPI/msgpickle.pxi", line 417, in mpi4py.MPI.PyMPI_irecv
mpi4py.MPI.Exception: MPI_ERR_RANK: invalid rank
----------------------------------------------------------------------
How are you running the tests?
I am using the command python -m unittest discover -t <tests_folder> -s <tests_folder>
Should I use mpirun?
I think you should add skip conditions if the tests are supposed to run only when MPI is available
Some of the tests are for parallel functionality, so yes, they require MPI and also mpi4py to run. In the tests README, we explain how to run the tests. But you make a good point, a user should be able to run the tests in a general way from the source directory. I will look into skip conditions.
I think individually running tests in each file is difficult. Since you only have few unit tests that should be OK. Even then you can miss some tests if you forget to run tests in any particular file. For mpi test discovery, we use pattern matching. See below script
#!/bin/bash
set -ex
# In the above line, "set -x" causes this script to exit as soon as any line fails. "set -e" causes each line of this script to be printed (with a + in front) before it is executed.
cd tests
for j in {1..3}
do
mpiexec -n $j python -m unittest -k mpi
done