Skip to content

Commit

Permalink
Fix SW_CTL_RunSimSet(): numDomainErrors was no longer incremented if …
Browse files Browse the repository at this point in the history
…simulation run errored
  • Loading branch information
dschlaep committed Jan 7, 2024
1 parent 501e72b commit 5be7b20
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/SW_Control.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ void SW_CTL_RunSimSet(SW_ALL *sw_template, SW_OUTPUT_POINTERS SW_OutputPtrs[],
tag_suid[0] = '\0';
WallTimeSpec tss, tsr;
Bool ok_tss = swFALSE, ok_tsr = swFALSE, ok_suid;

int progFileID = 0; // Value does not matter if SWNETCDF is not defined
int progVarID = 0; // Value does not matter if SWNETCDF is not defined

Expand All @@ -221,6 +222,7 @@ void SW_CTL_RunSimSet(SW_ALL *sw_template, SW_OUTPUT_POINTERS SW_OutputPtrs[],

set_walltime(&tss, &ok_tss);

/* Loop over suids in simulation set of domain */
for(suid = SW_Domain->startSimSet; suid < SW_Domain->endSimSet; suid++)
{
/* Check wall time against limit */
Expand All @@ -237,27 +239,34 @@ void SW_CTL_RunSimSet(SW_ALL *sw_template, SW_OUTPUT_POINTERS SW_OutputPtrs[],
LOG_INFO local_LogInfo;
sw_init_logs(main_LogInfo->logfp, &local_LogInfo);

/* Check if suid needs to be simulated */
SW_DOM_calc_ncSuid(SW_Domain, suid, ncSuid);

ok_suid = SW_DOM_CheckProgress(progFileID, progVarID, ncSuid,
&local_LogInfo);

if(ok_suid && !local_LogInfo.stopRun) {
/* Count simulation run */
nSims++;

nSims++; // Counter of simulation runs

/* Simulate suid */
set_walltime(&tsr, &ok_tsr);
SW_CTL_run_sw(sw_template, SW_Domain, ncSuid,
SW_OutputPtrs, NULL, &local_LogInfo);
SW_WT_TimeRun(tsr, ok_tsr, SW_WallTime);

/* Report progress for suid */
if(!local_LogInfo.stopRun) {
// Set simulation run progress
SW_DOM_SetProgress(SW_Domain->DomainType, progFileID,
progVarID, ncSuid, &local_LogInfo);
}
}

/* Report errors and warnings for suid */
if(local_LogInfo.stopRun) {
main_LogInfo->numDomainErrors++; // Counter of simulation units with error
}

if (local_LogInfo.numWarnings > 0) {
main_LogInfo->numDomainWarnings++; // Counter of simulation units with warnings
}
Expand All @@ -268,6 +277,7 @@ void SW_CTL_RunSimSet(SW_ALL *sw_template, SW_OUTPUT_POINTERS SW_OutputPtrs[],
}
}

/* Produce global error if all suids failed */
if (nSims == main_LogInfo->numDomainErrors) {
LogError(
main_LogInfo,
Expand Down

0 comments on commit 5be7b20

Please sign in to comment.