mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Merge branch 'master' of https://github.com/Unidata/netcdf-c
This commit is contained in:
commit
1da02adcfa
@ -568,7 +568,6 @@ ENDIF()
|
||||
IF (USE_HDF5 OR ENABLE_NETCDF_4)
|
||||
SET(USE_HDF5 ON)
|
||||
SET(USE_NETCDF4 ON)
|
||||
|
||||
# Accomodate developers who have hdf5 libraries and
|
||||
# headers on their system, but do not have a the hdf
|
||||
# .cmake files. If this is the case, they should
|
||||
@ -576,6 +575,13 @@ IF (USE_HDF5 OR ENABLE_NETCDF_4)
|
||||
IF(HDF5_LIB AND HDF5_HL_LIB AND HDF5_INCLUDE_DIR)
|
||||
SET(HDF5_LIBRARIES ${HDF5_LIB} ${HDF5_HL_LIB})
|
||||
SET(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR})
|
||||
# Find out if HDF5 was built with parallel support.
|
||||
# Do that by checking for the targets H5Pget_fapl_mpiposx and
|
||||
# H5Pget_fapl_mpio in ${HDF5_LIB}.
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_LIB} H5Pget_fapl_mpioposix "" HDF5_IS_PARALLEL)
|
||||
IF(NOT HDF5_IS_PARALLEL)
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_LIB} H5Pget_fapl_mpio "" HDF5_IS_PARALLEL)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
IF(MSVC)
|
||||
FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED)
|
||||
@ -583,7 +589,6 @@ IF (USE_HDF5 OR ENABLE_NETCDF_4)
|
||||
ELSE()
|
||||
FIND_PACKAGE(HDF5 COMPONENTS C HL REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS})
|
||||
@ -730,20 +735,13 @@ SET(STATUS_PARALLEL "OFF")
|
||||
OPTION(ENABLE_PARALLEL "Build netCDF-4 with parallel IO" OFF)
|
||||
IF(ENABLE_PARALLEL AND ENABLE_NETCDF_4)
|
||||
SET(USE_PARALLEL ON CACHE BOOL "")
|
||||
# Check for H5Pget_fapl_mpiposx, define USE_PARALLEL_POSIX
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_LIB} H5Pget_fapl_mpioposix "" USE_PARALLEL_POSIX)
|
||||
|
||||
# Else Check for H5Pget_fapl_mpio, define USE_PARALLEL_MPIO
|
||||
IF(NOT USE_PARALLEL_POSIX)
|
||||
CHECK_LIBRARY_EXISTS(${HDF5_LIB} H5Pget_fapl_mpio "" USE_PARALLEL_MPIO)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT USE_PARALLEL_POSIX AND NOT USE_PARALLEL_MPIO)
|
||||
IF(NOT HDF5_IS_PARALLEL)
|
||||
SET(USE_PARALLEL OFF CACHE BOOL "")
|
||||
MESSAGE(STATUS "Cannot find HDF5 library built with parallel support. Disabling parallel build.")
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(STATUS_PARALLEL "ON")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Options to enable parallel IO, tests.
|
||||
SET(STATUS_PNETCDF "OFF")
|
||||
|
5
cf
5
cf
@ -16,6 +16,8 @@ DAP=1
|
||||
#M32=1
|
||||
#M64=1
|
||||
|
||||
FORCE="-i"
|
||||
|
||||
#INSTALL=1
|
||||
PREFIX=/usr/local
|
||||
|
||||
@ -153,6 +155,7 @@ FLAGS="$FLAGS --disable-examples"
|
||||
#FLAGS="$FLAGS --enable-large-file-tests"
|
||||
#FLAGS="$FLAGS --disable-testsets"
|
||||
#FLAGS="$FLAGS --disable-dap-remote-tests"
|
||||
#FLAGS="$FLAGS --enable-dap-auth-tests"
|
||||
#FLAGS="$FLAGS --enable-doxygen"
|
||||
#FLAGS="$FLAGS --enable-logging"
|
||||
#FLAGS="$FLAGS --disable-diskless"
|
||||
@ -215,6 +218,6 @@ export DISTCHECK_CONFIGURE_FLAGS
|
||||
if test -f Makefile ; then ${MAKE} distclean >/dev/null 2>&1 ; fi
|
||||
sh $X ./configure ${FLAGS}
|
||||
for c in $cmds; do
|
||||
${MAKE} $c
|
||||
${MAKE} ${FORCE} $c
|
||||
done
|
||||
exit 0
|
||||
|
17
configure.ac
17
configure.ac
@ -304,6 +304,22 @@ if test "x$enable_dap" = "xno" ; then
|
||||
fi
|
||||
AC_MSG_RESULT($enable_dap_remote_tests)
|
||||
|
||||
# Default is now to do the remote authorization tests
|
||||
AC_MSG_CHECKING([whether dap remote authorization testing should be enabled (default off)])
|
||||
AC_ARG_ENABLE([dap-auth-test],
|
||||
[AS_HELP_STRING([--enable-dap-auth-tests],
|
||||
[enable dap remote authorization tests])])
|
||||
test "x$enable_dap_auth_tests" = xyes || enable_dap_auth_tests=no
|
||||
# dap must be enabled
|
||||
if test "x$enable_dap" = "xno" ; then
|
||||
enable_dap_auth_tests=no
|
||||
fi
|
||||
# if remote tests are disabled, then so is this
|
||||
if test "x$enable_dap_remote_tests" = "xno" ; then
|
||||
enable_dap_remote_tests=no
|
||||
fi
|
||||
AC_MSG_RESULT($enable_dap_auth_tests)
|
||||
|
||||
# Control if groups are supported in [netcdf4]dap2 code
|
||||
AC_MSG_CHECKING([whether [netcdf4] group names should be enabled (default on)])
|
||||
AC_ARG_ENABLE([dap-groups],
|
||||
@ -811,6 +827,7 @@ AM_CONDITIONAL(TEST_PARALLEL, [test "x$enable_parallel" = xyes -a "x$enable_para
|
||||
AM_CONDITIONAL(BUILD_DAP, [test "x$enable_dap" = xyes])
|
||||
AM_CONDITIONAL(USE_DAP, [test "x$enable_dap" = xyes]) # Alias
|
||||
AM_CONDITIONAL(ENABLE_DAP_REMOTE_TESTS, [test "x$enable_dap_remote_tests" = xyes])
|
||||
AM_CONDITIONAL(ENABLE_DAP_AUTH_TESTS, [test "x$enable_dap_auth_tests" = xyes])
|
||||
AM_CONDITIONAL(ENABLE_DAP_LONG_TESTS, [test "x$enable_dap_long_tests" = xyes])
|
||||
AM_CONDITIONAL(EXTRA_EXAMPLE_TESTS, [test "x$enable_extra_example_tests" = xyes])
|
||||
AM_CONDITIONAL(USE_SZIP, [test "x$ac_cv_func_H5Z_SZIP" = xyes])
|
||||
|
@ -28,6 +28,7 @@ typedef struct NC {
|
||||
char* path;
|
||||
int mode; /* as provided to nc_open/nc_create */
|
||||
int substrate;
|
||||
int refcount; /* To enable multiple name-based opens */
|
||||
} NC;
|
||||
|
||||
/*
|
||||
@ -76,6 +77,7 @@ extern int nc_get_default_format(void);
|
||||
extern int add_to_NCList(NC*);
|
||||
extern void del_from_NCList(NC*);/* does not free object */
|
||||
extern NC* find_in_NCList(int ext_ncid);
|
||||
extern NC* find_in_NCList_by_name(const char*);
|
||||
extern void free_NCList(void);/* reclaim whole list */
|
||||
extern int count_NCList(void); /* return # of entries in NClist */
|
||||
|
||||
|
@ -31,15 +31,10 @@ static struct NCPROTOCOLLIST {
|
||||
against future changes.
|
||||
*/
|
||||
static const char* servers[] = {
|
||||
"http://thredds-test.ucar.edu",
|
||||
"http://thredds.ucar.edu",
|
||||
"http://motherlode.ucar.edu:8081",
|
||||
"http://motherlode.ucar.edu:8080",
|
||||
"http://motherlode.ucar.edu",
|
||||
"http://remotetest.unidata.ucar.edu",
|
||||
"http://thredds-test.unidata.ucar.edu",
|
||||
"http://remotetest.ucar.edu",
|
||||
"http://remotetests.unidata.ucar.edu",
|
||||
"http://remotetests.ucar.edu",
|
||||
"http://thredds-test.ucar.edu",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -1033,6 +1033,11 @@ nc_abort(int ncid)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
|
||||
/* What to do if refcount > 0? */
|
||||
/* currently, forcibly abort */
|
||||
ncp->refcount = 0;
|
||||
|
||||
stat = ncp->dispatch->abort(ncid);
|
||||
del_from_NCList(ncp);
|
||||
free_NC(ncp);
|
||||
@ -1085,10 +1090,15 @@ nc_close(int ncid)
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
|
||||
ncp->refcount--;
|
||||
if(ncp->refcount <= 0)
|
||||
{
|
||||
stat = ncp->dispatch->close(ncid);
|
||||
/* Remove from the nc list */
|
||||
del_from_NCList(ncp);
|
||||
free_NC(ncp);
|
||||
}
|
||||
return stat;
|
||||
}
|
||||
|
||||
@ -1505,6 +1515,11 @@ NC_create(const char *path, int cmode, size_t initialsz,
|
||||
nc_initialized = 1;
|
||||
}
|
||||
|
||||
/* If this path is already open, then fail */
|
||||
ncp = find_in_NCList_by_name(path);
|
||||
if(ncp != NULL)
|
||||
return NC_ENFILE;
|
||||
|
||||
if((isurl = NC_testurl(path)))
|
||||
model = NC_urlmodel(path);
|
||||
|
||||
@ -1636,6 +1651,14 @@ NC_open(const char *path, int cmode,
|
||||
nc_initialized = 1;
|
||||
}
|
||||
|
||||
/* If this path is already open, then bump the refcount and return it */
|
||||
ncp = find_in_NCList_by_name(path);
|
||||
if(ncp != NULL) {
|
||||
ncp->refcount++;
|
||||
if(ncidp) *ncidp = ncp->ext_ncid;
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
isurl = NC_testurl(path);
|
||||
if(isurl)
|
||||
model = NC_urlmodel(path);
|
||||
|
@ -42,6 +42,10 @@ add_to_NCList(NC* ncp)
|
||||
return NC_ENOMEM;
|
||||
numfiles = 0;
|
||||
}
|
||||
/* Check the refcount */
|
||||
if(ncp->refcount > 0)
|
||||
return NC_NOERR;
|
||||
|
||||
new_id = 0; /* id's begin at 1 */
|
||||
for(i=1; i < NCFILELISTLENGTH; i++) {
|
||||
if(nc_filelist[i] == NULL) {new_id = i; break;}
|
||||
@ -60,6 +64,10 @@ del_from_NCList(NC* ncp)
|
||||
unsigned int ncid = ((unsigned int)ncp->ext_ncid) >> ID_SHIFT;
|
||||
if(numfiles == 0 || ncid == 0 || nc_filelist == NULL) return;
|
||||
if(nc_filelist[ncid] != ncp) return;
|
||||
/* Check the refcount */
|
||||
if(ncp->refcount > 0)
|
||||
return; /* assume caller has decrecmented */
|
||||
|
||||
nc_filelist[ncid] = NULL;
|
||||
numfiles--;
|
||||
|
||||
@ -78,3 +86,25 @@ find_in_NCList(int ext_ncid)
|
||||
return f;
|
||||
}
|
||||
|
||||
/*
|
||||
Added to support open by name
|
||||
*/
|
||||
NC*
|
||||
find_in_NCList_by_name(const char* path)
|
||||
{
|
||||
int i;
|
||||
NC* f = NULL;
|
||||
if(nc_filelist == NULL)
|
||||
return NULL;
|
||||
for(i=1; i < NCFILELISTLENGTH; i++) {
|
||||
if(nc_filelist[i] != NULL) {
|
||||
if(strcmp(nc_filelist[i]->path,path)==0) {
|
||||
f = nc_filelist[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,10 +40,16 @@ IF(ENABLE_TESTS)
|
||||
ENDIF()
|
||||
add_bin_test(ncdap test_nstride_cached)
|
||||
add_bin_test(ncdap test_partvar)
|
||||
add_bin_test(ncdap test_varm3)
|
||||
add_bin_test(ncdap t_auth)
|
||||
add_bin_test(ncdap t_misc)
|
||||
|
||||
# test_varm3 did not survive the transition
|
||||
# to remotetest.unidata.ucar.edu; the
|
||||
# coads_climatology.nc file cannot be found.
|
||||
# Can restore if/when we find that file
|
||||
# and put it in testdods directory on remotetest.
|
||||
# add_bin_test(ncdap test_varm3)
|
||||
|
||||
ENDIF()
|
||||
ADD_SUBDIRECTORY(testdata3)
|
||||
ADD_SUBDIRECTORY(expected3)
|
||||
|
@ -34,26 +34,35 @@ endif
|
||||
test_cvt3_SOURCES = test_cvt.c
|
||||
test_vara_SOURCES = test_vara.c
|
||||
test_partvar_SOURCES = test_partvar.c
|
||||
test_varm3_SOURCES = test_varm3.c
|
||||
t_dap3a_SOURCES = t_dap3a.c
|
||||
test_nstride_cached_SOURCE = test_nstride_cached.c
|
||||
t_auth_SOURCES = t_auth.c
|
||||
t_misc_SOURCES = t_misc.c
|
||||
|
||||
TESTS += t_dap3a test_cvt3 test_vara test_partvar
|
||||
TESTS += test_varm3
|
||||
TESTS += t_dap3a
|
||||
TESTS += test_nstride_cached
|
||||
TESTS += t_auth
|
||||
TESTS += t_misc
|
||||
|
||||
check_PROGRAMS += t_dap3a test_cvt3 test_vara test_partvar
|
||||
check_PROGRAMS += test_varm3
|
||||
check_PROGRAMS += t_dap3a
|
||||
check_PROGRAMS += test_nstride_cached
|
||||
check_PROGRAMS += t_auth
|
||||
check_PROGRAMS += t_misc
|
||||
|
||||
# test_varm3 did not survive the transition
|
||||
# to remotetest.unidata.ucar.edu; the
|
||||
# coads_climatology.nc file cannot be found.
|
||||
# Can restore if/when we find that file
|
||||
# and put it in testdods directory on remotetest.
|
||||
# test_varm3_SOURCES = test_varm3.c
|
||||
# check_PROGRAMS += test_varm3
|
||||
# TESTS += test_varm3
|
||||
|
||||
if ENABLE_DAP_AUTH_TESTS
|
||||
check_PROGRAMS += t_auth
|
||||
TESTS += t_auth
|
||||
endif
|
||||
|
||||
endif #ENABLE_DAP_REMOTE_TESTS
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <netcdf.h>
|
||||
|
||||
|
||||
#define URL1 "http://thredds-test.ucar.edu" /* test that no trailing / is ok */
|
||||
#define URL1 "http://remotetest.unidata.ucar.edu" /* test that no trailing / is ok */
|
||||
|
||||
static void
|
||||
CHECK(int e, const char* msg)
|
||||
|
6
ncdump/env
Normal file
6
ncdump/env
Normal file
@ -0,0 +1,6 @@
|
||||
F="tst_small.nc"
|
||||
|
||||
alias q0="./ncdump $F"
|
||||
alias qh="./ncdump -h $F"
|
||||
alias qq="gdb --args ./ncdump $F"
|
||||
alias qqh="gdb --args ./ncdump -h $F"
|
Loading…
Reference in New Issue
Block a user