Skip to content

Commit 7032b57

Browse files
committed
bug fix: inq_malloc may not be enabled at configure time
1 parent 8051f53 commit 7032b57

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

benchmarks/WRF-IO/wrf_io.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2146,11 +2146,14 @@ int wrf_io_benchmark(char *filename,
21462146
free(vars[i].buf);
21472147
free(vars);
21482148
}
2149+
if (err != NC_NOERR) return err;
21492150

21502151
/* check if there is any PnetCDF internal malloc residue */
21512152
MPI_Offset malloc_size, sum_size;
21522153
err = ncmpi_inq_malloc_size(&malloc_size);
2153-
if (err == NC_NOERR) {
2154+
if (err == NC_ENOTENABLED) /* --enable-profiling is not set at configure */
2155+
return NC_NOERR;
2156+
else if (err == NC_NOERR) {
21542157
MPI_Reduce(&malloc_size, &sum_size, 1, MPI_OFFSET, MPI_SUM, 0, MPI_COMM_WORLD);
21552158
if (rank == 0 && sum_size > 0)
21562159
printf("heap memory allocated by PnetCDF internally has %lld bytes yet to be freed\n",

0 commit comments

Comments
 (0)