Commit e7cf8686 authored by Huihuo Zheng's avatar Huihuo Zheng
Browse files

deleted vol

parent 7dabbfd7
Dana Robinson <derobins@hdfgroup.org>
cmake_minimum_required (VERSION 3.9)
project (node_local_vol VERSION 0.1.0 DESCRIPTION "node_local VOL connector" LANGUAGES C)
# Enable testing
enable_testing ()
include (CTest)
# Find HDF5
find_package (HDF5 COMPONENTS C REQUIRED)
link_directories (${HDF5_LIBRARY_DIRS})
include_directories (${HDF5_INCLUDE_DIR})
set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY})
# It's really easy to pick up the wrong HDF5 library if you set the path
# wrong. Turn this on for added confirmation that you got it right.
#message (DEPRECATION "Include: ${HDF5_INCLUDE_DIR}")
add_subdirectory (src)
add_subdirectory (test)
Copyright Notice and License Terms for HDF5 VOL Connector Template
-----------------------------------------------------------------------------
Copyright (c) 2019, The HDF Group.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted for any purpose (including commercial purposes)
provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions, and the following disclaimer in the documentation
and/or materials provided with the distribution.
3. Neither the name of The HDF Group nor the name of any Contributor may be
used to endorse or promote products derived from this software without
specific prior written permission from The HDF Group, or the Contributor,
respectively.
DISCLAIMER:
THIS SOFTWARE IS PROVIDED BY THE HDF GROUP AND THE CONTRIBUTORS
"AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. IN NO
EVENT SHALL THE HDF GROUP OR THE CONTRIBUTORS BE LIABLE FOR ANY DAMAGES
SUFFERED BY THE USERS ARISING OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You are under no obligation whatsoever to provide any bug fixes, patches, or
upgrades to the features, functionality or performance of the source code
("Enhancements") to anyone; however, if you choose to make your Enhancements
available either publicly, or directly to The HDF Group, without imposing a
separate written license agreement for such Enhancements, then you hereby
grant the following license: a non-exclusive, royalty-free perpetual license
to install, use, modify, prepare derivative works, incorporate into other
computer software, distribute, and sublicense such enhancements or derivative
works thereof, in binary and source code form.
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src
EXTRA_DIST = autogen.sh
# HDF5 VOL connector template
This is a template for creating an HDF5 virtual object layer (VOL) connector.
Copy this code into your own repository and modify the source, test, and build files as needed to implement your own functionality.
The code included in the source directory builds an "empty" VOL connector which has no functionality aside from being capable of registration. Although lacking as a "real" VOL connector, this shell can still serve as a useful test of whether dynamic plugin loading is working.
For a demonstration connector with more functionality, see the Berkeley DB VOL connector and associated tutorial here:
https://bitbucket.hdfgroup.org/projects/HDF5VOL/repos/berkeley-db/browse
## Getting started
You will need a few things to build the code in this repository:
* HDF5 1.12.0 or later
* CMake (3.9 or later) or the Autotools (autoconf 2.69 or later and matching automake, etc.)
### Autotools Builds
1) The first thing you need to do is run the autogen.sh script located in the source root. This will run the autotools and generate the build files.
2) Next, switch to your build directory and run configure. You might need to specify the path to a VOL-enabled HDF5 (version 1.12.0 or later) using the --with-hdf5 option. Oddly, --with-hdf5 needs you to point to the h5cc file. This will be improved in the future.
3) Once configured, you should be able to make and build. Switching to the test directory and running 'make check' will run the test script.
### CMake Builds
1) Run ccmake or the CMake GUI and point it at a VOL-enabled HDF5 installation. You may need to switch to "advanced mode" to see all the options. Configure and generate.
2) Build the software using 'make', etc.
3) Run the test program using 'make test', 'ctest .', etc.
#!/bin/sh
autoreconf --install
## Process this file with autoconf to produce configure.
##
AC_PREREQ([2.69])
AC_INIT([NODE_LOCAL VOL], [0.1.0], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/node_local_vol_connector.c])
AC_CONFIG_HEADERS([config.h])
# Dump all the weird scripts in bin/
AC_CONFIG_AUX_DIR([bin])
# Script directory
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
AC_PROG_CC
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Initialize Automake
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_SILENT_RULES([yes])
# Set prefix default (install directory) to a directory in the build area.
AC_PREFIX_DEFAULT([`pwd`/plugin])
# Initialize Libtool
LT_INIT([shared disable-static])
# Find HDF5. This macro (from gnu.org) adds a --with-hdf5 option for setting
# a path to any repository.
AX_LIB_HDF5()
# If you want a particular build of the HDF5 library, you can use these
# instead.
# AX_LIB_HDF5([serial])
# AX_LIB_HDF5([parallel])
if test "$with_hdf5" = "no"; then
AC_MSG_ERROR([Unable to find HDF5])
fi
AC_CONFIG_FILES([Makefile
src/Makefile
test/Makefile])
AC_CONFIG_FILES([test/test_vol_plugin.sh],
[chmod +x test/test_vol_plugin.sh])
AC_OUTPUT
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_lib_hdf5.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_LIB_HDF5([serial/parallel])
#
# DESCRIPTION
#
# This macro provides tests of the availability of HDF5 library.
#
# The optional macro argument should be either 'serial' or 'parallel'. The
# former only looks for serial HDF5 installations via h5cc. The latter
# only looks for parallel HDF5 installations via h5pcc. If the optional
# argument is omitted, serial installations will be preferred over
# parallel ones.
#
# The macro adds a --with-hdf5 option accepting one of three values:
#
# no - do not check for the HDF5 library.
# yes - do check for HDF5 library in standard locations.
# path - complete path to the HDF5 helper script h5cc or h5pcc.
#
# If HDF5 is successfully found, this macro calls
#
# AC_SUBST(HDF5_VERSION)
# AC_SUBST(HDF5_CC)
# AC_SUBST(HDF5_CFLAGS)
# AC_SUBST(HDF5_CPPFLAGS)
# AC_SUBST(HDF5_LDFLAGS)
# AC_SUBST(HDF5_LIBS)
# AC_SUBST(HDF5_FC)
# AC_SUBST(HDF5_FFLAGS)
# AC_SUBST(HDF5_FLIBS)
# AC_SUBST(HDF5_TYPE)
# AC_DEFINE(HAVE_HDF5)
#
# and sets with_hdf5="yes". Additionally, the macro sets
# with_hdf5_fortran="yes" if a matching Fortran wrapper script is found.
# Note that Autoconf's Fortran support is not used to perform this check.
# H5CC and H5FC will contain the appropriate serial or parallel HDF5
# wrapper script locations.
#
# If HDF5 is disabled or not found, this macros sets with_hdf5="no" and
# with_hdf5_fortran="no".
#
# Your configuration script can test $with_hdf to take any further
# actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++.
# HDF5_F{FLAGS,LIBS} should be used when building Fortran applications.
#
# To use the macro, one would code one of the following in "configure.ac"
# before AC_OUTPUT:
#
# 1) dnl Check for HDF5 support
# AX_LIB_HDF5()
#
# 2) dnl Check for serial HDF5 support
# AX_LIB_HDF5([serial])
#
# 3) dnl Check for parallel HDF5 support
# AX_LIB_HDF5([parallel])
#
# One could test $with_hdf5 for the outcome or display it as follows
#
# echo "HDF5 support: $with_hdf5"
#
# You could also for example, override the default CC in "configure.ac" to
# enforce compilation with the compiler that HDF5 uses:
#
# AX_LIB_HDF5([parallel])
# if test "$with_hdf5" = "yes"; then
# CC="$HDF5_CC"
# else
# AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.])
# fi
#
# The HDF5_TYPE environment variable returns "parallel" or "serial",
# depending on which type of library is found.
#
# LICENSE
#
# Copyright (c) 2009 Timothy Brown <tbrown@freeshell.org>
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 19
AC_DEFUN([AX_LIB_HDF5], [
AC_REQUIRE([AC_PROG_SED])
AC_REQUIRE([AC_PROG_AWK])
AC_REQUIRE([AC_PROG_GREP])
dnl Check first argument is one of the recognized values.
dnl Fail eagerly if is incorrect as this simplifies case statements below.
if test "m4_normalize(m4_default([$1],[]))" = "" ; then
: # Recognized value
elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then
: # Recognized value
elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then
: # Recognized value
else
AC_MSG_ERROR([
Unrecognized value for AX[]_LIB_HDF5 within configure.ac.
If supplied, argument 1 must be either 'serial' or 'parallel'.
])
fi
dnl Add a default --with-hdf5 configuration option.
AC_ARG_WITH([hdf5],
AS_HELP_STRING(
[--with-hdf5=[yes/no/PATH]],
m4_case(m4_normalize([$1]),
[serial], [location of h5cc for serial HDF5 configuration],
[parallel], [location of h5pcc for parallel HDF5 configuration],
[location of h5cc or h5pcc for HDF5 configuration])
),
[if test "$withval" = "no"; then
with_hdf5="no"
elif test "$withval" = "yes"; then
with_hdf5="yes"
else
with_hdf5="yes"
H5CC="$withval"
fi],
[with_hdf5="yes"]
)
dnl Set defaults to blank
HDF5_CC=""
HDF5_VERSION=""
HDF5_CFLAGS=""
HDF5_CPPFLAGS=""
HDF5_LDFLAGS=""
HDF5_LIBS=""
HDF5_FC=""
HDF5_FFLAGS=""
HDF5_FLIBS=""
HDF5_TYPE=""
dnl Try and find hdf5 compiler tools and options.
if test "$with_hdf5" = "yes"; then
if test -z "$H5CC"; then
dnl Check to see if H5CC is in the path.
AC_PATH_PROGS(
[H5CC],
m4_case(m4_normalize([$1]),
[serial], [h5cc],
[parallel], [h5pcc],
[h5cc h5pcc]),
[])
else
AC_MSG_CHECKING([Using provided HDF5 C wrapper])
AC_MSG_RESULT([$H5CC])
fi
AC_MSG_CHECKING([for HDF5 type])
AS_CASE([$H5CC],
[*h5pcc], [HDF5_TYPE=parallel],
[*h5cc], [HDF5_TYPE=serial],
[HDF5_TYPE=neither])
AC_MSG_RESULT([$HDF5_TYPE])
AC_MSG_CHECKING([for HDF5 libraries])
if test ! -f "$H5CC" || test ! -x "$H5CC"; then
AC_MSG_RESULT([no])
AC_MSG_WARN(m4_case(m4_normalize([$1]),
[serial], [
Unable to locate serial HDF5 compilation helper script 'h5cc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5cc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
], [parallel],[
Unable to locate parallel HDF5 compilation helper script 'h5pcc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5pcc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
], [
Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'.
Please specify --with-hdf5=<LOCATION> as the full path to h5cc or h5pcc.
HDF5 support is being disabled (equivalent to --with-hdf5=no).
]))
with_hdf5="no"
with_hdf5_fortran="no"
else
dnl Get the h5cc output
HDF5_SHOW=$(eval $H5CC -show)
dnl Get the actual compiler used
HDF5_CC=$(eval $H5CC -show | $AWK '{print $[]1}')
if test "$HDF5_CC" = "ccache"; then
HDF5_CC=$(eval $H5CC -show | $AWK '{print $[]2}')
fi
dnl h5cc provides both AM_ and non-AM_ options
dnl depending on how it was compiled either one of
dnl these are empty. Lets roll them both into one.
dnl Look for "HDF5 Version: X.Y.Z"
HDF5_VERSION=$(eval $H5CC -showconfig | $GREP 'HDF5 Version:' \
| $AWK '{print $[]3}')
dnl A ideal situation would be where everything we needed was
dnl in the AM_* variables. However most systems are not like this
dnl and seem to have the values in the non-AM variables.
dnl
dnl We try the following to find the flags:
dnl (1) Look for "NAME:" tags
dnl (2) Look for "H5_NAME:" tags
dnl (3) Look for "AM_NAME:" tags
dnl
HDF5_tmp_flags=$(eval $H5CC -showconfig \
| $GREP 'FLAGS\|Extra libraries:' \
| $AWK -F: '{printf("%s "), $[]2}' )
dnl Find the installation directory and append include/
HDF5_tmp_inst=$(eval $H5CC -showconfig \
| $GREP 'Installation point:' \
| $AWK '{print $[]NF}' )
dnl Add this to the CPPFLAGS
HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include"
dnl Now sort the flags out based upon their prefixes
for arg in $HDF5_SHOW $HDF5_tmp_flags ; do
case "$arg" in
-I*) echo $HDF5_CPPFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|| HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg"
;;
-L*) echo $HDF5_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|| HDF5_LDFLAGS="$HDF5_LDFLAGS $arg"
;;
-l*) echo $HDF5_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \
|| HDF5_LIBS="$HDF5_LIBS $arg"
;;
esac
done
HDF5_LIBS="-lhdf5 $HDF5_LIBS"
AC_MSG_RESULT([yes (version $[HDF5_VERSION])])
dnl See if we can compile
AC_LANG_PUSH([C])
ax_lib_hdf5_save_CC=$CC
ax_lib_hdf5_save_CPPFLAGS=$CPPFLAGS
ax_lib_hdf5_save_LIBS=$LIBS
ax_lib_hdf5_save_LDFLAGS=$LDFLAGS
CC=$HDF5_CC
CPPFLAGS=$HDF5_CPPFLAGS
LIBS=$HDF5_LIBS
LDFLAGS=$HDF5_LDFLAGS
AC_CHECK_HEADER([hdf5.h], [ac_cv_hadf5_h=yes], [ac_cv_hadf5_h=no])
AC_CHECK_LIB([hdf5], [H5Fcreate], [ac_cv_libhdf5=yes],
[ac_cv_libhdf5=no])
if test "$ac_cv_hadf5_h" = "no" && test "$ac_cv_libhdf5" = "no" ; then
AC_MSG_WARN([Unable to compile HDF5 test program])
fi
dnl Look for HDF5's high level library
AC_HAVE_LIBRARY([hdf5_hl], [HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"], [], [])
CC=$ax_lib_hdf5_save_CC
CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS
LIBS=$ax_lib_hdf5_save_LIBS
LDFLAGS=$ax_lib_hdf5_save_LDFLAGS
AC_LANG_POP([C])
AC_MSG_CHECKING([for matching HDF5 Fortran wrapper])
dnl Presume HDF5 Fortran wrapper is just a name variant from H5CC
H5FC=$(eval echo -n $H5CC | $SED -n 's/cc$/fc/p')
if test -x "$H5FC"; then
AC_MSG_RESULT([$H5FC])
with_hdf5_fortran="yes"
AC_SUBST([H5FC])
dnl Again, pry any remaining -Idir/-Ldir from compiler wrapper
for arg in `$H5FC -show`
do
case "$arg" in #(
-I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|| HDF5_FFLAGS="$HDF5_FFLAGS $arg"
;;#(
-L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|| HDF5_FFLAGS="$HDF5_FFLAGS $arg"
dnl HDF5 installs .mod files in with libraries,
dnl but some compilers need to find them with -I
echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \
|| HDF5_FFLAGS="$HDF5_FFLAGS -I${arg#-L}"
;;
esac
done
dnl Make Fortran link line by inserting Fortran libraries
for arg in $HDF5_LIBS
do
case "$arg" in #(
-lhdf5_hl) HDF5_FLIBS="$HDF5_FLIBS -lhdf5hl_fortran $arg"
;; #(
-lhdf5) HDF5_FLIBS="$HDF5_FLIBS -lhdf5_fortran $arg"
;; #(
*) HDF5_FLIBS="$HDF5_FLIBS $arg"
;;
esac
done
else
AC_MSG_RESULT([no])
with_hdf5_fortran="no"
fi
AC_SUBST([HDF5_VERSION])
AC_SUBST([HDF5_CC])
AC_SUBST([HDF5_CFLAGS])
AC_SUBST([HDF5_CPPFLAGS])
AC_SUBST([HDF5_LDFLAGS])
AC_SUBST([HDF5_LIBS])
AC_SUBST([HDF5_FC])
AC_SUBST([HDF5_FFLAGS])
AC_SUBST([HDF5_FLIBS])
AC_SUBST([HDF5_TYPE])
AC_DEFINE([HAVE_HDF5], [1], [Defined if you have HDF5 support])
fi
fi
])
#!/bin/sh
#
# Copyright by The HDF Group.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the COPYING file, which can be found at the root of the source code
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
# A script to clean up the action of autogen.sh
#
# If this script fails to clean up generated files on a particular
# platform, please contact help@hdfgroup.org or comment on the forum.
echo
echo "**************************"
echo "* autogen.sh undo script *"
echo "**************************"
echo
echo "Remove autom4te.cache directory"
rm -rf autom4te.cache
echo "Remove configure script"
rm -f configure
echo "Remove Makefile.in files"
find . -type f -name 'Makefile.in' -exec rm {} \;
echo "Remove files generated by libtoolize"
rm -f bin/ltmain.sh
rm -f m4/libtool.m4
rm -f m4/ltoptions.m4
rm -f m4/ltsugar.m4
rm -f m4/ltversion.m4
rm -f m4/lt~obsolete.m4
echo "Remove files generated by automake"
rm -f bin/compile
rm -f bin/config.guess
rm -f bin/config.sub
rm -f bin/install-sh
rm -f bin/missing
rm -f bin/test-driver
rm -f bin/depcomp
echo "Remove remaining generated files"
rm -f aclocal.m4
rm -f config.h.in
# Set the node_local VOL connector name
set (TVC_NAME node_local_vol_connector)
# Build the node_local VOL
add_library (${TVC_NAME} SHARED node_local_vol_connector.c)
set_target_properties (${TVC_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties (${TVC_NAME} PROPERTIES SOVERSION 1)
set_target_properties (${TVC_NAME} PROPERTIES PUBLIC_HEADER "${TVC_NAME}.h")
ACLOCAL_AMFLAGS = -I m4
# Adjust as needed
AM_CPPFLAGS = $(HDF5_CPPFLAGS)
AM_CFLAGS = -g -Wall -Wextra -fPIC $(HDF5_CFLAGS)
# Public header
include_HEADERS = node_local_vol_connector.h
# Node_Local VOL connector
lib_LTLIBRARIES = libnode_local_vol_connector.la
libnode_local_vol_connector_la_SOURCES = node_local_vol_connector.c
libnode_local_vol_connector_la_LDFLAGS = $(AM_LDFLAGS) $(HDF5_LDFLAGS) -avoid-version -module -shared -export-dynamic
libnode_local_vol_connector_la_LIBADD = $(HDF5_LIBS)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Purpose: A simple virtual object layer (VOL) connector with almost no
* functionality that can serve as a node_local for creating other
* connectors.
*/
/* This connector's header */
#include "node_local_vol_connector.h"
#include <hdf5.h>
#include <H5PLextern.h>
#include <stdlib.h>
/* The VOL class struct */
static const H5VL_class_t node_local_class_g = {
0, /* version */
NODE_LOCAL_VOL_CONNECTOR_VALUE, /* value */
NODE_LOCAL_VOL_CONNECTOR_NAME, /* name */
0, /* capability flags */
NULL, /* initialize */
NULL, /* terminate */
{ /* info_cls */
(size_t)0, /* size */
NULL, /* copy */
NULL, /* compare */
NULL, /* free */
NULL, /* to_str */
NULL, /* from_str */
},
{ /* wrap_cls */
NULL, /* get_object */
NULL, /* get_wrap_ctx */
NULL, /* wrap_object */
NULL, /* unwrap_object */
NULL, /* free_wrap_ctx */
},
{ /* attribute_cls */
NULL, /* create */
NULL, /* open */
NULL, /* read */
NULL, /* write */
NULL, /* get */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
},
{ /* dataset_cls */
NULL, /* create */
NULL, /* open */
NULL, /* read */
NULL, /* write */
NULL, /* get */
NULL, /* specific */
NULL, /* optional */
NULL /* close */
},
{ /* datatype_cls */
NULL, /* commit */
NULL, /* open */
NULL, /* get_size */
NULL, /* specific */
NULL, /* optional */