Skip to content

Commit aae3ac8

Browse files
author
Andy Stokely
committed
Set default PnetCDF header alignment to 128 KiB
Increase the default Parallel NetCDF header alignment to 128 KiB when creating new files with SMIOL. This increases the default header size, providing additional header memory padding and reducing the likelihood of header reallocations and associated performance degradation. The alignment hint can be overridden via the PNETCDF_HINTS environment variable.
1 parent 9fa8cb2 commit aae3ac8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/external/SMIOL/smiol.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define PNETCDF_DEFINE_MODE 0
1313
#define PNETCDF_DATA_MODE 1
1414
#define MAX_REQS 256
15+
#define PNETCDF_HEADER_ALIGN_SIZE_STR "131072"
1516
#endif
1617

1718
#define START_COUNT_READ 0
@@ -324,6 +325,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename,
324325
/*
325326
* Convert fformat to a PNetCDF file creation mode
326327
*/
328+
MPI_Info info = MPI_INFO_NULL;
327329
int filecmode;
328330
if (fformat == SMIOL_FORMAT_CDF2) {
329331
filecmode = NC_64BIT_OFFSET;
@@ -336,11 +338,14 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename,
336338
MPI_Comm_free(&io_group_comm);
337339
return SMIOL_INVALID_FORMAT;
338340
}
339-
341+
MPI_Info_create(&info);
342+
MPI_Info_set(info, "nc_header_align_size",
343+
PNETCDF_HEADER_ALIGN_SIZE_STR);
340344
ierr = ncmpi_create(io_file_comm, filename,
341345
(filecmode | NC_CLOBBER),
342-
MPI_INFO_NULL,
346+
info,
343347
&((*file)->ncidp));
348+
MPI_Info_free(&info);
344349
}
345350
(*file)->state = PNETCDF_DEFINE_MODE;
346351
#endif

0 commit comments

Comments
 (0)