Views:

Question
How do you create batch jobs in MIKE 21? 

Answer 
To execute batch jobs, you have to create a text file with the extension *.bat. To edit the file (right-click and select 'Edit') you

1. Add the folder for the MZlaunch executable to the overall path
2. Add - below - one command line for each simulation to be run
3. Save and execute this batch file

E.g. to run three simulations with version 2025, the content of the batch file may be as follows:

path=%path%;%DHI_MIKE_2025%;
start /wait Mzlaunch.exe mud_run1.m21fm -x
start /wait Mzlaunch.exe mud_run2.m21fm -x
start /wait Mzlaunch.exe mud_C.m21fm -x 

In this example, we assume that the three setup files are all located in the same folder as the one containing the batch file.  When setup files are located in different directories, you can either add extra lines with the commands “cd” and “cd..” to navigate between folders, or replace the names of the setup files by their full paths.
Based on the extension of the input file MzLaunch.exe will automatically point to the correct model engine. 

Additionally
You can also control the parallelization technique using extra arguments, when running simulations with the Flexible Mesh version. Examples are shown below.

1. E.g. you can run simulations using 8 sub-domains on the CPU and 1 thread per sub-domain, using this batch file:

path=%path%;%DHI_MIKE_2025%;
set OMP_NUM_THREADS=1
cd NameOfSubfolderContainingSetupFile
Start /wait Mzlaunch.exe Scenario1.m21fm -mpi 8 -x
cd..
cd NameOfSubfolderContainingSecondSetupFile
Start /wait Mzlaunch.exe Scenario2.m21fm -mpi 8 –x

2. You can run simulations using 2 sub-domains on 2 GPU cards (with double precision) and 1 thread per sub-domain, using this batch file:
path=%path%;%DHI_MIKE_2025%;
set OMP_NUM_THREADS=1
Start /wait Mzlaunch.exe C:\FolderName1\Scenario1.m21fm –gpu 2 -x
Start /wait Mzlaunch.exe C:\FolderName2\Scenario2.m21fm –gpu 2 –x

3. You can run a simulation using 4 sub-domains on 4 specific GPU cards  (e.g. no 2, 3, 5 and 7 out of 8) and 2 threads per sub-domain, using this batch file:
path=%path%;%DHI_MIKE_2025%;
set OMP_NUM_THREADS=2
set subdomains=4

mpiexec -n %subdomains% -localonly FemEngineHDGPU.exe C:\FolderName1\Scenario1.m21fm –gpu 4 2 3 5 7

FURTHER INFORMATION & USEFUL LINKS 

Manuals and User Guides

User Guide. MIKE ZERO. The Common DHI User Interface for Project Oriented Water Modelling (Chapter 5.4 Batch Execution)

Related Products: MIKE 21/3
Comments (0)