From d840bc71609721bf12759ec0bb95eb3f93230f25 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Sat, 2 Dec 2017 06:52:13 -0700 Subject: [PATCH] starting adding testing for _int() functions for caching --- nc_test4/tst_vars.c | 2 +- nc_test4/tst_vars2.c | 26 ++++++++++++++++++++++++++ nc_test4/tst_vars3.c | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/nc_test4/tst_vars.c b/nc_test4/tst_vars.c index b865e824b..70883d465 100644 --- a/nc_test4/tst_vars.c +++ b/nc_test4/tst_vars.c @@ -3,7 +3,7 @@ See COPYRIGHT file for conditions of use. Test netcdf-4 variables. - Ed Hartnett + Ed Hartnett, Ward Fisher */ #include "nc_tests.h" diff --git a/nc_test4/tst_vars2.c b/nc_test4/tst_vars2.c index 7c0704f91..06e637668 100644 --- a/nc_test4/tst_vars2.c +++ b/nc_test4/tst_vars2.c @@ -9,6 +9,7 @@ #include #include "err_macros.h" #include "netcdf.h" +#include "netcdf_f.h" #define FILE_NAME "tst_vars2.nc" #define NUM_DIMS 1 @@ -717,6 +718,9 @@ main(int argc, char **argv) #define CACHE_SIZE 32000000 #define CACHE_NELEMS 1009 #define CACHE_PREEMPTION .75 +#define CACHE_SIZE2 64000000 +#define CACHE_NELEMS2 2000 +#define CACHE_PREEMPTION2 .50 int dimids[NDIMS5], dimids_in[NDIMS5]; int varid; @@ -730,6 +734,8 @@ main(int argc, char **argv) int storage_in; size_t cache_size_in, cache_nelems_in; float cache_preemption_in; + int cache_size_int_in, cache_nelems_int_in; + int cache_preemption_int_in; int i, d; for (i = 0; i < DIM5_LEN; i++) @@ -809,6 +815,16 @@ main(int argc, char **argv) cache_preemption_in != CACHE_PREEMPTION) ERR; /* THis should also work, pointlessly. */ if (nc_get_var_chunk_cache(ncid, varid, NULL, NULL, NULL)) ERR; + + /* Check the _int version of this function, used by the F77 API. */ + if (nc_get_var_chunk_cache_ints(ncid, varid, &cache_size_int_in, &cache_nelems_int_in, + &cache_preemption_int_in)) ERR; + if (cache_size_int_in != CACHE_SIZE / MEGABYTE) ERR; + if (cache_nelems_int_in != CACHE_NELEMS) ERR; + if (cache_preemption_int_in != (int)(CACHE_PREEMPTION * 100)) ERR; + /* THis should also work, pointlessly. */ + if (nc_get_var_chunk_cache_ints(ncid, varid, NULL, NULL, NULL)) ERR; + if (nc_close(ncid)) ERR; /* Open the file and check the same stuff. */ @@ -832,6 +848,16 @@ main(int argc, char **argv) for (i = 0; i < DIM5_LEN; i++) if (data[i] != data_in[i]) ERR_RET; + + /* Use the _int function to change the var chunk cache settings. */ + if (nc_set_var_chunk_cache_ints(ncid, varid, CACHE_SIZE2 / MEGABYTE, CACHE_NELEMS2, + (int)(CACHE_PREEMPTION2 * 100))) ERR; + if (nc_get_var_chunk_cache_ints(ncid, varid, &cache_size_int_in, &cache_nelems_int_in, + &cache_preemption_int_in)) ERR; + if (cache_size_int_in != CACHE_SIZE2 / MEGABYTE) ERR; + if (cache_nelems_int_in != CACHE_NELEMS2) ERR; + if (cache_preemption_int_in != (int)(CACHE_PREEMPTION2 * 100)) ERR; + if (nc_close(ncid)) ERR; } diff --git a/nc_test4/tst_vars3.c b/nc_test4/tst_vars3.c index 83957f298..b6a0d3882 100644 --- a/nc_test4/tst_vars3.c +++ b/nc_test4/tst_vars3.c @@ -3,7 +3,7 @@ See COPYRIGHT file for conditions of use. Test netcdf-4 variables. - $Id: tst_vars3.c,v 1.29 2010/04/30 18:21:52 ed Exp $ + Ed Hartnett, Russ Rew, Dennis Heimbigner, Ward Fisher */ #include