Created
February 5, 2016 16:16
-
-
Save ftessier/a4e5d0ee255ba4f6f338 to your computer and use it in GitHub Desktop.
This file contains 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
@echo off | |
REM ################################################################################# | |
REM | |
REM usage: | |
REM egs-parallel.bat (or double-click on this file) | |
REM | |
REM ################################################################################# | |
REM # ask about command and number of processes | |
echo. | |
set /p egscommand=Enter the EGSnrc command you want to run: | |
set /p nstr=Enter number of parallel jobs: | |
set /a n=%nstr% | |
REM # Ready? | |
echo. | |
choice /N /M "Ready to run %egscommand% using %n% jobs [YN] ? " | |
if errorlevel 2 exit /b | |
REM ### launch $n EGSnrc jobs in parallel, in the background | |
echo. | |
for /l %%j in (1,1,%n%) do ( | |
echo LAUNCHING job %%j of %n%: %egscommand% -b -P %n% -j %%j -f 1 | |
start /b %egscommand% -b -P %n% -j %%j -f 1 >NUL 2>&1 | |
) |
I answered myself, I just had to add a delay after each command call, I added:
timeout /t 2 /nobreak > NUL
after line 25 (start /b ...)
have a nice day!.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear @ftessier, first of all thanks for the bat file!. I have a strange behavior with the bat file. It issues the commands for parallel execution, however, neither start execution untiI I enter a single command that triggers the parallel execution, for example, using egs_chamber I do the following on my terminal:
C:[...]>egs-parallel.bat
Enter the EGSnrc command you want to run:egs_chamber -i gk_egs_chamber -p gk521icru
Enter number of parallel jobs:16
Ready to run egs_chamber -i gk_egs_chamber -p gk521icru using 16 jobs [YN] ?Y
LAUNCHING job 1 of 16: egs_chamber -i gk_egs_chamber -p gk521icru -b -P 16 -j 1 -f 1
LAUNCHING job 2 of 16: egs_chamber -i gk_egs_chamber -p gk521icru -b -P 16 -j 2 -f 1
[ ... ]
LAUNCHING job 16 of 16: egs_chamber -i gk_egs_chamber -p gk521icru -b -P 16 -j 16 -f 1
however nothing happens, the processes do not start. In order to do so I have to issue a single command to execute the user code, for example:
C:[...]>egs_chamber -i gk_egs_chamber -p gk521icru
Then all processes start execution. Does this happen to you?. Anyway then everything works perfect, however it is just a bit strange.