Skip to content

Added functions for mpi support in qutensornet - #53

Open
Vinitha-balachandran wants to merge 7 commits into
mainfrom
multi-node-multi-cpu-support-for-qutensornet-platform
Open

Added functions for mpi support in qutensornet#53
Vinitha-balachandran wants to merge 7 commits into
mainfrom
multi-node-multi-cpu-support-for-qutensornet-platform

Conversation

@Vinitha-balachandran

Copy link
Copy Markdown
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
Copy Markdown
Member

Tests are missing

@Vinitha-balachandran

Copy link
Copy Markdown
Contributor Author

Tests are missing

Added pytest. Need to install pytest-mpi.

@alecandido

Copy link
Copy Markdown
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
Copy Markdown
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

alecandido commented Apr 26, 2024

Copy link
Copy Markdown
Member

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

Vinitha-balachandran commented Apr 26, 2024

Copy link
Copy Markdown
Contributor Author

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

alecandido commented Apr 26, 2024

Copy link
Copy Markdown
Member

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

Vinitha-balachandran commented Apr 29, 2024

Copy link
Copy Markdown
Contributor Author

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