On Nov 17, 2009, at 12:25 PM, Ed Hartnett wrote:
Jennifer Adams <jma@xxxxxxxxxxxxx> writes:
I am working with the 4.1 snapshot of 20091102.Â I have been using
nc_inq_libvers() routine to discover the version of the library
linked with my program (GrADS). Now I am testing various configure
options, specifically "--with-chunk-cache-size=n" and
"--with-chunk-cache-nelems=n". Â Is there any way to discover these
parameters from within my program -- something like nc_inq_cache()?
settings for cacheing and chunking are critical for optimizing
when working with compressed netcdf files.Â It would be good if the
could know these settings before setting chunk sizes for creating
compressed netcdf files.Â
Jennifer M. Adams
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
Thanks for asking a question for which there is an easy answer. Some
the recent support issues have been real stumpers!
I'm glad it wasn't too tough, and also that the answer was 'YES'.
There are functions to both set and learn about the chunk
cache. Changing the cache settings only applies to future opens/
it does not affect already-open files.
Let me see if I have understood properly ... The cache parameters are
set on a per-file basis, but copied from global settings at the moment
I open the file? And the original global settings are those used at
These don't tell you what the file was opened/created with, just the
current settings. So if you change them, and want to know what they
for each file you open/create, then you must remember what they were
when the file was opened/created.
What if I open a file, query the chunk and the cache sizes, and
discover that the cache isn't big enough to hold a single chunk and my
I/O is doomed. Do I have to close the file, reset the cache size, then
open the file again?
/* Set the cache size, nelems, and preemption policy. */
nc_set_chunk_cache(size_t size, size_t nelems, float preemption);
/* Get the cache size, nelems, and preemption policy. */
nc_get_chunk_cache(size_t *sizep, size_t *nelemsp, float
Your question makes me note that these functions are not documented. I
am adding them now, and they will be in the snapshot documentation
OK. That will be a big help. Thanks!