Skip to content

Commit

Permalink
Check uniform RCO job termination in Motran apps
Browse files Browse the repository at this point in the history
For the uniform run control object (RCO), check if the number of output
files (i.e., *egsdat, *pardose, etc.) is equal to the number of combined
parallel jobs. If not, then the last job sleeps for a set time
($URC-SLEEP, by default 1 second) and repeats the combining process a
set number of times ($URC-INTERVALS, by default only once).

Previously, the uniform RCO for Mortran apps was in fact identical to
the egs++ simple URC. In that case, the last job combines only those
jobs that finished before it.

Note that the Mortran uniform RCO implementation does not delete
existing output files such as *egsdat and *pardose at the beginning of a
parallel run (as opposed to the egs++ implementation). This could
produce ill effects when re-running a previous calculation with a
modified input file: if not all output files are overwritten (e.g.,
fewer parallel jobs are requested for the new run), then a mix of old
and new output files will be combined.
  • Loading branch information
mainegra authored and ftessier committed Mar 29, 2021
1 parent cc47774 commit 67d4608
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 16 additions & 1 deletion HEN_HOUSE/src/egs_utilities.mortran
Original file line number Diff line number Diff line change
Expand Up @@ -1012,10 +1012,14 @@ character*1024 tmp_string,base,command,outfile,parfile_name,base1,
text_string;
integer lnblnk1,istat,ipar,egs_system,egs_open_file;
$INTEGER i,k,j,numparfiles,textindex;
integer urcSleep, urcCheckIntervals;
$LOGICAL ex,iwin;

iwin=.false.; "start off assuming a non-Windows system"

urcSleep = $URC-SLEEP; "Set to 1 s in egsnrc.macros"
urcCheckIntervals = $URC-INTERVALS;"Set to 1 in egsnrc.macros"

$set_string(base,' ');
base = $cstring(egs_home) // $cstring(user_code) // $file_sep //
$cstring(output_file) // '_w';
Expand All @@ -1028,6 +1032,8 @@ base1 = $cstring(egs_home) // $cstring(user_code) // $file_sep //
$set_string(outfile,' ');
outfile = $cstring(egs_home) // $cstring(user_code) // $file_sep //
'parfiles_tmp';

:check-output-files:;
"try Unix/Linux first"
$set_string(command,' ');
command = 'ls ' // $cstring(base1) // ' | wc -l > ' // $cstring(outfile);
Expand All @@ -1037,7 +1043,8 @@ IF(istat~=0)["now assume a Windows system"
$cstring(outfile);
istat = egs_system($cstring(command));
IF(istat~=0)[
$egs_fatal(*,' Failed to write number of output files from parallel runs.');
$egs_fatal(*,
' Failed to write number of output files from parallel runs.');
]
ELSE [
iwin=.true.;
Expand All @@ -1060,6 +1067,14 @@ ELSE[
]
close(ipar);

#ifdef HAVE_C_COMPILER;
IF ( is_uniform_run & numparfiles < n_parallel & urcCheckIntervals > 0 ) [
call egs_sleep(urcSleep);"sleep for urcSleep seconds"
urcCheckIntervals -= 1;
goto :check-output-files:;
]
#endif;

"now remove parfiles_tmp"
$set_string(command,' ');

Expand Down
6 changes: 6 additions & 0 deletions HEN_HOUSE/src/egsnrc.macros
Original file line number Diff line number Diff line change
Expand Up @@ -2315,6 +2315,12 @@ REPLACE {$EADL-RELAX-DEFAULT} WITH {.true.}
"Uniform Run Control (URC) is false by default"
REPLACE {$URC-DEFAULT} WITH {.false.}
;
"SLEEP INTERVAL for URC (1 s by default)"
"Time to wait for jobs to complete after last job finished"
REPLACE {$URC-SLEEP} WITH {1}
"Times to check for jobs to complete after last job finished"
REPLACE {$URC-INTERVALS} WITH {1}
;
"Sabbatucci and Salvat PE xsections not the default yet"
REPLACE {$MCDF-PE-DEFAULT} WITH {.false.}
;
Expand Down

0 comments on commit 67d4608

Please sign in to comment.