Created
March 3, 2017 19:29
-
-
Save aguadopd/d9b0633ec1d72cd21682975a0e9b8719 to your computer and use it in GitHub Desktop.
Bash egs parallel - Running EGSnrc codes on multiple cores without a queuing system.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bash egs parallel - Running EGSnrc codes on multiple cores without a queuing system. | |
| # https://plus.google.com/+FredericTessierPlus/posts/hRS9Rjztsy3 | |
| #!/bin/bash | |
| ##################################################################################### | |
| # | |
| # usage: | |
| # | |
| # egs-parallel <n> <command> | |
| # n: number of jobs | |
| # command: EGSnrc command you want to run in parallel | |
| # | |
| ##################################################################################### | |
| # parse command-line arguments for number of jobs and command to run | |
| n=$1 | |
| shift | |
| command="$@" | |
| # launch EGSnrc jobs in parallel, in the background | |
| echo | |
| echo "egs-parallel ($n jobs): $command" | |
| echo -------------------------------------------------------------------------------- | |
| for j in `seq $n`; do | |
| $command -b -P $n -j $j >/dev/null 2>&1 & | |
| processid=`printf %5d $!` | |
| echo "LAUNCHED $processid: $command -b -P $n -j $j &" | |
| sleep 10 | |
| done | |
| # wait for completion and report | |
| wait | |
| echo -------------------------------------------------------------------------------- | |
| echo "SIMULATION COMPLETED ($command)" | |
| echo |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now in https://github.com/aguadopd/egsnrc-parallel-bash