From 4b45fa76c6065991dc9b63720c22b994e6ad7b93 Mon Sep 17 00:00:00 2001 From: amstokely Date: Fri, 12 Dec 2025 14:18:07 -0700 Subject: [PATCH 1/5] Increase default PnetCDF header size to 128 KB This reduces the likelihood of header reallocation as metadata grows. Header reallocation is extremely expensive and can significantly degrade parallel I/O performance. --- src/external/SMIOL/smiol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/external/SMIOL/smiol.c b/src/external/SMIOL/smiol.c index 8a34ed23bb..3248e49bf9 100644 --- a/src/external/SMIOL/smiol.c +++ b/src/external/SMIOL/smiol.c @@ -336,10 +336,12 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, MPI_Comm_free(&io_group_comm); return SMIOL_INVALID_FORMAT; } - + MPI_Info info; + MPI_Info_create(&info); + MPI_Info_set(info, "nc_header_align_size", "131072"); ierr = ncmpi_create(io_file_comm, filename, (filecmode | NC_CLOBBER), - MPI_INFO_NULL, + info, &((*file)->ncidp)); } (*file)->state = PNETCDF_DEFINE_MODE; From c95d83a002862bb35a60f8d10da77f470a7295e4 Mon Sep 17 00:00:00 2001 From: Andy Stokely Date: Thu, 18 Dec 2025 17:04:07 -0700 Subject: [PATCH 2/5] Added call to MPI_Free_Info. --- src/external/SMIOL/smiol.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/external/SMIOL/smiol.c b/src/external/SMIOL/smiol.c index 3248e49bf9..4f5ee9d9c8 100644 --- a/src/external/SMIOL/smiol.c +++ b/src/external/SMIOL/smiol.c @@ -12,6 +12,7 @@ #define PNETCDF_DEFINE_MODE 0 #define PNETCDF_DATA_MODE 1 #define MAX_REQS 256 +#define PNETCDF_HEADER_ALIGN_SIZE_STR "131072" #endif #define START_COUNT_READ 0 @@ -243,6 +244,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, int io_group; MPI_Comm io_file_comm; MPI_Comm io_group_comm; + MPI_Info info = MPI_INFO_NULL; int ierr; @@ -336,13 +338,13 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, MPI_Comm_free(&io_group_comm); return SMIOL_INVALID_FORMAT; } - MPI_Info info; MPI_Info_create(&info); - MPI_Info_set(info, "nc_header_align_size", "131072"); + MPI_Info_set(info, "nc_header_align_size", PNETCDF_HEADER_ALIGN_SIZE_STR); ierr = ncmpi_create(io_file_comm, filename, (filecmode | NC_CLOBBER), info, &((*file)->ncidp)); + MPI_Info_free(&info); } (*file)->state = PNETCDF_DEFINE_MODE; #endif @@ -350,7 +352,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, #ifdef SMIOL_PNETCDF if ((*file)->io_task) { ierr = ncmpi_open(io_file_comm, filename, - NC_WRITE, MPI_INFO_NULL, + NC_WRITE, info, &((*file)->ncidp)); } (*file)->state = PNETCDF_DATA_MODE; @@ -359,7 +361,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, #ifdef SMIOL_PNETCDF if ((*file)->io_task) { ierr = ncmpi_open(io_file_comm, filename, - NC_NOWRITE, MPI_INFO_NULL, + NC_NOWRITE, info, &((*file)->ncidp)); } (*file)->state = PNETCDF_DATA_MODE; From 8ab9e9e2cf13d6ef2692012577a1af6d1a97469d Mon Sep 17 00:00:00 2001 From: Andy Stokely Date: Mon, 29 Dec 2025 12:06:30 -0700 Subject: [PATCH 3/5] Reverted all unnecessary changes to ncmpi_create calls. --- src/external/SMIOL/smiol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/external/SMIOL/smiol.c b/src/external/SMIOL/smiol.c index 4f5ee9d9c8..d94f0c50ce 100644 --- a/src/external/SMIOL/smiol.c +++ b/src/external/SMIOL/smiol.c @@ -352,7 +352,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, #ifdef SMIOL_PNETCDF if ((*file)->io_task) { ierr = ncmpi_open(io_file_comm, filename, - NC_WRITE, info, + NC_WRITE, MPI_INFO_NULL, &((*file)->ncidp)); } (*file)->state = PNETCDF_DATA_MODE; @@ -361,7 +361,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, #ifdef SMIOL_PNETCDF if ((*file)->io_task) { ierr = ncmpi_open(io_file_comm, filename, - NC_NOWRITE, info, + NC_NOWRITE, MPI_INFO_NULL, &((*file)->ncidp)); } (*file)->state = PNETCDF_DATA_MODE; From 8c62019e9c2770f89c601aafc9c608ad72b1e7f7 Mon Sep 17 00:00:00 2001 From: Andy Stokely Date: Mon, 29 Dec 2025 13:08:48 -0700 Subject: [PATCH 4/5] Moved info declaration to the beginning of the #ifdef SMIOL_PNETCDF block. --- src/external/SMIOL/smiol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/external/SMIOL/smiol.c b/src/external/SMIOL/smiol.c index d94f0c50ce..9b48940366 100644 --- a/src/external/SMIOL/smiol.c +++ b/src/external/SMIOL/smiol.c @@ -244,7 +244,6 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, int io_group; MPI_Comm io_file_comm; MPI_Comm io_group_comm; - MPI_Info info = MPI_INFO_NULL; int ierr; @@ -322,6 +321,7 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, if (mode & SMIOL_FILE_CREATE) { #ifdef SMIOL_PNETCDF + MPI_Info info = MPI_INFO_NULL; if ((*file)->io_task) { /* * Convert fformat to a PNetCDF file creation mode From 8535b8fe775a5f374b35b46ccce3da30f8bb62ae Mon Sep 17 00:00:00 2001 From: Andy Stokely Date: Mon, 29 Dec 2025 16:15:52 -0700 Subject: [PATCH 5/5] Fixed inconsistent formatting. --- src/external/SMIOL/smiol.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/external/SMIOL/smiol.c b/src/external/SMIOL/smiol.c index 9b48940366..3efe4b9b5f 100644 --- a/src/external/SMIOL/smiol.c +++ b/src/external/SMIOL/smiol.c @@ -321,11 +321,11 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, if (mode & SMIOL_FILE_CREATE) { #ifdef SMIOL_PNETCDF - MPI_Info info = MPI_INFO_NULL; if ((*file)->io_task) { /* * Convert fformat to a PNetCDF file creation mode */ + MPI_Info info = MPI_INFO_NULL; int filecmode; if (fformat == SMIOL_FORMAT_CDF2) { filecmode = NC_64BIT_OFFSET; @@ -338,8 +338,9 @@ int SMIOL_open_file(struct SMIOL_context *context, const char *filename, MPI_Comm_free(&io_group_comm); return SMIOL_INVALID_FORMAT; } - MPI_Info_create(&info); - MPI_Info_set(info, "nc_header_align_size", PNETCDF_HEADER_ALIGN_SIZE_STR); + MPI_Info_create(&info); + MPI_Info_set(info, "nc_header_align_size", + PNETCDF_HEADER_ALIGN_SIZE_STR); ierr = ncmpi_create(io_file_comm, filename, (filecmode | NC_CLOBBER), info,