Skip to content

Commit 3af59aa

Browse files
authored
Merge pull request #1 from monaghaa/march_19_2024
March 19 2024
2 parents 6c4583a + 58643a7 commit 3af59aa

10 files changed

Lines changed: 86 additions & 0 deletions
3.31 MB
Binary file not shown.
7.7 MB
Binary file not shown.

examples/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Three examples for Alpine high throughput computing primer
2+
3+
### Python script used for all three examples:
4+
* `cars_mpg.py` (ingests arguments and processes into results)
5+
6+
### Example 1 files (Job Array)
7+
* `cars_mpg_array.sh` (job script)
8+
* `cars_mpg_input_args_array.txt` (array arguments)
9+
10+
### Example 2 files (Load Balancer)
11+
* `cars_mpg_lb.sh` (job script)
12+
* `cars_mpg_input_commands_lb.txt` (load balancer arguments)
13+
14+
### Example 3 files (GNU Parallel)
15+
* `cars_mpg_gnuparallel.sh` (job script)
16+
* `cars_mpg_input_commands_gnuparallel.txt` (GNU parallel arguments)

examples/cars_mpg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
3+
car=sys.argv[1]
4+
mpg=sys.argv[2]
5+
6+
print("The " + car + " gets " + mpg + " mpg.")

examples/cars_mpg_array.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
#SBATCH --time=00:00:10
3+
#SBATCH --partition=amilan
4+
#SBATCH --qos=normal
5+
#SBATCH --nodes=1
6+
#SBATCH --ntasks=1
7+
#SBATCH --job-name=cars
8+
#SBATCH --output=cars.%A_%a.out
9+
#SBATCH --array=1-5
10+
11+
# load anaconda python
12+
source /curc/sw/anaconda/default
13+
14+
# run workflow
15+
python cars_mpg.py $(sed -n "${SLURM_ARRAY_TASK_ID}p" cars_mpg_input_args_array.txt)

examples/cars_mpg_gnuparallel.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
#SBATCH --time=00:00:10
3+
#SBATCH --partition=amilan
4+
#SBATCH --qos=normal
5+
#SBATCH --nodes=1 # optional
6+
#SBATCH --ntasks=5
7+
#SBATCH --job-name=cars
8+
#SBATCH --output=cars.%j.out
9+
10+
11+
# load gnu parallel and anaconda python
12+
module purge
13+
module load gnu_parallel
14+
source /curc/sw/anaconda/default
15+
16+
# run workflow
17+
parallel -j $SLURM_NTASKS < cars_mpg_input_commands_gnuparallel.txt
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mustang 25
2+
pinto 30
3+
chevette 33
4+
nova 21
5+
cutlass 23
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python cars_mpg.py mustang 25
2+
python cars_mpg.py pinto 30
3+
python cars_mpg.py chevette 33
4+
python cars_mpg.py nova 21
5+
python cars_mpg.py cutlass 23
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
python cars_mpg.py mustang 25
2+
python cars_mpg.py pinto 30
3+
python cars_mpg.py chevette 33
4+
python cars_mpg.py nova 21
5+
python cars_mpg.py cutlass 23

examples/cars_mpg_lb.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
#SBATCH --time=00:00:10
3+
#SBATCH --partition=amilan
4+
#SBATCH --qos=normal
5+
#SBATCH --nodes=1 # optional
6+
#SBATCH --ntasks=6
7+
#SBATCH --job-name=cars
8+
#SBATCH --output=cars.%j.out
9+
10+
11+
# load loadbalancer and anaconda python
12+
module purge
13+
module load loadbalance
14+
source /curc/sw/anaconda/default
15+
16+
# run workflow
17+
mpirun lb cars_mpg_input_commands_lb.txt

0 commit comments

Comments
 (0)