11#include " e3sm_fgi_utils.hpp"
22#include " e3sm_fgi_data.hpp"
33
4+ /* Create a unique name for the test output */
45static inline std::string get_fcase_test_fname (int iotype, int rearr)
56{
67 const std::string FNAME_PREFIX = " spio_e3sm_fgi_f" ;
@@ -13,6 +14,7 @@ static inline std::string get_fcase_test_fname(int iotype, int rearr)
1314 + FNAME_SUFFIX;
1415}
1516
17+ /* Pseudo E3SM F case */
1618static int test_fcase (MPI_Comm comm, int iosysid, const std::string &fname, int iotype)
1719{
1820 int comm_rank = 0 , comm_sz = 0 ;
@@ -37,6 +39,7 @@ static int test_fcase(MPI_Comm comm, int iosysid, const std::string &fname, int
3739 double dlev = 0 ;
3840 std::function<double (void )> gen_levels = [dlev] (void ) mutable { double d = dlev; dlev += 0.2 ; return d; };
3941
42+ /* Generates dates starting from date 15/06/21 */
4043 int start_date = 15 ;
4144 std::function<std::string (void )> gen_dates = [start_date] (void ) mutable {
4245 static const std::string month (" 06" );
@@ -48,6 +51,7 @@ static int test_fcase(MPI_Comm comm, int iosysid, const std::string &fname, int
4851 return month + SEP + std::to_string (start_date++) + SEP + year;
4952 };
5053
54+ /* Generator for a simple 1D I/O decomposition */
5155 std::function<PIO_Offset (void )> decomp_1d_gen =
5256 [comm_rank, NCOL, NCOL_PER_PROC](void ){
5357 static const PIO_Offset INIT_IDX = 0 ;
@@ -62,6 +66,7 @@ static int test_fcase(MPI_Comm comm, int iosysid, const std::string &fname, int
6266 E3SM_FGI::SPIO_decomp decomp_1d (" decomp_1d_ncol" , iosysid, PIO_DOUBLE,
6367 std::vector<int >({static_cast <int >(NCOL)}), NCOL_PER_PROC, decomp_1d_gen);
6468
69+ /* 2D Decompisition generator : NCOL s are divided evenly among processes */
6570 std::function<PIO_Offset (void ) > decomp_2d_gen =
6671 [comm_rank, is_last_proc, NCOL, NCOL_PER_PROC, NLEV, idx, ilev](void ) mutable {
6772
@@ -83,6 +88,8 @@ static int test_fcase(MPI_Comm comm, int iosysid, const std::string &fname, int
8388 };
8489
8590 int lsz = NLEV * ((!is_last_proc) ? NCOL_PER_PROC : (NCOL - comm_rank * NCOL_PER_PROC));
91+
92+ /* Create 2D I/O decomposition for unlimited vars */
8693 E3SM_FGI::SPIO_decomp decomp_2d (" decomp_2d_lev_ncol" , iosysid, PIO_DOUBLE,
8794 std::vector<int >({NLEV, static_cast <int >(NCOL)}),
8895 lsz, decomp_2d_gen);
@@ -91,6 +98,7 @@ static int test_fcase(MPI_Comm comm, int iosysid, const std::string &fname, int
9198
9299 E3SM_FGI::SPIO_file fh (iosysid, fname, iotype, false );
93100
101+ /* Define dims/atts/vars */
94102 ret = fh.def ({
95103 /* Global Attributes */
96104 std::make_shared<E3SM_FGI::SPIO_att>(" ne" , NE),
@@ -117,6 +125,7 @@ static int test_fcase(MPI_Comm comm, int iosysid, const std::string &fname, int
117125 return ret;
118126 }
119127
128+ /* Write variables/atts */
120129 ret = fh.put ();
121130 if (ret != PIO_NOERR){
122131 Util::GVars::logger->log (Util::Logging::LogLevel::ERROR, " Putting file objects failed" );
@@ -137,6 +146,7 @@ int E3SM_FGI::test_e3sm_fcase(MPI_Comm comm, const std::vector<int> &iotypes,
137146
138147 int io_stride = comm_sz / nioprocs;
139148
149+ /* Test F case for each combination of I/O type and I/O rearranger */
140150 Util::zip_for_each (iotypes.cbegin (), iotypes.cend (), rearrs.cbegin (), rearrs.cend (),
141151 [comm, nioprocs, io_stride](int iotype, int rearr){
142152 const int IOSYS_START_PROC = 0 ;
0 commit comments