Create automatically 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 CreateBatchFile 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,

I’m sure others will find this helpful. I should mention that have been working on enabling multi-processing functionality in CP, which will be available in the next release. Hopefully, this will make some of your analysis tasks easier to perform. Stay tuned…

Regards,
-Mark