Batch file to run 10,000 instances of a program, in groups of 32

Marzz

New member
Local time
4:39 PM
Messages
3
Dear all,

I have a computer with 32 (physical) cores and need to run a total of 10,000 statistical simulations. Each simulation is started with:

> program.exe "scriptName.txt"

where 'scriptName.txt' is 'script1.txt' , 'script2.txt', etc.
The program automatically quits after completion, but each program has a varying runtime.

Now my question: I have found information on how to start programs sequentially as well as simultaneously (using batch files), but does anyone know how to start 10,000 programs in groups of 32? The idea is to run 32 programs simultaneously, and whenever a program quits, a new one should be opened automatically in order for the 32 available cores to be efficiently used.

Thank you!
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64
OS
Windows 7 Ultimate x64
Hi

What software are you using to run the realisations? Is it Windows based or Unix based?

I know how to accomplish this using a TCShell script but not .bat files unfortunately. If I provide the shell script, perhaps someone could convert to .bat format.

Generally simulations use RAM as opposed to CPU, since each realisation runs with the same simulation parameters and data, with only the random seed number varying - this depends largely on the software used. How much RAM do you have available?

Regards,
Golden
 

My Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Hi Golden,

Each of my runs takes several hours of computation time and requires <1 GB of RAM. My system has 128GB of RAM installed, so running 32 computations simultaneously is no problem.

The software is Open Source (it's called OpenBUGS) and can be installed in Linux or Windows, but I use the Windows version.

Do you have any suggestion on how to write the required batch file?
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64
OS
Windows 7 Ultimate x64
Hi,

You could try this option, although it requires some work in setting up the simulation parameter files. Basically, you create 32 .bat files to run similatneously. Each .bat file runs 300 realisations (10,000 / 32 = 312.5), so we use 300. BAT file 1 to 31 loops through 300 realisations, BAT file 32 runs through the remaining 700 realisations.

This is what it looks like in TCSHELL format. You need to convert to the equivalent "DOS" format if using Windows BAT files.

BAT #1
Code:
set i = 1
while (${i} <= 300)
[B][I]program.exe script${i}.txt
[/I][/B]@ i = $i + 1
end

BAT#2
Code:
set i = 301
while (${i} <= 900)
[B][I]program.exe script${i}.txt
[/I][/B]@ i = $i + 1
end

BAT#3
Code:
set i = 901
while (${i} <= 1200)
[I][B]program.exe script${i}.txt
[/B][/I]@ i = $i + 1
end

.
.
.
.
.
n
.
.
.
.
.
.
BAT#32
Code:
set i = 9301
while (${i} <= 10000)
[I][B]program.exe script${i}.txt
[/B][/I]@ i = $i + 1
end

Good luck,
Golden
 

My Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Hi Golden,

Already thought about this, but it was precisely what I was trying to avoid.. It doesn't scale well.. Perhaps
someone knows a way to program this directly?

Best, Marcel
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64
OS
Windows 7 Ultimate x64
Sorry Marcel, but you might be out of luck. I've tried looking for solutions to the same thing and gave up (180 realisations for 900 million nodes and 5 variables = 3 weeks computing time)

I've tried looking at many different solutions (for example Python scripting for SGeMS - http://sgems.sourceforge.net/) but its too buggy. Like you say, you need a programmatical solution, but that requires burrowing down into the code......very tricky and time consuming..............:(
 

My Computer My Computer

At a glance

Windows 10 Pro x64 ; Xubuntu x64Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz16GB Corsair Vengance DDR3 @ 661 MHz Dual Cha...EVGA NVidia GTX 560 1024MB
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Golden Mk. I.4
OS
Windows 10 Pro x64 ; Xubuntu x64
CPU
Intel i7 860 @ 2.80 GHz O/C'ed to 4.0GHz
Motherboard
Gigabyte P55A-UD3R Rev.1. Award BIOS F13
Memory
16GB Corsair Vengance DDR3 @ 661 MHz Dual Channel (9-9-9-24)
Graphics Card(s)
EVGA NVidia GTX 560 1024MB
Sound Card
Realtek Integrated
Monitor(s) Displays
Dual Samsung SyncMaster 2494HS
Screen Resolution
1920*1080 and 1920*1080
Hard Drives
1*Samsung 840 EVO 120GB SSD;
1*OCZ Vertex 2 60GB SSD;
2*Samsung F3 SpinPoint 1TB in RAID0;
1*Samsung F1 SpinPoint 1TB;
2*Western Digital 1TB External USB 3.0
1*Western Digital 500GB External USB 3.0
1*Seagate 500GB External USB 2.0
PSU
Thermaltake ToughPower QFan 750W
Case
Thermaltake Element S VK60001W2Z
Cooling
Corsair H60 Water Cooling, 2*230mm and 2*80mm case fans
Keyboard
Logitech G110
Mouse
Logitech MX518
Back
Top