diff --git a/CMakeLists.txt b/CMakeLists.txt index 813d412029..dae6072f8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -432,18 +432,18 @@ endif() # Format Option checks ################################ -# As a long term goal, and because it is now the case that -# -DNETCDF_ENABLE_NCZARR => USE_NETCDF4, so make the external options -# -DNETCDF_ENABLE-NETCDF-4 and _DNETCDF_ENABLE-NETCDF4 obsolete -# in favor of --NETCDF_ENABLE-HDF5. +# As a long term goal, and because it is now the case that --enable-nczarr +# => USE_NETCDF4, make the external options --enable-netcdf-4 and +# --enable-netcdf4 obsolete in favor of --enable-hdf5 # We will do the following for one more release cycle. -# 1. Make --NETCDF_ENABLE-NETCDF-4 be an alias for --NETCDF_ENABLE-NETCDF4. -# 2. Make --NETCDF_ENABLE-NETCDF4 an alias for --NETCDF_ENABLE-HDF5. -# 3. Internally, convert most (but not all) uses of USE_NETCDF_4 and USE_NETCDF4 to USE_HDF5. +# 1. Make --enable-netcdf-4 be an alias for --enable-netcdf4. +# 2. Make --enable-netcdf4 an alias for --enable-hdf5. +# 3. Internally, convert most uses of USE_NETCDF_4 ad USE_NETCDF4 to USE_HDF5 # Collect the values of -DNETCDF_ENABLE-NETCDF-4, -DNETCDF_ENABLE-NETCDF4, and -DNETCDF_ENABLE-HDF5. +# Also determine which have been explicitly set on the command line. -# Figure out which options are defined and process options +# Figure out which options are defined if(DEFINED NETCDF_ENABLE_NETCDF_4) set(UNDEF_NETCDF_4 OFF CACHE BOOL "") option(NETCDF_ENABLE_NETCDF_4 "" ON) @@ -485,6 +485,9 @@ if(UNDEF_HDF5) set(NETCDF_ENABLE_HDF5 ON CACHE BOOL "" FORCE) endif() +# Turn off enable_netcdf_4 because it is no longer needed +set(NETCDF_ENABLE_NETCDF_4 OFF CACHE BOOL "" FORCE) + # Turn off enable_netcdf4 because it will be used # as a shorthand for ENABLE_HDF5|ENABLE_HDF4|ENABLE_NCZARR set(NETCDF_ENABLE_NETCDF4 OFF CACHE BOOL "" FORCE) @@ -515,6 +518,8 @@ ENDIF() # as a short-hand for this boolean expression if(NETCDF_ENABLE_HDF5 OR NETCDF_ENABLE_HDF4 OR NETCDF_ENABLE_NCZARR) set(NETCDF_ENABLE_NETCDF4 ON CACHE BOOL "Enable netCDF-4 API" FORCE) + # For convenience, define USE_NETCDF4 + set(USE_NETCDF4 ON CACHE BOOL "Enable netCDF-4 API" FORCE) endif() # enable|disable all forms of network access diff --git a/cmake/netcdf_functions_macros.cmake b/cmake/netcdf_functions_macros.cmake index 807f8fb3b4..46b05cc574 100644 --- a/cmake/netcdf_functions_macros.cmake +++ b/cmake/netcdf_functions_macros.cmake @@ -219,7 +219,7 @@ macro(print_conf_summary) message("Configuration Summary:") message("") message(STATUS "Building Shared Libraries: ${BUILD_SHARED_LIBS}") - message(STATUS "Building netCDF-4: ${NETCDF_ENABLE_NETCDF_4}") + message(STATUS "Building netCDF-4: ${NETCDF_ENABLE_NETCDF4}") message(STATUS "Building DAP2 Support: ${NETCDF_ENABLE_DAP2}") message(STATUS "Building DAP4 Support: ${NETCDF_ENABLE_DAP4}") message(STATUS "Building Byte-range Support: ${NETCDF_ENABLE_BYTERANGE}") diff --git a/configure.ac b/configure.ac index c77937311f..4a8fb6c118 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,6 @@ AC_MSG_NOTICE([checking supported formats]) # Collect the values of --enable-netcdf-4, --enable-netcdf4, and --enable-hdf5. # Also determine which have been explicitly set on the command line. - AC_ARG_ENABLE([netcdf-4], [AS_HELP_STRING([--enable-netcdf-4], [(Deprecated) Synonym for --enable-hdf5; default yes])]) AC_ARG_ENABLE([netcdf4], [AS_HELP_STRING([--enable-netcdf4], @@ -2051,6 +2050,7 @@ AC_SUBST(HAS_NC2,[$nc_build_v2]) AC_SUBST(HAS_CDF5,[$enable_cdf5]) AC_SUBST(HAS_HDF4,[$enable_hdf4]) AC_SUBST(HAS_BENCHMARKS,[$enable_benchmarks]) +AC_SUBST(HAS_NC4,[$enable_netcdf4]) AC_SUBST(HAS_HDF5,[$enable_hdf5]) AC_SUBST(HAS_PNETCDF,[$enable_pnetcdf]) AC_SUBST(HAS_LOGGING, [$enable_logging]) diff --git a/libnetcdf.settings.in b/libnetcdf.settings.in index 92226df2dc..98a6cda3c3 100644 --- a/libnetcdf.settings.in +++ b/libnetcdf.settings.in @@ -29,6 +29,7 @@ XML Parser: @XMLPARSER@ -------- Benchmarks: @HAS_BENCHMARKS@ NetCDF-2 API: @HAS_NC2@ +NetCDF-4 API: @HAS_NC4@ HDF4 Support: @HAS_HDF4@ HDF5 Support: @HAS_HDF5@ CDF5 Support: @HAS_CDF5@ diff --git a/nczarr_test/timer_utils.c b/nczarr_test/timer_utils.c deleted file mode 100644 index 0b948b2a96..0000000000 --- a/nczarr_test/timer_utils.c +++ /dev/null @@ -1,170 +0,0 @@ -/********************************************************************* - * Copyright 2020, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - *********************************************************************/ - -#include "config.h" -#include -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_RESOURCE_H -#include -#endif -#ifdef _WIN32 -#include -#endif - -#include "timer_utils.h" - -#undef DEBUG - -static int NCT_initialized = 0; - -#ifdef _WIN32 -LARGE_INTEGER frequency; -LARGE_INTEGER starttime; - -void -NCT_inittimer(void) -{ - if(NCT_initialized) return; -#ifdef DEBUG - fprintf(stderr,"timer mechanism: QueryPerformanceCounter\n"); -#endif - LARGE_INTEGER li; - (void)QueryPerformanceFrequency(&frequency); - QueryPerformanceCounter(&starttime); -#ifdef DEBUG -fprintf(stderr,"frequency=%lld starttime=%lld\n",frequency.QuadPart,starttime.QuadPart); -#endif - NCT_initialized = 1; -} -#else -void -NCT_inittimer(void) -{ - if(NCT_initialized) return; -#ifdef DEBUG -#if defined HAVE_CLOCK_GETTIME - fprintf(stderr,"timer mechanism: clock_gettime\n"); -#elif defined HAVE_GETTIMEOFDAY - fprintf(stderr,"timer mechanism: gettimeofday\n"); -#elif defined HAVE_GETRUSAGE - fprintf(stderr,"timer mechanism: getrusage\n"); -#else - fprintf(stderr,"timer mechanism: Unknown\n"); -#endif -#endif /*DEBUG*/ - NCT_initialized = 1; -} -#endif - -void -NCT_marktime(Nanotime* nt) -{ -#ifdef _WIN32 - LARGE_INTEGER endtime; - QueryPerformanceCounter(&endtime); - nt->tv_sec = endtime.QuadPart / 1000000000; - nt->tv_nsec = endtime.QuadPart % 1000000000; -#ifdef DEBUG -fprintf(stderr,"endtime=%lld\n",endtime.QuadPart); -#endif -#endif - -#ifndef _WIN32 -/* Pick one */ -#ifdef HAVE_CLOCK_GETTIME - clockid_t clk_id = CLOCK_MONOTONIC; - struct timespec t; - clock_gettime(clk_id,&t); - nt->tv_sec = (long long)t.tv_sec; - nt->tv_nsec = (long long)t.tv_nsec; -#elif defined HAVE_GETTIMEOFDAY - struct timeval tp; - gettimeofday(&tp, NULL); - nt->tv_sec = (long long)tp.tv_sec; - nt->tv_nsec = 1000*(long long)tp.tv_usec; -# elif defined HAVE_GETRUSAGE - struct rusage ru; - getrusage(RUSAGE_SELF, &ru); - nt->tv_sec = (long long)(ru.ru_utime.tv_sec + ru.ru_stime.tv_sec); - nt->tv_nsec = (long long)(1000*(ru.ru_utime.tv_usec + ru.ru_stime.tv_usec)); -#endif -#endif -} - -void -NCT_elapsedtime(Nanotime* nt0, Nanotime* nt1, Nanotime* delta) -{ - long long nsec[2]; - long long deltansec; - - nsec[0] = nt0->tv_nsec+(1000000000 * nt0->tv_sec); - nsec[1] = nt1->tv_nsec+(1000000000 * nt1->tv_sec); - - deltansec = nsec[1] - nsec[0]; - delta->tv_nsec = deltansec % 1000000000; - delta->tv_sec = deltansec / 1000000000; -#ifdef DEBUG -fprintf(stderr,"delta=(%lld,%lld)\n",delta->tv_sec,delta->tv_nsec); -#endif -} - -int -NCT_reporttime(unsigned nelems, Nanotime* times, struct TimeRange range, const char* tag) -{ - Nanotime delta; - long long nsec,avg; - double dnsec,dsec,davg; - - NCT_elapsedtime(×[0],×[1],&delta); - nsec = NCT_nanoseconds(delta); - avg = nsec / nelems; -#ifdef DEBUG -fprintf(stderr,"nsec=%lld avg=%lld\n",nsec,avg); -#endif - dnsec = (double)nsec; - dsec = dnsec / 1000000000.0; -#ifdef DEBUG -fprintf(stderr,"dsec=%g dnsec=%g\n",dsec,dnsec); -#endif - davg = (dnsec/nelems); - fprintf(stderr,"\t%s:\t%8.6lf sec",tag,dsec); - fprintf(stderr," avg=%5.2lf nsec\n",davg); -#ifdef DEBUG - fprintf(stderr,"range: min=%lld max=%lld\n",range.min,range.max); -#endif - if(!NCT_rangetest(avg,range)) { - fprintf(stderr,"*** WARNING: unexpectedly large timing values%s\n",tag); - } - return 1; -} - -long long -NCT_nanoseconds(Nanotime time) -{ - return (time.tv_sec * 1000000000) + time.tv_nsec; -} - -/* Provide a time range tester */ -int -NCT_rangetest(long long nsec, struct TimeRange range) -{ - if(nsec < range.min) { - fprintf(stderr,"range: time=%lld < min=%lld\n",nsec,range.min); - return 0; - } - if(nsec > range.max) { - fprintf(stderr,"range: time=%lld > max=%lld\n",nsec,range.max); - return 0; - } - return 1; -} diff --git a/nczarr_test/timer_utils.h b/nczarr_test/timer_utils.h deleted file mode 100644 index 13869a2204..0000000000 --- a/nczarr_test/timer_utils.h +++ /dev/null @@ -1,30 +0,0 @@ -/********************************************************************* - * Copyright 2020, UCAR/Unidata - * See netcdf/COPYRIGHT file for copying and redistribution conditions. - *********************************************************************/ - -#ifndef TIMER_UTILS_H -#define TIMER_UTILS_H 1 - -#include "netcdf.h" - -/* Wrap time interval computations */ -typedef struct Nanotime { - long long tv_sec; /* seconds */ - long long tv_nsec; /* nanoseconds */ -} Nanotime; - - -struct TimeRange { - long long min; - long long max; -}; - -extern void NCT_inittimer(void); -extern void NCT_marktime(Nanotime* nt); -extern void NCT_elapsedtime(Nanotime* nt0, Nanotime* nt1, Nanotime* delta); -extern int NCT_reporttime(unsigned count, Nanotime* times, struct TimeRange, const char* tag); -extern long long NCT_nanoseconds(Nanotime time); -extern int NCT_rangetest(long long nsecs, struct TimeRange range); -#endif /*TIMER_UTILS_H*/ -