Skip to content

Commit

Permalink
Merge branch 'jonbob/mali/create-all-logs' (PR E3SM-Project#6694)
Browse files Browse the repository at this point in the history
Add ability for MALI to create separate logs from each processor

Adds a new variable config_create_all_logs_in_e3sm to MALI that allows
users to choose to get a separate log file from each processor

[NML] for configurations with MALI
[BFB]
  • Loading branch information
jonbob committed Oct 31, 2024
2 parents 2f11da4 + ae89098 commit 0291efc
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 17 deletions.
1 change: 1 addition & 0 deletions components/mpas-albany-landice/bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ add_default($nl, 'config_pio_stride');
add_default($nl, 'config_year_digits');
add_default($nl, 'config_output_external_velocity_solver_data');
add_default($nl, 'config_write_albany_ascii_mesh');
add_default($nl, 'config_create_all_logs_in_e3sm');

#################################
# Namelist group: decomposition #
Expand Down
1 change: 1 addition & 0 deletions components/mpas-albany-landice/bld/build-namelist-section
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ add_default($nl, 'config_pio_stride');
add_default($nl, 'config_year_digits');
add_default($nl, 'config_output_external_velocity_solver_data');
add_default($nl, 'config_write_albany_ascii_mesh');
add_default($nl, 'config_create_all_logs_in_e3sm');

#################################
# Namelist group: decomposition #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
<config_year_digits>4</config_year_digits>
<config_output_external_velocity_solver_data>.false.</config_output_external_velocity_solver_data>
<config_write_albany_ascii_mesh>.false.</config_write_albany_ascii_mesh>
<config_create_all_logs_in_e3sm>.false.</config_create_all_logs_in_e3sm>

<!-- decomposition -->
<config_num_halos>3</config_num_halos>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,14 @@ Valid values: .true. or .false.
Default: Defined in namelist_defaults.xml
</entry>

<entry id="config_create_all_logs_in_e3sm" type="logical"
category="io" group="io">
Logical flag determining if log files will be created for each processor in an E3SM configuration. If .true., the model initializes and writes to one files per processor.

Valid values: .true. or .false.
Default: Defined in namelist_defaults.xml
</entry>


<!-- decomposition -->

Expand Down
38 changes: 21 additions & 17 deletions components/mpas-albany-landice/driver/glc_comp_mct.F
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ subroutine glc_init_mct( EClock, cdata_g, x2g_g, g2x_g, NLFilename )!{{{
logical :: streamsExists
integer :: mesh_iotype

logical, pointer :: tempLogicalConfig
logical, pointer :: tempLogicalConfig, config_create_all_logs_in_e3sm
character(len=StrKIND), pointer :: tempCharConfig


Expand Down Expand Up @@ -332,22 +332,6 @@ end subroutine xml_stream_get_attributes
call mpas_dmpar_abort(domain % dminfo)
end if

! Set core specific options here
! Disable output from all but the master task for E3SM!
! (This overrides the default set by mpas_log_init based on MPAS_DEBUG setting.)
if (iam /= 0) then
domain % logInfo % outputLog % isActive = .false.
endif

! After core has had a chance to modify log defaults, open the output log
call mpas_log_open(err=ierr)
if ( ierr /= 0 ) then
write(glcLogUnit,*) 'ERROR: log open failed for core ' // trim(domain % core % coreName)
call mpas_dmpar_abort(domain % dminfo)
end if
! ===========


! ----------
! Process namelist and streams files
! ----------
Expand All @@ -361,6 +345,26 @@ end subroutine xml_stream_get_attributes
call mpas_log_write('Namelist setup failed for core ' // trim(domain % core % coreName), MPAS_LOG_CRIT)
end if

! Set core specific options here
! Disable output from all but the master task for E3SM!
! (This overrides the default set by mpas_log_init based on MPAS_DEBUG setting.)
call mpas_pool_get_config(domain % configs, 'config_create_all_logs_in_e3sm', config_create_all_logs_in_e3sm)
if (config_create_all_logs_in_e3sm) then
domain % logInfo % outputLog % isActive = .true.
else
if (iam /= 0) then
domain % logInfo % outputLog % isActive = .false.
endif
endif

! After core has had a chance to modify log defaults, open the output log
call mpas_log_open(err=ierr)
if ( ierr /= 0 ) then
write(glcLogUnit,*) 'ERROR: log open failed for core ' // trim(domain % core % coreName)
call mpas_dmpar_abort(domain % dminfo)
end if
! ===========

call mpas_framework_init_phase2(domain, io_system)

! Define package variables
Expand Down
4 changes: 4 additions & 0 deletions components/mpas-albany-landice/src/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,10 @@
description="Logical flag determining if ascii mesh files will be created. These files are written in a format that can be used by the standalone Albany velocity solver for optimization. If .true., the model initializes, writes the mesh files, and then terminates."
possible_values=".true. or .false."
/>
<nml_option name="config_create_all_logs_in_e3sm" type="logical" default_value=".false." units="unitless"
description="Logical flag determining if log files will be created for each processor in an E3SM configuration. If .true., the model initializes and writes to one files per processor."
possible_values=".true. or .false."
/>

</nml_record>

Expand Down

0 comments on commit 0291efc

Please sign in to comment.