MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
GlobalMpiInformation Class Reference

Class to store global MPI information and to prevent accidental changes. More...

#include <globalmpiinfo.h>

Public Member Functions

void init (const MInt domainId, const MInt noDomains)
 

Private Member Functions

void initMPIInformation ()
 

Private Attributes

MInt m_globalDomainId = 0
 
MInt m_globalNoDomains = 1
 
MPI_Info m_mpiInfo = MPI_INFO_NULL
 

Friends

MInt globalDomainId ()
 Return global domain id. More...
 
MInt globalNoDomains ()
 Return global number of domains. More...
 
const MPI_Info & globalMpiInfo ()
 Return global MPI information. More...
 

Detailed Description

Definition at line 22 of file globalmpiinfo.h.

Member Function Documentation

◆ init()

void GlobalMpiInformation::init ( const MInt  domainId,
const MInt  noDomains 
)
inline

Definition at line 24 of file globalmpiinfo.h.

24 {
25 m_globalDomainId = domainId;
26 m_globalNoDomains = noDomains;
27
29 }

◆ initMPIInformation()

void GlobalMpiInformation::initMPIInformation ( )
inlineprivate

Definition at line 32 of file globalmpiinfo.h.

32 {
34
35 // Set header align size to 10KB for netCDF files. Allows to append header data without the need
36 // to move all variable data if the header size is exceeded (which may cause MPI I/O errors).
37 // Source: https://trac.mcs.anl.gov/projects/parallel-netcdf/wiki/VariableAlignment
38 MPI_Info_set(m_mpiInfo, "nc_header_align_size", "10240");
39 // Note: possibility to set variable align size
40 /* MPI_Info_set(m_mpiInfo, "nc_var_align_size", "4194304"); */
41
42#if !defined(WITH_HDF5) && defined(MPI_IO_OPT) && defined(HOST_HAZELHEN)
43 // taken from Cray Wiki: https://wickie.hlrs.de/platforms/index.php/MPI-IO,
44 // see also PNetcdf documentation: http://trac.mcs.anl.gov/projects/parallel-netcdf/wiki/HintsForPnetcdf
45 if(m_globalNoDomains > 256) {
46 MPI_Info_set(m_mpiInfo, (char*)"cb_align", (char*)"2"); /* Default: OMPI: none, CrayMPT: 2 */
47 MPI_Info_set(m_mpiInfo, (char*)"cb_nodes_list", (char*)"*:*"); /* Default: OMPI: *:1, CrayMPT: *:* */
48 MPI_Info_set(m_mpiInfo, (char*)"direct_io", (char*)"false"); /* Default: OMPI: none, CrayMPT: false */
49 MPI_Info_set(m_mpiInfo, (char*)"romio_ds_read", (char*)"disable"); /* Default: OMPI: none, CrayMPT: disable */
50 MPI_Info_set(m_mpiInfo, (char*)"romio_ds_write", (char*)"disable"); /* Default: OMPI: none, CrayMPT: disable */
51 /* Let's reduce the number of aggregators, should be roughly 2 to 4 times the stripe-factor */
52 // MPI_Info_set (m_mpiInfo, (char*)"cb_nodes", (char*)"8");
53 /* Default: OMPI: set automatically to the number of distinct nodes; However TOO High */
54
55 MPI_Info_set(m_mpiInfo, (char*)"ind_wr_buffer_size", (char*)"16777216");
56 /* proposed by PNetcdf documentation */
57 MPI_Info_set(m_mpiInfo, (char*)"striping_factor", (char*)"64");
58 /* no. of I/O devices across which the file should be striped */
59 MPI_Info_set(m_mpiInfo, (char*)"cb_nodes", (char*)"128");
60 }
61#endif
62
63#if defined(MPI_IO_OPT) && defined(HOST_Hawk)
64 if(m_globalNoDomains > 10000) { // TODO labels:HAWK,IO
65 // NOTE: PNetcdf memory issue for large scale simulations. During the pnetcdf write call a significant amount of
66 // memory is allocated (at least on Hawk; scales linear with noDomains), which is not freed thereafter.
67 // Setting these romio hints solves the memory allocation problem, however it is not clear if this was responsible
68 // for some incomplete written data files.
69 // To be able to check for erroneous files you can enabled the fill mode for PNetcdf in config.h with
70 // MAIA_NCMPI_FILL_VARIABLES = true
71 // and check your files for fill values in the data (which should have been overwritten).
72 MPI_Info_set(m_mpiInfo, (char*)"romio_cb_read", (char*)"disable");
73 MPI_Info_set(m_mpiInfo, (char*)"romio_cb_write", (char*)"disable");
74 if(m_globalDomainId == 0) {
75 std::cerr << std::endl
76 << std::endl
77 << "NOTE: disabling ROMIO hints romio_cb_read/write to avoid PNetcdf/Hdf5 memory allocation issues "
78 "on HAWK... "
79 << std::endl
80 << "NOTE: see comment at " << AT_ << std::endl
81 << "NOTE: undefine MPI_IO_OPT to turn off the ROMIO hint changes." << std::endl
82 << std::endl
83 << std::endl;
84 }
85
86 // TODO labels:HAWK,IO check if it makes sense to disable these
87 // MPI_Info_set(m_mpiInfo, (char*)"romio_ds_read", (char*)"disable");
88 // MPI_Info_set(m_mpiInfo, (char*)"romio_ds_write", (char*)"disable");
89 }
90#endif
91
92#ifdef MPI_IO_PRINT_INFO
93 // Print MPI information on global rank 0
94 if(m_globalDomainId == 0) {
95 std::cerr << std::endl << "Global MPI information" << std::endl;
97 }
98#endif
99 }
void printMpiInfo(MPI_Info &mpiInfo)
Print all information of given MPI_Info object.
int MPI_Info_create(MPI_Info *info, const MString &name)
same as MPI_Info_create

Friends And Related Function Documentation

◆ globalDomainId

MInt globalDomainId ( )
friend

Definition at line 113 of file globalmpiinfo.h.

GlobalMpiInformation g_mpiInformation

◆ globalMpiInfo

const MPI_Info & globalMpiInfo ( )
friend

Definition at line 117 of file globalmpiinfo.h.

117{ return g_mpiInformation.m_mpiInfo; }

◆ globalNoDomains

MInt globalNoDomains ( )
friend

Definition at line 115 of file globalmpiinfo.h.

Member Data Documentation

◆ m_globalDomainId

MInt GlobalMpiInformation::m_globalDomainId = 0
private

Definition at line 105 of file globalmpiinfo.h.

◆ m_globalNoDomains

MInt GlobalMpiInformation::m_globalNoDomains = 1
private

Definition at line 106 of file globalmpiinfo.h.

◆ m_mpiInfo

MPI_Info GlobalMpiInformation::m_mpiInfo = MPI_INFO_NULL
private

Definition at line 107 of file globalmpiinfo.h.


The documentation for this class was generated from the following file: