MPI4py: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 42: Line 42:


<!--T:8-->
<!--T:8-->
1. Deactivate any Python virtual environment:
1. Deactivate any Python virtual environment.
{{Command|test $VIRTUAL_ENV && deactivate}}
{{Command|test $VIRTUAL_ENV && deactivate}}


Line 49: Line 49:


<!--T:10-->
<!--T:10-->
2. Load the module:
2. Load the module.
{{Command|module load mpi4py/4.0.0 python/3.12}}
{{Command|module load mpi4py/4.0.0 python/3.12}}


<!--T:11-->
<!--T:11-->
3. Check that it is visible by <code>pip</code>:
3. Check that it is visible by <code>pip</code>
{{Command
{{Command
|pip list {{!}} grep mpi4py
|pip list {{!}} grep mpi4py
Line 59: Line 59:
mpi4py            4.0.0
mpi4py            4.0.0
}}
}}
and is accessible for your currently loaded python module:
and is accessible for your currently loaded python module.
{{Command|python -c 'import mpi4py'}}
{{Command|python -c 'import mpi4py'}}
If no errors are raised, then everything is OK!
If no errors are raised, then everything is OK!
Line 73: Line 73:


== CPU == <!--T:14-->
== CPU == <!--T:14-->
1. Write your python code, for instance, broadcasting a numpy array:
1. Write your python code, for instance, broadcasting a numpy array.
{{File
{{File
|name="mpi4py-np-bc.py"
|name="mpi4py-np-bc.py"
rsnt_translations
58,180

edits

Navigation menu