Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

NetCDF-4 compression performance

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

RCarpenter

Member
I am finding that writing compressed netCDF-4 causes WRF to run significantly slower than if uncompressed output is written. For a 3-grid run with I/O quilting, there's about a 33% performance hit. Are other users finding similar performance issues?

The comparison was with two executables, compiled with and without netCDF-4 compression. The version without compression was inadvertently created because we did not add $NETCDF/bin to the path, and configure could not find nf-config. (In the future, perhaps configure could be modified to try $NETCDF/bin/nf-config, even if $NETCDF/bin is not in $PATH ?)

Finally, I tried setting use_netcdf_classic = .true. in the namelist to turn off compression, but it had no impact. Perhaps that is a feature that used to work or is no longer supported?

Thanks.
 
Two issues.

First, namelist option not working.

When I build the WRF model with NetCDF4 with HDF5, by default, the compression is on. The file sizes are not identical:
Code:
> ls -ls wrfo*
5960 -rw-r--r-- 1 root root 5194684 Jul 28 16:33 wrfout_d01_2000-01-24_12:00:00
6164 -rw-r--r-- 1 root root 6310746 Jul 28 16:33 wrfout_d01_2000-01-24_12:06:00
7184 -rw-r--r-- 1 root root 6339419 Jul 28 16:33 wrfout_d01_2000-01-24_12:12:00
6808 -rw-r--r-- 1 root root 6370548 Jul 28 16:33 wrfout_d01_2000-01-24_12:18:00
7096 -rw-r--r-- 1 root root 6410382 Jul 28 16:33 wrfout_d01_2000-01-24_12:24:00
6528 -rw-r--r-- 1 root root 6460701 Jul 28 16:33 wrfout_d01_2000-01-24_12:30:00
7520 -rw-r--r-- 1 root root 6654162 Jul 28 16:33 wrfout_d01_2000-01-24_12:36:00
7372 -rw-r--r-- 1 root root 6701278 Jul 28 16:33 wrfout_d01_2000-01-24_12:42:00
7000 -rw-r--r-- 1 root root 6749087 Jul 28 16:33 wrfout_d01_2000-01-24_12:48:00
7580 -rw-r--r-- 1 root root 6780716 Jul 28 16:33 wrfout_d01_2000-01-24_12:54:00
6644 -rw-r--r-- 1 root root 6803360 Jul 28 16:34 wrfout_d01_2000-01-24_13:00:00

> ncdump -k wrfout_d01_2000-01-24_12:00:00
netCDF-4

With the namelist.input modified with:
Code:
 &time_control
 use_netcdf_classic = t
 /

Here are the file sizes, all the same size:
Code:
> ls -ls wrfo*
14992 -rw-r--r-- 1 root root 14532520 Jul 28 16:27 wrfout_d01_2000-01-24_12:00:00
15008 -rw-r--r-- 1 root root 14532520 Jul 28 16:27 wrfout_d01_2000-01-24_12:06:00
14928 -rw-r--r-- 1 root root 14532520 Jul 28 16:27 wrfout_d01_2000-01-24_12:12:00
14272 -rw-r--r-- 1 root root 14532520 Jul 28 16:27 wrfout_d01_2000-01-24_12:18:00
14488 -rw-r--r-- 1 root root 14532520 Jul 28 16:28 wrfout_d01_2000-01-24_12:24:00
14272 -rw-r--r-- 1 root root 14532520 Jul 28 16:28 wrfout_d01_2000-01-24_12:30:00
14792 -rw-r--r-- 1 root root 14532520 Jul 28 16:28 wrfout_d01_2000-01-24_12:36:00
14520 -rw-r--r-- 1 root root 14532520 Jul 28 16:28 wrfout_d01_2000-01-24_12:42:00

> ncdump -k wrfout_d01_2000-01-24_12:00:00
64-bit offset

Issue #2, performance.

Absolutely, the compression absorbs computational time. The complete timing picture for I/O also includes the file system. I have definitely seen NetCDF4 with compression taking longer than straight NetCDF3 classic data files. Part of the idea of compression is that if the files are smaller, they take less time to write. In practice, this is not generally true.

There are counter examples. For a small case on my laptop, the NetCDF4 with compression actually took less time to output.

Code:
> cat net3
Timing for Writing wrfout_d01_2000-01-24_12:00:00 for domain        1:    2.60860 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:06:00 for domain        1:    2.30742 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:12:00 for domain        1:    2.31848 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:18:00 for domain        1:    1.81126 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:24:00 for domain        1:    2.11513 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:30:00 for domain        1:    2.34048 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:36:00 for domain        1:    1.79788 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:42:00 for domain        1:    1.91877 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:48:00 for domain        1:    1.86319 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:54:00 for domain        1:    2.57664 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_13:00:00 for domain        1:    2.78638 elapsed seconds

> cat net4
Timing for Writing wrfout_d01_2000-01-24_12:00:00 for domain        1:    1.00200 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:06:00 for domain        1:    1.01946 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:12:00 for domain        1:    1.10894 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:18:00 for domain        1:    1.17046 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:24:00 for domain        1:    1.23453 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:30:00 for domain        1:    1.21980 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:36:00 for domain        1:    1.20205 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:42:00 for domain        1:    1.11224 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:48:00 for domain        1:    1.12418 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_12:54:00 for domain        1:    1.21907 elapsed seconds
Timing for Writing wrfout_d01_2000-01-24_13:00:00 for domain        1:    1.27355 elapsed seconds
 
Top