Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in unit tests with v0.3.0 #63

Open
mbkumar opened this issue Oct 11, 2023 · 6 comments
Open

Error in unit tests with v0.3.0 #63

mbkumar opened this issue Oct 11, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@mbkumar
Copy link

mbkumar commented Oct 11, 2023

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

----------------------------------------------------------------------
@IshaanDesai
Copy link
Member

How are you running the tests?

@IshaanDesai IshaanDesai self-assigned this Oct 11, 2023
@mbkumar
Copy link
Author

mbkumar commented Oct 11, 2023

I am using the command python -m unittest discover -t <tests_folder> -s <tests_folder>

@mbkumar
Copy link
Author

mbkumar commented Oct 11, 2023

Should I use mpirun?

@mbkumar
Copy link
Author

mbkumar commented Oct 11, 2023

I think you should add skip conditions if the tests are supposed to run only when MPI is available

@IshaanDesai
Copy link
Member

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.

@mbkumar
Copy link
Author

mbkumar commented Oct 11, 2023

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

@IshaanDesai IshaanDesai added the bug Something isn't working label Nov 7, 2023
@IshaanDesai IshaanDesai changed the title Error in unit tests with v0.3 Error in unit tests with v0.3.0 Jan 31, 2024
@IshaanDesai IshaanDesai added this to the v0.4.0 milestone Jan 31, 2024
@IshaanDesai IshaanDesai removed this from the v0.4.0 milestone Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants