summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2014-06-16 17:37:42 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2014-06-16 17:37:42 (GMT)
commitf4b22f3789ccdaa0acb8375e17ecb0cfc28105b4 (patch)
tree948e624a3aa65000186b81bb66081ad38e3454e6
parent017a386712ea3660b94acf540d601b3eb0089851 (diff)
downloadhdf5-f4b22f3789ccdaa0acb8375e17ecb0cfc28105b4.zip
hdf5-f4b22f3789ccdaa0acb8375e17ecb0cfc28105b4.tar.gz
hdf5-f4b22f3789ccdaa0acb8375e17ecb0cfc28105b4.tar.bz2
[svn-r25295] Add support for FastBit index plugin
-rw-r--r--CMakeLists.txt8
-rw-r--r--config/cmake/FindFASTBIT.cmake22
-rw-r--r--config/cmake/H5pubconf.h.in5
-rw-r--r--configure.ac77
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/H5X.c8
-rw-r--r--src/H5Xfastbit.c312
-rw-r--r--src/H5Xpkg.h9
-rw-r--r--src/Makefile.am2
9 files changed, 443 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61f760c..70d1b22 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -719,12 +719,20 @@ IF (HDF5_ENABLE_PARALLEL)
OPTION (HDF5_ENABLE_INDEXING "Enable support for Indexing." OFF)
IF (HDF5_ENABLE_INDEXING)
SET (H5_HAVE_INDEXING 1)
+ # ALACRITY
FIND_PACKAGE (ALACRITY)
IF (ALACRITY_FOUND)
SET (H5_HAVE_ALACRITY 1)
INCLUDE_DIRECTORIES (${ALACRITY_INCLUDE_DIR})
SET (LINK_LIBS ${LINK_LIBS} ${ALACRITY_LIBRARIES})
ENDIF (ALACRITY_FOUND)
+ # FastBit
+ FIND_PACKAGE (FASTBIT)
+ IF (FASTBIT_FOUND)
+ SET (H5_HAVE_FASTBIT 1)
+ INCLUDE_DIRECTORIES (${FASTBIT_INCLUDE_DIR})
+ SET (LINK_LIBS ${LINK_LIBS} ${FASTBIT_LIBRARIES})
+ ENDIF (FASTBIT_FOUND)
ENDIF (HDF5_ENABLE_INDEXING)
ENDIF (HDF5_ENABLE_EFF)
ENDIF (HDF5_ENABLE_PARALLEL)
diff --git a/config/cmake/FindFASTBIT.cmake b/config/cmake/FindFASTBIT.cmake
new file mode 100644
index 0000000..2d95f45
--- /dev/null
+++ b/config/cmake/FindFASTBIT.cmake
@@ -0,0 +1,22 @@
+# - Try to find FastBit
+# Once done this will define
+# FASTBIT_FOUND - System has FastBit
+# FASTBIT_INCLUDE_DIRS - The FastBit include directories
+# FASTBIT_LIBRARIES - The libraries needed to use FastBit
+
+find_path(FASTBIT_INCLUDE_DIR iapi.h
+ HINTS /usr/local/include /usr/include)
+
+find_library(FASTBIT_LIBRARY NAMES fastbit
+ PATHS /usr/local/lib /usr/lib)
+
+set(FASTBIT_INCLUDE_DIRS ${FASTBIT_INCLUDE_DIR})
+set(FASTBIT_LIBRARIES ${FASTBIT_LIBRARY})
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set FASTBIT_FOUND to TRUE
+# if all listed variables are TRUE
+find_package_handle_standard_args(FASTBIT DEFAULT_MSG
+ FASTBIT_INCLUDE_DIR FASTBIT_LIBRARY)
+
+mark_as_advanced(FASTBIT_INCLUDE_DIR FASTBIT_LIBRARY)
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index daf6b0d..f94505c 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -317,9 +317,12 @@
/* Define if we have Indexing support */
#cmakedefine H5_HAVE_INDEXING @H5_HAVE_INDEXING@
-/* Define if we have support for Alacrity */
+/* Define if we have support for ALACRITY */
#cmakedefine H5_HAVE_ALACRITY @H5_HAVE_ALACRITY@
+/* Define if we have support for FastBit */
+#cmakedefine H5_HAVE_FASTBIT @H5_HAVE_FASTBIT@
+
/* Define to 1 if you have the <pthread.h> header file. */
#cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@
diff --git a/configure.ac b/configure.ac
index fc73e7f..f3186f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3179,6 +3179,83 @@ case $withval in
esac
## ----------------------------------------------------------------------
+## Check for FastBit
+##
+AC_ARG_WITH([fastbit],
+ [AS_HELP_STRING([--with-fastbit=DIR],
+ [Use FastBit [default=no]])],,
+ [withval=no])
+
+case $withval in
+ yes)
+ HAVE_ALACRITY="yes"
+ AC_CHECK_HEADERS([iapi.h])
+ AC_CHECK_LIB([fastbit], [fastbit_selection_create],[MYFASTBIT_LIBS="-lfastbit"], [unset HAVE_FASTBIT])
+ AC_SUBST([MYFASTBIT_LIBS])
+ if test -z "$HAVE_FASTBIT" -a -n "$HDF5_CONFIG_ABORT"; then
+ AC_MSG_ERROR([couldn't find FastBit library])
+ fi
+ ;;
+ no)
+ HAVE_FASTBIT="no"
+ AC_MSG_CHECKING([for FastBit library])
+ AC_MSG_RESULT([suppressed])
+ ;;
+ *)
+ HAVE_FASTBIT="yes"
+ case "$withval" in
+ *,*)
+ fastbit_inc="`echo $withval |cut -f1 -d,`"
+ fastbit_lib="`echo $withval |cut -f2 -d, -s`"
+ ;;
+ *)
+ if test -n "$withval"; then
+ fastbit_inc="$withval/include"
+ fastbit_lib="$withval/lib"
+ fi
+ ;;
+ esac
+
+ ## Trying to include -I/usr/include and -L/usr/lib is redundant and
+ ## can mess some compilers up.
+ if test "X$fastbit_inc" = "X/usr/include"; then
+ fastbit_inc=""
+ fi
+ if test "X$fastbit_lib" = "X/usr/lib"; then
+ fastbit_lib=""
+ fi
+
+ saved_CPPFLAGS="$CPPFLAGS"
+ saved_AM_CPPFLAGS="$AM_CPPFLAGS"
+ saved_LDFLAGS="$LDFLAGS"
+ saved_AM_LDFLAGS="$AM_LDFLAGS"
+
+ if test -n "$fastbit_inc"; then
+ CPPFLAGS="$CPPFLAGS -I$fastbit_inc"
+ AM_CPPFLAGS="$AM_CPPFLAGS -I$fastbit_inc"
+ fi
+
+ AC_CHECK_HEADERS([iapi.h],,[CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"])
+
+ if test -n "$fastbit_lib"; then
+ LDFLAGS="$LDFLAGS -L$fastbit_lib"
+ AM_LDFLAGS="$AM_LDFLAGS -L$fastbit_lib"
+ fi
+
+ AC_CHECK_LIB([fastbit], [fastbit_selection_create],,
+ [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_FASTBIT],
+ )
+
+ if test -z "$HAVE_FASTBIT" -a -n "$HDF5_CONFIG_ABORT"; then
+ AC_MSG_ERROR([couldn't find FastBit library])
+ fi
+
+ AC_DEFINE([HAVE_FASTBIT], [1],
+ [Define if FastBit indexing is supported.])
+ ;;
+esac
+
+## ----------------------------------------------------------------------
## Check for python devel
##
AC_MSG_CHECKING([whether to enable the python scripting environment])
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 776df04..4abcb3b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -662,6 +662,12 @@ IF (HDF5_ENABLE_EFF)
${HDF5_SRC_DIR}/H5Xalacrity.c
)
ENDIF (ALACRITY_FOUND)
+ IF (FASTBIT_FOUND)
+ set (H5FF_SRCS
+ ${H5FF_SRCS}
+ ${HDF5_SRC_DIR}/H5Xfastbit.c
+ )
+ ENDIF (FASTBIT_FOUND)
ENDIF (HDF5_ENABLE_INDEXING)
set (H5FF_HDRS
${HDF5_SRC_DIR}/H5ASpublic.h
diff --git a/src/H5X.c b/src/H5X.c
index 788ff8f..ece543c 100644
--- a/src/H5X.c
+++ b/src/H5X.c
@@ -129,13 +129,15 @@ H5X_init_interface(void)
FUNC_ENTER_NOAPI_NOINIT
-//#ifdef H5_HAVE_INDEX_PLUGIN_DUMMY
if (H5X_register(H5X_DUMMY) < 0)
HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register dummy index plugin");
-//#endif /* H5_HAVE_INDEX_PLUGIN_DUMMY */
#ifdef H5_HAVE_ALACRITY
if (H5X_register(H5X_ALACRITY) < 0)
- HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register alacrity index plugin");
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register ALACRITY index plugin");
+#endif
+#ifdef H5_HAVE_FASTBIT
+ if (H5X_register(H5X_FASTBIT) < 0)
+ HGOTO_ERROR (H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register FastBit index plugin");
#endif
done:
diff --git a/src/H5Xfastbit.c b/src/H5Xfastbit.c
new file mode 100644
index 0000000..8fdbad9
--- /dev/null
+++ b/src/H5Xfastbit.c
@@ -0,0 +1,312 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Alacrity index routines.
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Xprivate.h" /* Index */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5Pprivate.h"
+#include "H5FFprivate.h"
+#include "H5RCprivate.h"
+#include "H5TRprivate.h"
+#include "H5Qprivate.h"
+#include "H5VMprivate.h"
+#include "H5Sprivate.h"
+/* TODO using private headers but could use public ones */
+
+#ifdef H5_HAVE_FASTBIT
+/**
+ * Header file that defines an in-memory C API for accessing the querying
+ * functionality of FastBit IBIS implementation. It is primarily for
+ * in memory data.
+ */
+#include <iapi.h>
+
+/****************/
+/* Local Macros */
+/****************/
+#define H5X_FASTBIT_DEBUG
+
+#ifdef H5X_FASTBIT_DEBUG
+#define H5X_FASTBIT_LOG_DEBUG(...) do { \
+ fprintf(stdout, " # %s(): ", __func__); \
+ fprintf(stdout, __VA_ARGS__); \
+ fprintf(stdout, "\n"); \
+ fflush(stdout); \
+ } while (0)
+#else
+#define H5X_FASTBIT_LOG_DEBUG
+#endif
+
+/******************/
+/* Local Typedefs */
+/******************/
+typedef struct H5X_fastbit_t {
+ void *private_metadata; /* Internal metadata */
+
+ hid_t opaque_type_id; /* Datatype used for index datasets */
+ hid_t metadata_id; /* Array for metadata */
+ hid_t index_id; /* Array for index data */
+} H5X_fastbit_t;
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+static void *
+H5X_fastbit_create(hid_t file_id, hid_t dataset_id, hid_t xcpl_id,
+ hid_t xapl_id, size_t *metadata_size, void **metadata);
+
+static herr_t
+H5X_fastbit_remove(hid_t file_id, hid_t dataset_id, size_t metadata_size,
+ void *metadata);
+
+static void *
+H5X_fastbit_open(hid_t file_id, hid_t dataset_id, hid_t xapl_id,
+ size_t metadata_size, void *metadata);
+
+static herr_t
+H5X_fastbit_close(void *idx_handle);
+
+static herr_t
+H5X_fastbit_pre_update(void *idx_handle, hid_t dataspace_id, hid_t xxpl_id);
+
+static herr_t
+H5X_fastbit_post_update(void *idx_handle, const void *buf, hid_t dataspace_id,
+ hid_t xxpl_id);
+
+static herr_t
+H5X_fastbit_query(void *idx_handle, hid_t query_id, hid_t xxpl_id,
+ hid_t *dataspace_id);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Alacrity index class */
+const H5X_class_t H5X_FASTBIT[1] = {{
+ H5X_CLASS_T_VERS, /* (From the H5Xpublic.h header file) */
+ H5X_PLUGIN_FASTBIT, /* (Or whatever number is assigned) */
+ "FASTBIT index plugin", /* Whatever name desired */
+ H5X_TYPE_DATA_ELEM, /* This plugin operates on dataset elements */
+ H5X_fastbit_create, /* create */
+ H5X_fastbit_remove, /* remove */
+ H5X_fastbit_open, /* open */
+ H5X_fastbit_close, /* close */
+ H5X_fastbit_pre_update, /* pre_update */
+ H5X_fastbit_post_update, /* post_update */
+ H5X_fastbit_query /* query */
+}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_create
+ *
+ * Purpose: This function creates a new instance of a FASTBIT plugin index.
+ *
+ * Return: Success: Pointer to the new index
+ * Failure: NULL
+ *
+ *------------------------------------------------------------------------
+ */
+static void *
+H5X_fastbit_create(hid_t file_id, hid_t dataset_id, hid_t UNUSED xcpl_id,
+ hid_t xapl_id, size_t *metadata_size, void **metadata)
+{
+ H5X_fastbit_t *fastbit = NULL;
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+ H5X_FASTBIT_LOG_DEBUG("Enter");
+
+done:
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_create() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_remove
+ *
+ * Purpose: This function removes the FASTBIT plugin index from the file.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5X_fastbit_remove(hid_t UNUSED file_id, hid_t UNUSED dataset_id,
+ size_t UNUSED metadata_size, void UNUSED *metadata)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ H5X_FASTBIT_LOG_DEBUG("Enter");
+
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_remove() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_open
+ *
+ * Purpose: This function opens an already existing FASTBIT index from a file.
+ *
+ * Return: Success: Pointer to the index
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5X_fastbit_open(hid_t file_id, hid_t dataset_id, hid_t xapl_id,
+ size_t metadata_size, void *metadata)
+{
+ H5X_fastbit_t *fastbit = NULL;
+ void *ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+ H5X_FASTBIT_LOG_DEBUG("Enter");
+
+done:
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_open() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_close
+ *
+ * Purpose: This function closes an FASTBIT index.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5X_fastbit_close(void *idx_handle)
+{
+ H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+ H5X_FASTBIT_LOG_DEBUG("Enter");
+
+ if (NULL == fastbit)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL index handle");
+
+done:
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_close() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_pre_update
+ *
+ * Purpose: This function does a pre_update of indexing information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5X_fastbit_pre_update(void *idx_handle, hid_t UNUSED dataspace_id, hid_t UNUSED xxpl_id)
+{
+ H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+ H5X_FASTBIT_LOG_DEBUG("Enter");
+
+ if (NULL == fastbit)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL index handle");
+
+done:
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_pre_update() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_post_update
+ *
+ * Purpose: This function does a post_update of indexing information.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5X_fastbit_post_update(void *idx_handle, const void UNUSED *buf,
+ hid_t UNUSED dataspace_id, hid_t UNUSED xxpl_id)
+{
+ H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ H5X_FASTBIT_LOG_DEBUG("Calling H5X_fastbit_post_update");
+
+ if (NULL == fastbit)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL index handle");
+
+done:
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_post_update() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5X_fastbit_query
+ *
+ * Purpose: This function retrieves indexing information that matches
+ * the query and returns results under the form of a dataspace ID.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5X_fastbit_query(void *idx_handle, hid_t query_id, hid_t xxpl_id,
+ hid_t *dataspace_id)
+{
+ H5X_fastbit_t *fastbit = (H5X_fastbit_t *) idx_handle;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+ H5X_FASTBIT_LOG_DEBUG("Enter");
+
+
+done:
+ H5X_FASTBIT_LOG_DEBUG("Leave");
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5X_fastbit_query() */
+
+#endif /* H5_HAVE_FASTBIT */
diff --git a/src/H5Xpkg.h b/src/H5Xpkg.h
index fc3cfc8..04f7385 100644
--- a/src/H5Xpkg.h
+++ b/src/H5Xpkg.h
@@ -28,10 +28,17 @@
H5_DLLVAR const H5X_class_t H5X_DUMMY[1];
/*
- * Alacrity plugin
+ * ALACRITY plugin
*/
#ifdef H5_HAVE_ALACRITY
H5_DLLVAR const H5X_class_t H5X_ALACRITY[1];
#endif
+/*
+ * FastBit plugin
+ */
+#ifdef H5_HAVE_FASTBIT
+H5_DLLVAR const H5X_class_t H5X_FASTBIT[1];
+#endif
+
#endif /* _H5Xpkg_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index feb9518..051ba37 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,7 +90,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5Osdspace.c H5Oshared.c H5Ostab.c \
H5Oshmesg.c H5Otest.c H5Ounknown.c \
H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \
- H5Pxapl.c H5Pxcpl.c H5Pxxpl.c H5X.c H5Xdummy.c H5Xalacrity.c \
+ H5Pxapl.c H5Pxcpl.c H5Pxxpl.c H5X.c H5Xdummy.c H5Xalacrity.c H5Xfastbit.c \
H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \
H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \
H5Pgcpl.c H5Pvcpl.c H5Pmcpl.c H5Pmapl.c H5Pint.c H5Prcapl.c H5Ptrspl.c H5Ptrfpl.c \