From bc5abe766e78c0d649a0fbf2d2e1175717a4ca17 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Wed, 23 Feb 2011 17:37:11 +0000 Subject: [PATCH] fixed opendap perf. bug for nc_get_vars --- RELEASE_NOTES | 3 + libcdmr/nccrdispatch.c | 5 ++ libdispatch/ncdispatch.h | 20 +++++ libdispatch/var.c | 146 +++++++++++++++++++++++++++------ libncdap3/env | 2 +- libncdap3/ncd3dispatch.c | 35 +++++++- libncdap4/ncd4dispatch.c | 5 ++ libsrc/nc3dispatch.c | 5 ++ libsrc4/nc4dispatch.c | 4 + udunits/failure.texi | 10 --- udunits/make.texi | 25 ------ udunits/prog/udunits2prog.info | Bin 7177 -> 7165 bytes udunits/success.texi | 66 --------------- udunits/test/results.tab | 76 ----------------- udunits/texinfo.tex | 26 +++--- 15 files changed, 211 insertions(+), 217 deletions(-) diff --git a/RELEASE_NOTES b/RELEASE_NOTES index ed34080c4..efbb684e1 100644 --- a/RELEASE_NOTES +++ b/RELEASE_NOTES @@ -5,6 +5,9 @@ VERSION COMMENTS ------- -------- 4.1.2-beta3 2011-02-11 + Fixed opendap performance bug for nc_get_vars; required + adding nc_get_var{s,m} to the dispatch table. + Now check for libz in configure.ac. Fixed some bugs and some performance problems with diff --git a/libcdmr/nccrdispatch.c b/libcdmr/nccrdispatch.c index ec8edde0c..9b5a1287e 100755 --- a/libcdmr/nccrdispatch.c +++ b/libcdmr/nccrdispatch.c @@ -67,6 +67,11 @@ NULL, /*inq_varid*/ NULL, /*rename_var*/ NCCR_get_vara, NCCR_put_vara, +NULL, /*get_vars*/ +NULL, /*put_vars*/ +NULL, /*get_varm*/ +NULL, /*put_varm*/ + NULL, /*inq_var_all*/ #ifdef USE_NETCDF4 diff --git a/libdispatch/ncdispatch.h b/libdispatch/ncdispatch.h index e3c04d367..826ccbcba 100755 --- a/libdispatch/ncdispatch.h +++ b/libdispatch/ncdispatch.h @@ -175,6 +175,18 @@ int NC_open(const char *path, int cmode, int useparallel, void* mpi_info, int *ncidp); +/* Expose the default vars and varm dispatch entries */ +extern int NCDEFAULT_get_vars(int, int, const size_t*, + const size_t*, const ptrdiff_t*, void*, nc_type); +extern int NCDEFAULT_put_vars(int, int, const size_t*, + const size_t*, const ptrdiff_t*, const void*, nc_type); +extern int NCDEFAULT_get_varm(int, int, const size_t*, + const size_t*, const ptrdiff_t*, const ptrdiff_t*, + void*, nc_type); +extern int NCDEFAULT_put_varm(int, int, const size_t*, + const size_t*, const ptrdiff_t*, const ptrdiff_t*, + const void*, nc_type); + /**************************************************/ /* Forward */ struct NCHDR; @@ -232,6 +244,14 @@ int (*rename_var)(int, int, const char*); int (*get_vara)(int, int, const size_t*, const size_t*, void*, nc_type); int (*put_vara)(int, int, const size_t*, const size_t*, const void*, nc_type); +/* Added to solve Ferret performance problem with Opendap */ +int (*get_vars)(int, int, const size_t*, const size_t*, const ptrdiff_t*, void*, nc_type); +int (*put_vars)(int, int, const size_t*, const size_t*, const ptrdiff_t*, const void*, nc_type); + +int (*get_varm)(int, int, const size_t*, const size_t*, const ptrdiff_t*, const ptrdiff_t*, void*, nc_type); +int (*put_varm)(int, int, const size_t*, const size_t*, const ptrdiff_t*, const ptrdiff_t*, const void*, nc_type); + + int (*inq_var_all)(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp, int *shufflep, int *deflatep, int *deflate_levelp, diff --git a/libdispatch/var.c b/libdispatch/var.c index 4326a36f1..929d0a667 100644 --- a/libdispatch/var.c +++ b/libdispatch/var.c @@ -23,6 +23,8 @@ static size_t coord_one[NC_MAX_VAR_DIMS]; static nc_type longtype = (sizeof(long) == sizeof(int) ? NC_INT : NC_INT64); +#define MINVARSSPACE 1024; + static int getshape(int ncid, int varid, int ndims, size_t* shape) { @@ -129,7 +131,7 @@ nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } -int +static int NC_put_vara(int ncid, int varid, const size_t *start, const size_t *edges, const void *value, nc_type memtype) { @@ -171,7 +173,7 @@ NC_get_vara(int ncid, int varid, return ncp->dispatch->get_vara(ncid,varid,start,edges,value,memtype); } -int +static int NC_get_var(int ncid, int varid, void *value, nc_type memtype) { int ndims; @@ -183,7 +185,7 @@ NC_get_var(int ncid, int varid, void *value, nc_type memtype) return NC_get_vara(ncid, varid, coord_zero, shape, value, memtype); } -int +static int NC_put_var(int ncid, int varid, const void *value, nc_type memtype) { int ndims; @@ -195,7 +197,7 @@ NC_put_var(int ncid, int varid, const void *value, nc_type memtype) return NC_put_vara(ncid, varid, coord_zero, shape, value, memtype); } -int +static int NC_get_var1(int ncid, int varid, const size_t *coord, void* value, nc_type memtype) { @@ -203,7 +205,7 @@ NC_get_var1(int ncid, int varid, const size_t *coord, void* value, return NC_get_vara(ncid, varid, coord, coord_one, value, memtype); } -int +static int NC_put_var1(int ncid, int varid, const size_t *coord, const void* value, nc_type memtype) { @@ -231,8 +233,33 @@ is_recvar(int ncid, int varid, size_t* nrecs) return (dimset[0] == unlimid ? 1: 0); } -static int -NC_get_varm(int ncid, int varid, const size_t *start, +/* Most dispatch tables will use the default procedures */ +int +NCDEFAULT_get_vars(int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + void *value, nc_type memtype) +{ + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + + if(stat != NC_NOERR) return stat; + return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,NULL,value,memtype); +} + +int +NCDEFAULT_put_vars(int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + const void *value, nc_type memtype) +{ + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + + if(stat != NC_NOERR) return stat; + return ncp->dispatch->put_varm(ncid,varid,start,edges,stride,NULL,value,memtype); +} + +int +NCDEFAULT_get_varm(int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t *imapp, void *value0, nc_type memtype) { @@ -253,6 +280,9 @@ NC_get_varm(int ncid, int varid, const size_t *start, status = nc_inq_vartype(ncid, varid, &vartype); if(status != NC_NOERR) return status; + /* Check that this is an atomic type */ + if(vartype >= NC_MAX_ATOMIC_TYPE) + return NC_EMAPTYPE; status = nc_inq_varndims(ncid, varid, &varndims); if(status != NC_NOERR) return status; @@ -482,8 +512,8 @@ NC_get_varm(int ncid, int varid, const size_t *start, } -static int -NC_put_varm( +int +NCDEFAULT_put_varm( int ncid, int varid, const size_t * start, @@ -512,6 +542,9 @@ NC_put_varm( /* mid body */ status = nc_inq_vartype(ncid, varid, &vartype); if(status != NC_NOERR) return status; + /* Check that this is an atomic type */ + if(vartype >= NC_MAX_ATOMIC_TYPE) + return NC_EMAPTYPE; status = nc_inq_varndims(ncid, varid, &varndims); if(status != NC_NOERR) return status; @@ -714,22 +747,66 @@ NC_put_varm( return status; } -int +/* Called by externally visible nc_get_vars_xxx routines */ +static int NC_get_vars(int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, void *value, nc_type memtype) { - return NC_get_varm(ncid, varid, start, edges, stride, NULL, - value, memtype); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + + if(stat != NC_NOERR) return stat; +#ifdef USE_NETCDF4 + if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT; +#endif + return ncp->dispatch->get_vars(ncid,varid,start,edges,stride,value,memtype); } -int +static int NC_put_vars(int ncid, int varid, const size_t *start, const size_t *edges, const ptrdiff_t *stride, const void *value, nc_type memtype) { - return NC_put_varm(ncid, varid, start, edges, - stride, NULL, value, memtype); + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + + if(stat != NC_NOERR) return stat; +#ifdef USE_NETCDF4 + if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT; +#endif + return ncp->dispatch->put_vars(ncid,varid,start,edges,stride,value,memtype); +} + +/* Called by externally visible nc_get_vars_xxx routines */ +static int +NC_get_varm(int ncid, int varid, const size_t *start, + const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map, + void *value, nc_type memtype) +{ + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + + if(stat != NC_NOERR) return stat; +#ifdef USE_NETCDF4 + if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT; +#endif + return ncp->dispatch->get_varm(ncid,varid,start,edges,stride,map,value,memtype); +} + +static int +NC_put_varm(int ncid, int varid, const size_t *start, + const size_t *edges, const ptrdiff_t *stride, const ptrdiff_t* map, + const void *value, nc_type memtype) +{ + NC* ncp; + int stat = NC_check_id(ncid, &ncp); + + if(stat != NC_NOERR) return stat; +#ifdef USE_NETCDF4 + if(memtype >= NC_FIRSTUSERTYPEID) memtype = NC_NAT; +#endif + return ncp->dispatch->put_varm(ncid,varid,start,edges,stride,map,value,memtype); } /* Ok to use NC pointers because @@ -892,7 +969,12 @@ nc_get_varm(int ncid, int varid, const size_t * start, const size_t * edges, const ptrdiff_t * stride, const ptrdiff_t * imapp, void *value) { - return NC_get_varm(ncid, varid, start, edges, stride, imapp, + NC* ncp; + int stat; + + if ((stat = NC_check_id(ncid, &ncp))) + return stat; + return ncp->dispatch->get_varm(ncid, varid, start, edges, stride, imapp, value, NC_NAT); } @@ -901,17 +983,27 @@ nc_put_varm (int ncid, int varid, const size_t * start, const size_t * edges, const ptrdiff_t * stride, const ptrdiff_t * imapp, const void *value) { - return NC_put_varm(ncid, varid, start, edges, stride, imapp, + NC* ncp; + int stat; + + if ((stat = NC_check_id(ncid, &ncp))) + return stat; + return ncp->dispatch->put_varm(ncid, varid, start, edges, stride, imapp, value, NC_NAT); } int -nc_get_vars(int ncid, int varid, const size_t * start, - const size_t * edges, const ptrdiff_t * stride, - void *value) +nc_get_vars (int ncid, int varid, const size_t * start, + const size_t * edges, const ptrdiff_t * stride, + void *value) { - return nc_get_varm(ncid, varid, start, edges, - stride, NULL, value); + NC* ncp; + int stat; + + if ((stat = NC_check_id(ncid, &ncp))) + return stat; + return ncp->dispatch->get_vars(ncid, varid, start, edges, stride, + value, NC_NAT); } int @@ -919,9 +1011,15 @@ nc_put_vars (int ncid, int varid, const size_t * start, const size_t * edges, const ptrdiff_t * stride, const void *value) { - return nc_put_varm(ncid, varid, start, edges, - stride, NULL, value); + NC* ncp; + int stat; + + if ((stat = NC_check_id(ncid, &ncp))) + return stat; + return ncp->dispatch->put_vars(ncid, varid, start, edges, stride, + value, NC_NAT); } + int nc_get_var1_text(int ncid, int varid, const size_t *coord, char *value) { diff --git a/libncdap3/env b/libncdap3/env index 9d34b95c4..055a17fe7 100644 --- a/libncdap3/env +++ b/libncdap3/env @@ -2,7 +2,7 @@ set PARMS=""; set ARGS=""; set CON="" ; set CE=""; set OCON="" set PARMS="[log]" set F="http://nomads.ncdc.noaa.gov:80/dods/SEAWINDS/clm/uvclm95to05" -set CON="time[1:2]" +set CON="time[1:2:11]" if (1 == 0) then set F="file:///home/dmh/nc/oc/dataset-duacs-nrt-over30d-global-merged-madt-h" set F="http://oceanwatch.pfeg.noaa.gov/opendap/GLOBEC/GLOBEC_cetaceans" diff --git a/libncdap3/ncd3dispatch.c b/libncdap3/ncd3dispatch.c index c7d1d89b5..571786f94 100755 --- a/libncdap3/ncd3dispatch.c +++ b/libncdap3/ncd3dispatch.c @@ -23,6 +23,7 @@ static int NCD3_redef(int ncid); static int NCD3__enddef(int ncid, size_t h_minfree, size_t v_align, size_t v_minfree, size_t r_align); static int NCD3_sync(int ncid); static int NCD3_abort(int ncid); + static int NCD3_put_vara(int ncid, int varid, const size_t *start, const size_t *edges0, const void *value0, @@ -33,6 +34,14 @@ static int NCD3_get_vara(int ncid, int varid, void *value, nc_type memtype); +static int NCD3_put_vars(int ncid, int varid, + const size_t *start, const size_t *edges, const ptrdiff_t* stride, + const void *value0, nc_type memtype); + +static int NCD3_get_vars(int ncid, int varid, + const size_t *start, const size_t *edges, const ptrdiff_t* stride, + void *value, nc_type memtype); + ptrdiff_t dapsinglestride3[NC_MAX_VAR_DIMS]; size_t dapzerostart3[NC_MAX_VAR_DIMS]; size_t dapsinglecount3[NC_MAX_VAR_DIMS]; @@ -78,6 +87,11 @@ NULL, /*inq_varid*/ NULL, /*rename_var*/ NCD3_get_vara, NCD3_put_vara, +NCD3_get_vars, +NCD3_put_vars, +NULL, /*get_varm*/ +NULL, /*put_varm*/ + NULL, /*inq_var_all*/ #ifdef USE_NETCDF4 @@ -173,8 +187,8 @@ NCD3_create(const char *path, int cmode, static int NCD3_put_vara(int ncid, int varid, - const size_t *start, const size_t *edges0, - const void *value0, + const size_t *start, const size_t *edges, + const void *value, nc_type memtype) { return NC_EPERM; @@ -189,3 +203,20 @@ NCD3_get_vara(int ncid, int varid, int stat = nc3d_getvarx(ncid, varid, start, edges, dapsinglestride3,value,memtype); return stat; } + +static int +NCD3_put_vars(int ncid, int varid, + const size_t *start, const size_t *edges, const ptrdiff_t* stride, + const void *value0, nc_type memtype) +{ + return NC_EPERM; +} + +static int +NCD3_get_vars(int ncid, int varid, + const size_t *start, const size_t *edges, const ptrdiff_t* stride, + void *value, nc_type memtype) +{ + int stat = nc3d_getvarx(ncid, varid, start, edges, stride, value, memtype); + return stat; +} diff --git a/libncdap4/ncd4dispatch.c b/libncdap4/ncd4dispatch.c index fd75843f7..e07b3bef5 100755 --- a/libncdap4/ncd4dispatch.c +++ b/libncdap4/ncd4dispatch.c @@ -71,6 +71,11 @@ NULL, /*inq_varid*/ NULL, /*rename_var*/ NCD4_get_vara, NCD4_put_vara, +NULL, /*get_vars*/ +NULL, /*put_vars*/ +NULL, /*get_varm*/ +NULL, /*put_varm*/ + NULL, /*inq_var_all*/ #ifdef USE_NETCDF4 diff --git a/libsrc/nc3dispatch.c b/libsrc/nc3dispatch.c index bd7924410..2f909cccb 100755 --- a/libsrc/nc3dispatch.c +++ b/libsrc/nc3dispatch.c @@ -117,6 +117,11 @@ NC3_inq_varid, NC3_rename_var, NC3_get_vara, NC3_put_vara, +NCDEFAULT_get_vars, +NCDEFAULT_put_vars, +NCDEFAULT_get_varm, +NCDEFAULT_put_varm, + NC3_inq_var_all, #ifdef USE_NETCDF4 diff --git a/libsrc4/nc4dispatch.c b/libsrc4/nc4dispatch.c index 633e54294..ba10ce8c8 100755 --- a/libsrc4/nc4dispatch.c +++ b/libsrc4/nc4dispatch.c @@ -50,6 +50,10 @@ NC4_inq_varid, NC4_rename_var, NC4_get_vara, NC4_put_vara, +NCDEFAULT_get_vars, +NCDEFAULT_put_vars, +NCDEFAULT_get_varm, +NCDEFAULT_put_varm, NC4_inq_var_all, diff --git a/udunits/failure.texi b/udunits/failure.texi index b0dc57fa4..8c76069b6 100644 --- a/udunits/failure.texi +++ b/udunits/failure.texi @@ -1,13 +1,3 @@ @multitable {@code{Linux 2.6.18-1.2257.fc5smp}} {@code{/opt/SUNWspro/bin/c99}} {@code{--disable-shared}} @headitem O/S @tab Compiler @tab @code{configure} Option -@item @code{Darwin 10.3.0} @tab @code{/usr/bin/c89} @tab @code{} -@item @code{Darwin 8.11.0} @tab @code{/usr/bin/c89} @tab @code{} -@item @code{HP-UX B.11.00} @tab @code{/bin/c89} @tab @code{} -@item @code{HP-UX B.11.00} @tab @code{/bin/cc} @tab @code{} -@item @code{HP-UX B.11.00} @tab @code{/usr/ccs/bin/cc} @tab @code{} -@item @code{HP-UX B.11.00} @tab @code{/usr/ccs/bin/cc} @tab @code{--disable-shared} -@item @code{SunOS 5.10} @tab @code{/opt/SUNWspro/bin/c99} @tab @code{} -@item @code{SunOS 5.10} @tab @code{/opt/SUNWspro/bin/c99} @tab @code{--disable-shared} -@item @code{SunOS 5.9} @tab @code{/opt/SUNWspro/bin/c99} @tab @code{} -@item @code{SunOS 5.9} @tab @code{/opt/SUNWspro/bin/c99} @tab @code{--disable-shared} @end multitable diff --git a/udunits/make.texi b/udunits/make.texi index b8b4912a9..f1687c33c 100644 --- a/udunits/make.texi +++ b/udunits/make.texi @@ -1,28 +1,3 @@ @multitable {@code{Linux 2.6.18-1.2257.fc5smp}} {@code{/usr/bin/posix/make}} @headitem O/S @tab @code{make} Utility -@item @code{AIX 1 5} @tab @code{/bin/make} -@item @code{AIX 1 5} @tab @code{/opt/gnu/bin/make} -@item @code{AIX 1 5} @tab @code{/usr/ccs/bin/make} -@item @code{Darwin 10.3.0} @tab @code{/usr/bin/gnumake} -@item @code{Darwin 10.3.0} @tab @code{/usr/bin/make} -@item @code{Darwin 8.11.0} @tab @code{/usr/bin/gnumake} -@item @code{Darwin 8.11.0} @tab @code{/usr/bin/make} -@item @code{HP-UX B.11.00} @tab @code{/bin/make} -@item @code{HP-UX B.11.00} @tab @code{/opt/gnu/bin/make} -@item @code{IRIX64 6.5} @tab @code{/bin/make} -@item @code{IRIX64 6.5} @tab @code{/opt/gnu/bin/make} -@item @code{Linux 2.6.27.41-170.2.117.fc10.x86_64} @tab @code{/usr/bin/gmake} -@item @code{Linux 2.6.27.41-170.2.117.fc10.x86_64} @tab @code{/usr/bin/make} -@item @code{Linux 2.6.32.11-99.fc12.x86_64} @tab @code{/usr/bin/gmake} -@item @code{Linux 2.6.32.11-99.fc12.x86_64} @tab @code{/usr/bin/make} -@item @code{OSF1 V5.1} @tab @code{/bin/make} -@item @code{OSF1 V5.1} @tab @code{/opt/gnu/bin/gmake} -@item @code{OSF1 V5.1} @tab @code{/usr/bin/posix/make} -@item @code{OSF1 V5.1} @tab @code{/usr/ccs/bin/make} -@item @code{SunOS 5.10} @tab @code{/opt/csw/bin/gmake} -@item @code{SunOS 5.10} @tab @code{/usr/ccs/bin/make} -@item @code{SunOS 5.10} @tab @code{/usr/xpg4/bin/make} -@item @code{SunOS 5.9} @tab @code{/opt/gnu/bin/gmake} -@item @code{SunOS 5.9} @tab @code{/usr/ccs/bin/make} -@item @code{SunOS 5.9} @tab @code{/usr/xpg4/bin/make} @end multitable diff --git a/udunits/prog/udunits2prog.info b/udunits/prog/udunits2prog.info index 81528bcb1a7b8429a8f6a2c8836d74939162ac07..e9304c845b2911b84ec365c4459fdfaf73abea69 100644 GIT binary patch delta 147 zcmeCQ_-j7Fn$dWo&Bn=JIrJD6Hmh(hVcUF+U6T>cPZJ8UFyZpcPf4{>2(HY_FDT9| zt~W6