File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # PBS -j oe
3
+ # PBS -l nodes=4:ppn=2
4
+ # PBS -l walltime=1:00:00
5
+
6
+ cd $PBS_O_WORKDIR
7
+
8
+ # Run 20 serial jobs, 8 at a time (using 8 processors)
9
+
10
+ # define the total number of jobs here
11
+ num_serial_jobs=20
12
+ num_procs=$( cat $PBS_NODEFILE | wc -l)
13
+ count=0
14
+
15
+ while [ $count -lt $num_serial_jobs ]
16
+ do
17
+ rank_base=$count
18
+ count=` expr $count + $num_procs `
19
+ remain=` expr $num_serial_jobs - $count `
20
+ if [ $remain -lt 0 ]; then
21
+ run_count=` expr $num_serial_jobs % $num_procs `
22
+ else
23
+ run_count=$num_procs
24
+ fi
25
+ mpirun -np $run_count ./wrapper.sh $rank_base
26
+ done
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # PBS -j oe
3
+ # PBS -l nodes=2:ppn=4
4
+ # PBS -l walltime=1:00:00
5
+
6
+ cd $PBS_O_WORKDIR
7
+ num_procs=$( cat $PBS_NODEFILE | wc -l)
8
+
9
+ # run the mpi process with total number of 8 processes ( 2 x 8 )
10
+ # 'wrapper.sh' is the wrapper script for instructing mpi how to
11
+ # execute the program in batch
12
+ # '0' is the command line input that can be arbitrarily defined
13
+ mpirun -np $num_procs wrapper.sh 0
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # this the shell script for wrapping your program
3
+
4
+ # 'rank' is taken from the MPI environment variable
5
+ # for the 'multi-jobs' case, it also needs the command line argument $1
6
+ rank=` expr ${OMPI_COMM_WORLD_RANK} + $1 `
7
+
8
+ # define your commands here
9
+ echo " hello, this is processor ${rank} !" > output_${rank} .out
You can’t perform that action at this time.
0 commit comments