:: the following script is run on the "master" node, and reads input from a file (nodes_single.txt). The inputs are passed to another batch file [see each_node_start.cmd below].
:: each_node_start.cmd [see below] assumes the files you are putting on the remote node are in a directory called "for_remote_copy" and include the executable and any input files.
@echo off
title master windows node cluster starter
cls
echo.
echo if you didn't mean to run this, control-c to stop now, otherwise
pause
echo started master at %time% on %date% on %computername% by %username% >> events.log
:: note: c:\researchdump1 needs to exist on the remote box
:: input file contains comment lines which with "!" and the
:: boxname password sharename
:: The following command line arguments are passed to "each_node_start.cmd"
:: %1 is the computer name
:: %2 is the "username" account password
:: %3 nodedumpX (for multi-core systems, each core gets a directory, like nodedump1 or nodedump2)
:: %4 node core number X (1 or 2)
:: %5 the name of the screensaver on ALL nodes
::
FOR /F "eol=! tokens=1,2 delims=, " %%i in (nodes_single.txt) do each_node_start.cmd %%i %%j researchdump1 1 logon.scr
FOR /F "eol=! tokens=1,2 delims=, " %%i in (nodes_dual.txt) do each_node_start.cmd %%i %%j researchdump1 1 logon.scr
:: The other option is to do all nodes simultaneously. If you uncomment this, comment the above two lines
:FOR /F "eol=! tokens=1,2 delims=, " %%i in (nodes_single.txt) do start each_node_start.cmd %%i %%j researchdump1 1 logon.scr
:FOR /F "eol=! tokens=1,2 delims=, " %%i in (nodes_dual.txt) do start each_node_start.cmd %%i %%j researchdump1 1 logon.scr
echo finished master at %time% on %date% >> out.txt
:: the contents of "each_node_start.cmd" are as follows:
@echo off
:: command line arguments:
:: %0 is the name of this file
:: %1 is the computer name
:: %2 is the "username" account password
:: %3 researchdumpX
:: %4 X (node number)
:: %5 logon.scr
:: identify which window goes to which computer so that if one dies we will be able to see which CPU and whether it was CPU1 or CPU2
if (%3==researchdump1) title %1, proc 1
if (%3==researchdump2) title %1, proc 2
:: also output info to screen to aid in troubleshooting
:: %0 is the name of this file
echo started %0 at %time% on %date% on %1 by %username%
:: note: c:\nodedump1 and c:\nodedump2 needs to exist on the remote box
:: building in a check for those directories and the seed.input would be nice
:: input file contains comment lines which with "!" and the
:: boxname password seed
:: first establish a connection with the remote box
echo.
echo up next, ending running processes
echo.
:: end any pre-existing files that may cause conflict
:: for starting dump1, kill any pre-existing processes by this name
:if (%3==researchdump1) pskill \\%1 executable_name
:: whereas if it's dump2, we don't want to kill the other process of the same name
:pskill \\%1 psexesvc
:psexec \\%1 -u %1\username -p %2 ipconfig
:call each_node_remote_files_deleter.cmd %1 %4
:: copy files from the appropriate directory (for_remote_copy) to the remote folder
::
copy for_remote_copy\* \\%1\c$\%3\
echo.
echo now we start the run
echo.
: try starting directly
:: doesn't work since the input files aren't in the correct location
:psexec \\%1 c:\%3\quasi1d_many_scatterer.exe >> c:\%3\output_%computername%_1.dat
:: I couldn't get this to work (it tries to run locally)
:start /belownormal /b \\%1\c$\%3\quasi1d_many_scatterer.exe
:: starts logon_mon, but doesn't detach process
:psexec \\%1 c:\%3\logon_mon %4 %5
:: starts the "runner.cmd" remote script, which starts logon_mon (or the quasi1d direct)
psexec \\%1 c:\%3\runner.cmd %4 %5
echo finished %0 at %time% on %date% >> results\output_%1.log
exit