Automatic Batch Jobs on Windows

I have a really high-end computer with a lot of cores present to the operating system.

I faced the challenge to create a certain number of parallel jobs. And I wanted to be done automatically, so I do not have to fix any numbers by hand.

I have created a programmed batch file for Windows. For the proper function of this batch file you have to change the directories in line 3-6 to your own needs. The Batch_data.mat file produced by the CellProfiler module CreateBatchFiles is expected to be in the output directory.

[code]@ECHO OFF
REM Change the following lines to your own settings
SET OUTPUTDIR=D:\LMF\Ronny\output
SET CPINSTALLDIR=C:\progra~1\CellProfiler
SET DATADIR=D:\LMF\Ronny\users\Miguel\pic-droplets
SET cores=20
D:
REM Anything after this line should be leaved as it is

cd %DATADIR%

ECHO "START DATE AND TIME"
DATE /T
TIME /T

SET count=1

FOR /f “tokens=*” %%G IN (‘dir /A-d /b /s’) DO (call :s_do_sums “%%G”)

GOTO :BEGIN
:s_do_sums
REM echo %count%:%1
set /a count+=1
GOTO :END

:BEGIN
set /a count-=1
set /a n=count/%cores%
set /a r=count %% 12
set /a iv=n-1
echo %n% Rest %r% Interval %iv%

FOR /L %%I IN (1,%n%,%count%) DO (call :do_loop “%%I”)

GOTO :LAST
:do_loop
set /a aiv=%1+iv
set /a ai=%1+0
echo %ai% - %aiv%
START %CPINSTALLDIR%\CellProfiler.exe -p %OUTPUTDIR%\Batch_data.mat -c -r -f %ai% -l %aiv%

GOTO :END

:LAST
ECHO END DATE AND TIME"
DATE /T
TIME /T

:END
c:[/code]

Happy Imaging

Ronny

Hi Ronny,

Thanks for contributing this. You might want to know that we have been working on adding multi-processing functionality to CellProfiler; when released, it should defray some the issues you have been trying to solve. Stay tuned…

Regards,
-Mark