Skip to content

Commit

Permalink
Merge branch 'master' into cleanncgen.dmh
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF authored May 17, 2018
2 parents c9d1589 + 5bd8992 commit 61a6c0c
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 190 deletions.
13 changes: 5 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,6 @@ OPTION(ENABLE_MMAP "Use MMAP." ON)
# Option to use examples.
OPTION(ENABLE_EXAMPLES "Build Examples" ON)

# Option to use Diskless
OPTION(ENABLE_DISKLESS "Build Diskless." ON)
IF(ENABLE_DISKLESS)
SET(BUILD_DISKLESS ON)
SET(USE_DISKLESS ON)
ENDIF()

# Option Logging, only valid for netcdf4.
OPTION(ENABLE_LOGGING "Enable Logging." OFF)
IF(ENABLE_LOGGING)
Expand Down Expand Up @@ -1174,6 +1167,10 @@ IF(ENABLE_DOXYGEN)
ENDIF(NC_DOT)
ENDIF()

# Always enable DISKLESS
OPTION(ENABLE_DISKLESS "Enable in-memory files" ON)


# By default, MSVC has a stack size of 1000000.
# Allow a user to override this.
IF(MSVC)
Expand Down Expand Up @@ -1857,7 +1854,7 @@ is_enabled(ENABLE_PARALLEL4 HAS_PARALLEL4)
is_enabled(ENABLE_DAP HAS_DAP)
is_enabled(ENABLE_DAP HAS_DAP2)
is_enabled(ENABLE_DAP4 HAS_DAP4)
is_enabled(USE_DISKLESS HAS_DISKLESS)
is_enabled(ENABLE_DISKLESS HAS_DISKLESS)
is_enabled(USE_MMAP HAS_MMAP)
is_enabled(JNA HAS_JNA)
is_enabled(STATUS_RELAX_COORD_BOUND RELAX_COORD_BOUND)
Expand Down
6 changes: 3 additions & 3 deletions cf
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ FLAGS="$FLAGS --enable-extreme-numbers"
#FLAGS="$FLAGS --enable-dap-auth-tests" -- requires a new remotetest server
#FLAGS="$FLAGS --enable-doxygen --enable-internal-docs"
FLAGS="$FLAGS --enable-logging"
#FLAGS="$FLAGS --disable-diskless"
FLAGS="$FLAGS --disable-diskless"
#FLAGS="$FLAGS --enable-mmap"
#FLAGS="$FLAGS --with-udunits"
#FLAGS="$FLAGS --with-libcf"
#FLAGS="$FLAGS --enable-jna"
#FLAGS="$FLAGS --disable-properties-attribute"
#FLAGS="$FLAGS --disable-silent-rules"
#FLAGS="$FLAGS --with-testservers=remotestserver.localhost:8083"
#FLAGS="$FLAGS --disable-filter-testing"
FLAGS="$FLAGS --enable-metadata-perf"
FLAGS="$FLAGS --disable-filter-testing"
#FLAGS="$FLAGS --enable-metadata-perf"

if test "x$PAR4" != x1 ; then
FLAGS="$FLAGS --disable-parallel4"
Expand Down
25 changes: 3 additions & 22 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -742,20 +742,6 @@ AC_CHECK_FUNCS([strlcat snprintf \
mkstemp mktemp random \
getrlimit gettimeofday fsync MPI_Comm_f2c])

# Does the user want to use NC_DISKLESS?
AC_MSG_CHECKING([whether in-memory files are enabled])
AC_ARG_ENABLE([diskless],
[AS_HELP_STRING([--disable-diskless],
[disable support for in-memory (NC_DISKLESS) files])])
test "x$enable_diskless" = xno || enable_diskless=yes
AC_MSG_RESULT($enable_diskless)

# If DAP enabled and diskless not enabled, then warn of consequences
if test "x$enable_dap" = "xyes" -a "x$enable_diskless" = xno ; then
AC_MSG_NOTICE([Warning: DAP support is enabled but diskless support is disabled.])
AC_MSG_NOTICE([=> temporary files will be created + reclaimed when using DAP.])
fi

# disable dap4 if netcdf-4 is disabled
if test "x$enable_netcdf_4" = "xno" ; then
AC_MSG_WARN([netcdf-4 not enabled; disabling DAP4])
Expand Down Expand Up @@ -785,12 +771,8 @@ if test "x$ac_cv_func_mmap_fixed_mapped" != xyes -o "x$ac_cv_func_mremap" != xye
enable_mmap=no
fi

# Setup the diskless and mmap conditionals
if test "x$enable_diskless" = xyes ; then
AC_DEFINE([USE_DISKLESS], [1], [if true, include NC_DISKLESS and NC_INMEMORY code])
if test "x$enable_mmap" = xyes; then
if test "x$enable_mmap" = xyes; then
AC_DEFINE([USE_MMAP], [1], [if true, use mmap for in-memory files])
fi
fi

AC_FUNC_ALLOCA
Expand Down Expand Up @@ -1211,7 +1193,6 @@ AM_CONDITIONAL(USE_RENAMEV3, [test x$enable_netcdf_4 = xyes -o x$enable_dap = xy
AM_CONDITIONAL(BUILD_FORTRAN, [test x$enable_remote_fortran_bootstrap = xyes])
AM_CONDITIONAL(USE_PNETCDF, [test x$enable_pnetcdf = xyes])
AM_CONDITIONAL(USE_DISPATCH, [test x$enable_dispatch = xyes])
AM_CONDITIONAL(BUILD_DISKLESS, [test x$enable_diskless = xyes])
AM_CONDITIONAL(BUILD_MMAP, [test x$enable_mmap = xyes])
AM_CONDITIONAL(BUILD_DOCS, [test x$enable_doxygen = xyes])
AM_CONDITIONAL(SHOW_DOXYGEN_TAG_LIST, [test x$enable_doxygen_tasks = xyes])
Expand Down Expand Up @@ -1345,7 +1326,7 @@ AC_SUBST(HAS_LOGGING, [$enable_logging])
AC_SUBST(HAS_SZLIB,[$enable_szlib])
AC_SUBST(HAS_PARALLEL,[$enable_parallel])
AC_SUBST(HAS_PARALLEL4,[$enable_parallel4])
AC_SUBST(HAS_DISKLESS,[$enable_diskless])
AC_SUBST(HAS_DISKLESS,[yes])
AC_SUBST(HAS_MMAP,[$enable_mmap])
AC_SUBST(HAS_JNA,[$enable_jna])
AC_SUBST(RELAX_COORD_BOUND,[$enable_relax_coord_bound])
Expand Down Expand Up @@ -1409,7 +1390,7 @@ AX_SET_META([NC_HAS_HDF5],[$enable_netcdf_4],[yes])
AX_SET_META([NC_HAS_SZIP],[$ac_cv_func_H5Z_SZIP],[yes])
AX_SET_META([NC_HAS_DAP2],[$enable_dap],[yes])
AX_SET_META([NC_HAS_DAP4],[$enable_dap4],[yes])
AX_SET_META([NC_HAS_DISKLESS],[$enable_diskless],[yes])
AX_SET_META([NC_HAS_DISKLESS],[yes],[yes])
AX_SET_META([NC_HAS_MMAP],[$enable_mmap],[yes])
AX_SET_META([NC_HAS_JNA],[$enable_jna],[yes])
AX_SET_META([NC_HAS_PNETCDF],[$enable_pnetcdf],[yes])
Expand Down
2 changes: 0 additions & 2 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ if BUILD_PARALLEL
include_HEADERS += netcdf_par.h
endif

if BUILD_DISKLESS
include_HEADERS += netcdf_mem.h
endif

noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h nclist.h \
ncuri.h ncutf8.h ncdispatch.h ncdimscale.h netcdf_f.h err_macros.h \
Expand Down
5 changes: 1 addition & 4 deletions libdap2/ncd2dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,13 @@ NCD2_open(const char* path, int mode,
/* Now, use the file to create the hidden, in-memory netcdf file.
We want this hidden file to always be NC_CLASSIC, so we need to
force default format temporarily in case user changed it.
If diskless is enabled, then create file in-memory, else
create an actual temporary file in the file system.
Since diskless is enabled, create file in-memory.
*/
{
int new = 0; /* format netcdf-3 */
int old = 0;
int ncflags = NC_CLOBBER|NC_CLASSIC_MODEL;
#ifdef USE_DISKLESS
ncflags |= NC_DISKLESS;
#endif
nc_set_default_format(new,&old); /* save and change */
ncstat = nc_create(tmpname,ncflags,&nc3id);
nc_set_default_format(old,&new); /* restore */
Expand Down
5 changes: 1 addition & 4 deletions libdap4/d4file.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,14 @@ NCD4_open(const char * path, int mode,
/* Now, use the file to create the hidden substrate netcdf file.
We want this hidden file to always be NC_NETCDF4, so we need to
force default format temporarily in case user changed it.
If diskless is enabled, then create file in-memory, else
create an actual temporary file in the file system.
Since diskless is enabled, create file in-memory.
*/
{
int new = NC_NETCDF4;
int old = 0;
int ncid = 0;
int ncflags = NC_NETCDF4|NC_CLOBBER;
#ifdef USE_DISKLESS
ncflags |= NC_DISKLESS;
#endif
if(FLAGSET(d4info->controls.debugflags,NCF_DEBUG_COPY)) {
/* Cause data to be dumped to real file */
ncflags |= NC_WRITE;
Expand Down
33 changes: 0 additions & 33 deletions libdispatch/dfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,14 +573,10 @@ named foo.nc. The initial size is set to 4096.
int
nc_create_mem(const char* path, int mode, size_t initialsize, int* ncidp)
{
#ifdef USE_DISKLESS
if(mode & (NC_MPIIO|NC_MPIPOSIX|NC_MMAP))
return NC_EINVAL;
mode |= (NC_INMEMORY|NC_NOCLOBBER); /* Specifically, do not set NC_DISKLESS */
return NC_create(path, mode, initialsize, 0, NULL, 0, NULL, ncidp);
#else
return NC_EDISKLESS;
#endif
}

/**
Expand Down Expand Up @@ -838,7 +834,6 @@ if (status != NC_NOERR) handle_error(status);
int
nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp)
{
#ifdef USE_DISKLESS
NC_memio meminfo;

/* Sanity checks */
Expand All @@ -851,9 +846,6 @@ nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp)
meminfo.memory = memory;
meminfo.flags = NC_MEMIO_LOCKED;
return NC_open(path, mode, 0, NULL, 0, &meminfo, ncidp);
#else
return NC_EDISKLESS;
#endif
}

/** \ingroup datasets
Expand Down Expand Up @@ -907,7 +899,6 @@ if (status != NC_NOERR) handle_error(status);
int
nc_open_memio(const char* path, int mode, NC_memio* params, int* ncidp)
{
#ifdef USE_DISKLESS
/* Sanity checks */
if(path == NULL || params == NULL)
return NC_EINVAL;
Expand All @@ -917,9 +908,6 @@ nc_open_memio(const char* path, int mode, NC_memio* params, int* ncidp)
return NC_EINVAL;
mode |= (NC_INMEMORY);
return NC_open(path, mode, 0, NULL, 0, params, ncidp);
#else
return NC_EINMEMORY;
#endif
}

/**
Expand Down Expand Up @@ -1441,7 +1429,6 @@ and release its netCDF ID:
int
nc_close_memio(int ncid, NC_memio* memio)
{
#ifdef USE_DISKLESS
NC* ncp;
int stat = NC_check_id(ncid, &ncp);
if(stat != NC_NOERR) return stat;
Expand All @@ -1460,9 +1447,6 @@ nc_close_memio(int ncid, NC_memio* memio)
}
}
return stat;
#else
return NC_EINMEMORY;
#endif
}

/** \ingroup datasets
Expand Down Expand Up @@ -1879,14 +1863,6 @@ check_create_mode(int mode)
(mode & NC_MPIPOSIX && mode & NC_DISKLESS))
return NC_EINVAL;

#ifndef USE_DISKLESS
/* If diskless is requested, but not built, return error. */
if (mode & NC_DISKLESS)
return NC_ENOTBUILT;
if (mode & NC_INMEMORY)
return NC_ENOTBUILT;
#endif

#ifndef USE_NETCDF4
/* If the user asks for a netCDF-4 file, and the library was built
* without netCDF-4, then return an error.*/
Expand Down Expand Up @@ -1963,10 +1939,6 @@ NC_create(const char *path0, int cmode, size_t initialsz,
return stat;
}

#ifndef USE_DISKLESS
cmode &= (~ (NC_DISKLESS|NC_INMEMORY)); /* Force off */
#endif

#ifdef WINPATH
/* Need to do path conversion */
path = NCpathcvt(path0);
Expand Down Expand Up @@ -2152,11 +2124,6 @@ NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
repeated in protocol code: libdap2 and libdap4
*/

#ifndef USE_DISKLESS
/* Clean up cmode */
cmode &= (~ (NC_DISKLESS|NC_INMEMORY));
#endif

inmemory = ((cmode & NC_INMEMORY) == NC_INMEMORY);
diskless = ((cmode & NC_DISKLESS) == NC_DISKLESS);

Expand Down
62 changes: 10 additions & 52 deletions libhdf5/hdf5file.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,16 +640,16 @@ close_netcdf4_file(NC_HDF5_FILE_INFO_T *h5, int abort, int extractmem)

if(h5->fileinfo) free(h5->fileinfo);

/* Check to see if this is an in-memory file and we want to get its
final content
*/
if(extractmem) {
/* File must be read/write */
if(!h5->no_write) {
retval = NC4_extract_file_image(h5);
}
/* Check to see if this is an in-memory file and we want to get its
final content
*/
if(extractmem) {
/* File must be read/write */
if(!h5->no_write) {
retval = NC4_extract_file_image(h5);
}

}

if (H5Fclose(h5->hdfid) < 0)
{
dumpopenobjects(h5);
Expand Down Expand Up @@ -964,7 +964,7 @@ nc4_create_file(const char *path, int cmode, size_t initialsz, void* parameters,
/* ok */
} else if ((cmode & NC_NOCLOBBER) && (fp = fopen(path, "r"))) {
fclose(fp);
return NC_EEXIST;
BAIL(NC_EEXIST);
}

/* Need this access plist to control how HDF5 handles open objects
Expand Down Expand Up @@ -3018,48 +3018,6 @@ NC4_close(int ncid, void* params)
return NC_NOERR;
}

/**
* @internal Close an in-memory netcdf file, writing any changes first.
*
* @param ncid File and group ID.
* @param sizep ptr into which the final size is stored
* @param memp ptr into which the final memory is stored
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
*/
int
NC4_close_mem(int ncid, size_t* sizep, void** memp)
{
NC_GRP_INFO_T *grp;
NC *nc;
NC_HDF5_FILE_INFO_T *h5;
int retval;

LOG((1, "%s: ncid 0x%x", __func__, ncid));

/* Find our metadata for this file. */
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
return retval;

assert(nc && h5 && grp);

/* This must be the root group. */
if (grp->parent)
return NC_EBADGRPID;

/* If the file is not an in-memory file, then treat like normal close */
if((h5->cmode & NC_INMEMORY) == 0)
return NC4_close(ncid,NULL);

/* Call the nc4 close and extract memory */
if ((retval = close_netcdf4_file(grp->nc4_info, 0, 1)))
return retval;


return NC_NOERR;
}

/**
* @internal Learn number of dimensions, variables, global attributes,
* and the ID of the first unlimited dimension (if any).
Expand Down
10 changes: 4 additions & 6 deletions libsrc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c

SET(libsrc_SOURCES ${libsrc_SOURCES} pstdint.h ncio.h ncx.h)

IF (BUILD_DISKLESS)
SET(libsrc_SOURCES ${libsrc_SOURCES} memio.c)
SET(libsrc_SOURCES ${libsrc_SOURCES} memio.c)

IF (BUILD_MMAP)
SET(libsrc_SOURCES ${libsrc_SOURCES} mmapio.c)
ENDIF( BUILD_MMAP)
ENDIF (BUILD_DISKLESS)
IF (BUILD_MMAP)
SET(libsrc_SOURCES ${libsrc_SOURCES} mmapio.c)
ENDIF( BUILD_MMAP)

IF (USE_FFIO)
SET(libsrc_SOURCES ${libsrc_SOURCES} ffio.c)
Expand Down
5 changes: 1 addition & 4 deletions libsrc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ libnetcdf3_la_CPPFLAGS = ${AM_CPPFLAGS}
# These files comprise the netCDF-3 classic library code.
libnetcdf3_la_SOURCES = v1hpg.c \
putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c \
ncx.h lookup3.c pstdint.h ncio.c ncio.h
ncx.h lookup3.c pstdint.h ncio.c ncio.h memio.c

if BUILD_DISKLESS
libnetcdf3_la_SOURCES += memio.c
if BUILD_MMAP
libnetcdf3_la_SOURCES += mmapio.c
endif BUILD_MMAP
endif BUILD_DISKLESS

# Does the user want to use ffio, a replacement for posixio for Cray
# computers?
Expand Down
Loading

0 comments on commit 61a6c0c

Please sign in to comment.