nesi / APSIM-HPC

Deploy APSIM (Agricultural Production Systems sIMulator - https://www.apsim.info/) on high performance computing clusters.
https://nesi.github.io/APSIM-HPC/
MIT License
0 stars 0 forks source link

creating .apsimx files in parallel while all Config files and master .apsix files are on the same directory triggers System.IO.FileNotFoundException #31

Closed DininduSenanayake closed 2 months ago

DininduSenanayake commented 2 months ago

For an example

System.Exception: An error occured trying to save a simulation to /agr/persist/projects/2024_apsim_improvements/apsim-simulations/ConfigFiles/19487_Ailsa_5a1.apsimx. System.IO.FileNotFoundException: Could not find file '/agr/persist/projects/2024_apsim_improvements/apsim-simulations/ConfigFiles/LargerExampletemp.apsimx.temp'.
File name: '/agr/persist/projects/2024_apsim_improvements/apsim-simulations/ConfigFiles/LargerExampletemp.apsimx.temp'
   at System.IO.File.Move(String sourceFileName, String destFileName, Boolean overwrite)
   at Models.Core.Simulations.Write(String currentFileName, String savePath) in /tmp/ApsimX/Models/Core/Simulations.cs:line 187
   at Models.Core.Simulations.Write(String currentFileName, String savePath) in /tmp/ApsimX/Models/Core/Simulations.cs:line 193
   at Models.Program.ExecuteCommands(Options options, String configFileDirectory, List`1 commandsList, ApplyRunManager& applyRunManager, DataRow row) in /tmp/ApsimX/Models/Main.cs:line 400
   at Models.Program.DoCommands(Options options, String[] files, String configFileDirectory, List`1 commandsList) in /tmp/ApsimX/Models/Main.cs:line 313
   at Models.Program.Run(Options options) in /tmp/ApsimX/Models/Main.cs:line 175

Reason:

Solution

  1. If there is no time constraint, recommendation is to run the Models --apply command as a serial process. It take ~25 seconds to process a single Config.txt file and generate the corresponding .apsimx file alongside the .db placeholder file
  2. Otherwise, split the config files to multiple directories ( split to smaller groups) and process each group serially.
    • If we to explore this option, remember to copy all of the required .met files and the master .apsimx files to each directory
DininduSenanayake commented 2 months ago

Slurm script to generate the .apsimx and placeholder .db file is https://github.com/DininduSenanayake/APSIM-eri-mahuika/blob/main/4-create-apsimx-files/create_apsimx.sl