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

Added functions for mpi support in qutensornet #53

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Vinitha-balachandran
Copy link
Contributor

No description provided.

@Vinitha-balachandran Vinitha-balachandran force-pushed the multi-node-multi-cpu-support-for-qutensornet-platform branch from 4023539 to e6be227 Compare April 18, 2024 07:38
@Vinitha-balachandran Vinitha-balachandran marked this pull request as ready for review April 24, 2024 02:51
@alecandido
Copy link
Member

Tests are missing

@Vinitha-balachandran
Copy link
Contributor Author

Tests are missing

Added pytest. Need to install pytest-mpi.

@alecandido
Copy link
Member

Added pytest. Need to install pytest-mpi.

pytest-mpi is a very little maintained project, with very minimal code.
https://github.com/aragilar/pytest-mpi/blob/master/src/pytest_mpi/__init__.py

The rather ideal situation in which it could be convenient to just vendor the part we're interested in.

What do you exactly need from pytest-mpi?

@Vinitha-balachandran
Copy link
Contributor Author

Added pytest. Need to install pytest-mpi.

pytest-mpi is a very little maintained project, with very minimal code. https://github.com/aragilar/pytest-mpi/blob/master/src/pytest_mpi/__init__.py

The rather ideal situation in which it could be convenient to just vendor the part we're interested in.

What do you exactly need from pytest-mpi?

To test mpi implementation. I thought you were referring that pytests are missing in your previous comment.

@alecandido
Copy link
Member

alecandido commented Apr 26, 2024

I thought you were referring that pytests are missing in your previous comment.

Indeed

To test mpi implementation.

I was looking for a much more specific answer. How are you planning to use the features of pytest-mpi in your test code?

@Vinitha-balachandran
Copy link
Contributor Author

Vinitha-balachandran commented Apr 26, 2024

I thought you were referring that pytests are missing in your previous comment.

Indeed

To test mpi implementation.

I was looking for a much more specific answer. How are you planning to use the features of pytest-mpi in your test code?

I was looking for how pytests can be implemented while using mpi. @liweintu suggested this pytest-mpi which I am using now. It is in test_quimb_backend.py to test the function which parallelize the circuit evaluation. As commented in the file, pytest for mpi implementation can be checked by command mpirun -n 2 python -m pytest tests/test_quimb_backend.py --with-mpi. WIthout the --with-mpi , it will skip the mpi tests.

@alecandido
Copy link
Member

alecandido commented Apr 26, 2024

As commented in the file, pytest for mpi implementation can be checked by command mpirun -n 2 python -m pytest tests/test_quimb_backend.py --with-mpi. WIthout the --with-mpi , it will skip the mpi tests.

This is a basic Pytest feature, no need of plugins to do it. You can define yourself the marker in the Pytest configs (not even needed to use executable code, just write in pyproject.toml, and Pytest will load it).

The official documentation about markers is here:
https://docs.pytest.org/en/8.1.x/how-to/mark.html
(it's pretty brief, and linking to a variety of examples with clarifications)

@Vinitha-balachandran
Copy link
Contributor Author

Vinitha-balachandran commented Apr 29, 2024

As commented in the file, pytest for mpi implementation can be checked by command mpirun -n 2 python -m pytest tests/test_quimb_backend.py --with-mpi. WIthout the --with-mpi , it will skip the mpi tests.

This is a basic Pytest feature, no need of plugins to do it. You can define yourself the marker in the Pytest configs (not even needed to use executable code, just write in pyproject.toml, and Pytest will load it).

The official documentation about markers is here: https://docs.pytest.org/en/8.1.x/how-to/mark.html (it's pretty brief, and linking to a variety of examples with clarifications)

Thanks for the suggestion. I have updated pyproject.toml to use for 2 cpus (just used minimum requirement) and tests are passing using the marker feature. Updated the files in the repo.

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.

2 participants