Skip to content

Instantly share code, notes, and snippets.

@musically-ut
Last active April 1, 2019 10:11
Show Gist options
  • Save musically-ut/9334018d9a66c44ff0d271c602a6ad1c to your computer and use it in GitHub Desktop.
Save musically-ut/9334018d9a66c44ff0d271c602a6ad1c to your computer and use it in GitHub Desktop.
Poor man's parallel execution on servers
#!/usr/bin/env bash
set -e
for N in {1..5}
do
for M in {0.1,1,2,5,10};
do
# Replace ./my_prog.py with your program to run it in parallel
./my_prog.py -N $N -M $M > output/stdout_N${N}_M${M}.txt &
echo $!
done
done
## Run as:
## ./pool_man_parallel.sh > pids
## Then kill recalcitrant processes from `pids` file, if needed.
@musically-ut
Copy link
Author

@harrymvr The PPID of the processes put in background seems to be 1, i.e. the init process:

I am not too keen on running pkill -P 1. <_<

@harrymvr
Copy link

hmmm interesting. Yeah, I would pass on that as well 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment