Skip to content

Commit 6b4e45f

Browse files
authored
JLBS_mpi_4py_tutorial (#29)
2 parents 7122efa + a26091c commit 6b4e45f

File tree

2 files changed

+403
-0
lines changed

2 files changed

+403
-0
lines changed

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,90 @@
11
# CuTonala_2024_A
22
Parallel Programming Course
3+
4+
=== Dependencies ===
5+
6+
These programs depend on mpi4py (>= Version 3.1.5)
7+
8+
The mpi4py documentation and installation instructions
9+
can be found at:
10+
11+
http://mpi4py.scipy.org/
12+
13+
=== How to run on a single (multi-core) host ===
14+
15+
Run it with
16+
17+
mpirun -np 4 ./some-program
18+
19+
where the number after "-np " is the number of parallel MPI
20+
processes to be started.
21+
22+
23+
=== How to run on multiple hosts ===
24+
25+
If you want to run the program distributed over multiple hosts,
26+
you have to create a <hostfile> which looks like:
27+
28+
-- hostfile --
29+
host1 slots=4
30+
host2 slots=4
31+
host3 slots=4
32+
--------------
33+
34+
Where "slots=" specifies the number of parallel processes that should be
35+
started on that host.
36+
37+
Run it with
38+
39+
mpirun --hostfile <hostfile> ./some-program
40+
41+
42+
=== Run on a cluster with the Torque Job scheduling system ===
43+
44+
The Torque HPC documentation and installation instructions
45+
can be found at:
46+
47+
Terascale Open-source Resource and QUEue manager (TORQUE) is a
48+
job scheduler/resource manager that employs PBS.
49+
Jobs can be run either interactively or as a submitted PVS
50+
batch script that is run non-interactively and subsequently
51+
controlled through TORQUE.
52+
53+
https://hpc-wiki.info/hpc/Torque
54+
https://docs.adaptivecomputing.com/torque/3-0-5/1.1installation.php
55+
56+
There are two possibilities:
57+
58+
a) Run interactively:
59+
60+
Request an interactive session and allocate a number of processors/nodes for
61+
your session:
62+
63+
$ qsub -I X -l nodes=4:ppn=4
64+
65+
Where "-I" means you want to work interactively, "-X" requests grapical
66+
(X-Window) I/O -- (you can run arbitrary programs that open windows). The
67+
option "-l " specifies the resources you want to allocate. "-l nodes=4:ppn=4"
68+
requests four compute nodes with each having four processor cores
69+
[ppn =^ ProcessorsPerNode]. So in total you allocate 16 CPU cores.
70+
[The scheduler is free to run your job on two nodes having 8 CPU cores each]
71+
72+
Once your interactive session is ready, you run
73+
74+
$ mpirun ./your-program
75+
76+
mpirun automatically knowns how many parallel processes have to be started and
77+
where they have to be started.
78+
79+
b) Submit as non-interactive batch-job:
80+
81+
Use
82+
83+
$ qsub -l nodes=4:ppn=4 ./your-jobfile.job
84+
85+
to submit jour job-file. Similar to the interactive case, "-l" again is used
86+
to request resources from the scheduling system. The job file usually is a
87+
simple shell script which specifies the commands to be run once your job
88+
starts. In addition, the jobfile can contain "#PBS <something>" statements
89+
which are used to specify additional options which could have been specified
90+
in the "qsub" commandline. Please see "man qsub" for details.

0 commit comments

Comments
 (0)