unite_python_mpi_4_py
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| unite_python_mpi_4_py [2026/04/10 13:37] – nshegunov | unite_python_mpi_4_py [2026/04/10 13:49] (current) – nshegunov | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== MPI4py Ping-Pong Example for Cluster ==== | + | ====== MPI4py Ping-Pong Example for Cluster |
| This example shows a NumPy-based ping-pong benchmark using the '' | This example shows a NumPy-based ping-pong benchmark using the '' | ||
| + | |||
| + | ===== Instructions ===== | ||
| + | |||
| + | To run this example, create the Python script and Slurm batch script provided below. | ||
| + | |||
| + | The Python script uses the mpi4py library to measure MPI communication performance with the classic ping-pong benchmark. The Slurm script loads the required modules and submits the job across 2 nodes. | ||
| + | |||
| + | Optional interactive testing: | ||
| + | <code bash> | ||
| + | srun --partition=short --ntasks=2 --gres=gpu: | ||
| + | </ | ||
| + | |||
| + | Use this command to request an interactive session on a single node for experimentation. | ||
| === Python Script (pingpong_mpi4py.py) ==== | === Python Script (pingpong_mpi4py.py) ==== | ||
| Line 80: | Line 93: | ||
| mpirun -np $SLURM_NTASKS python3 ./ | mpirun -np $SLURM_NTASKS python3 ./ | ||
| </ | </ | ||
| + | |||
| + | ===== Run ===== | ||
| + | |||
| + | <code bash> | ||
| + | sbatch slurm_pingpong.job | ||
| + | </ | ||
| + | |||
| + | ===== Example output ===== | ||
| + | |||
| + | <code bash> | ||
| + | Loading unite/ | ||
| + | Loading requirement: | ||
| + | |||
| + | size= 1 bytes | RTT= 10.08 us | latency= | ||
| + | size= 8 bytes | RTT= 3.80 us | latency= | ||
| + | size= 64 bytes | RTT= 4.49 us | latency= | ||
| + | size= 512 bytes | RTT= 27.33 us | latency= | ||
| + | size= 1024 bytes | RTT= 6.46 us | latency= | ||
| + | size= 4096 bytes | RTT= 8.90 us | latency= | ||
| + | size= 16384 bytes | RTT= 15.53 us | latency= | ||
| + | size= 65536 bytes | RTT= 29.86 us | latency= | ||
| + | size= 262144 bytes | RTT= 72.79 us | latency= | ||
| + | Ping-pong benchmark completed. | ||
| + | |||
| + | </ | ||
| + | |||
unite_python_mpi_4_py.1775817435.txt.gz · Last modified: 2026/04/10 13:37 by nshegunov
