Compare commits

...

37 Commits

Author SHA1 Message Date
Dana Robinson
8c92019eb0 Merge pull request #1641 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:feature/rados_vol to feature/rados_vol
* commit '3099afddc7723b6c46c800d606ebe02b40b84e1b':
  Fixed a missing prototype.
  Fix typo in cmp function
  Added a cmp function for the RADOS VOL connector.
2019-04-04 21:13:44 -05:00
Dana Robinson
3099afddc7 Fixed a missing prototype. 2019-04-04 21:11:57 -05:00
Dana Robinson
2ac68d421f Merge pull request #4 in ~DEROBINS/hdf5_der from HDFFV/hdf5:feature/rados_vol to feature/rados_vol
* commit '66ca98ad23e25b8bac13cdc6f772966b3cebe01b':
  H5VLrados: Add support for H5VL_FILE_IS_ACCESSIBLE
  Correct namespace handling
  Correct entry
  Add help info
  Update for namespace
  Add namespace option to dependencies
  Snapshot version 1.11 release 4. Update version to 1.11.5.
  Allow option to select NAMESPACE
  Correct examples for packaging
  Correct examples for packaging
  HDFFV-10741 -  add option to skip tool error stack tests
  HDFFV-10738 Wrong INTENT for H5LTread_dataset_double_f
  Specify the default VOL connector to use with an environment variable.
2019-04-04 16:12:46 -05:00
Dana Robinson
66ca98ad23 Merge branch 'develop' into feature/rados_vol 2019-04-04 13:22:47 -07:00
Jerome Soumagne
eed720d3e4 Merge pull request #1636 in HDFFV/hdf5 from ~JSOUMAGNE/hdf5:feature/rados_vol to feature/rados_vol
* commit 'b974164e8cfb571943970a864ba2f9fb664d7a72':
  H5VLrados: Add support for H5VL_FILE_IS_ACCESSIBLE
2019-04-04 12:52:32 -05:00
Dana Robinson
7c38ca9cf5 Fix typo in cmp function 2019-04-04 09:30:20 -07:00
Dana Robinson
537bde63d2 Merge branch 'feature/rados_vol' of https://bitbucket.hdfgroup.org/scm/~derobins/hdf5_der into feature/rados_vol 2019-04-03 20:57:07 -07:00
Dana Robinson
070aae61cd Added a cmp function for the RADOS VOL connector. 2019-04-03 20:54:00 -07:00
Jerome Soumagne
b974164e8c H5VLrados: Add support for H5VL_FILE_IS_ACCESSIBLE
Add H5VL_rados_oid_create_string_name()
2019-04-03 18:51:03 -05:00
Dana Robinson
c844a0497f Merge pull request #1632 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:feature/rados_vol to feature/rados_vol
* commit 'ae78522092017f58d87de41f21f71a943f42d78e':
  * Updated copyright information for RADOS/mobject-store code. * Removed an EFF macro * Test scripts use /bin/sh instead of bin/bash
2019-04-02 17:53:07 -05:00
Dana Robinson
ae78522092 * Updated copyright information for RADOS/mobject-store code.
* Removed an EFF macro
* Test scripts use /bin/sh instead of bin/bash
2019-04-02 15:50:20 -07:00
Dana Robinson
d1f47a53de Merge pull request #1619 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:feature/rados_vol to feature/rados_vol
* commit '05a07f595c3b26c8569309b70a5c5d2ad71a2ced': (331 commits)
  Updated the RADOS VOL code to correctly cleanup the connector info after file create and open.
  Added a document to describe running mobject on jelly.
  Renamed fapl to info in H5VLrados.c
  Changes that show the right way to iterate over enums.
  Changes that show the right way to iterate over enums.
  Test improvement Description     Moved the new tests to a more appropriate test function. Platforms tested:     Linux/64 (jelly)
  Used the H5_INC_ENUM macro to squash enum value increment warnings.
  Fixed HDFFV-10210 and HDFFV-10587 Description:     - Added parameter validation (HDFFV-10210)     - Added detection of division by zero (HDFFV-10587 - CVE-2018-17438)     - Fixed typos in various tests Platforms tested:     Linux/64 (jelly)     Linux/64 (platypus)     Darwin (osx1011test)
  Fix CMake error in name
  Hacked up the RADOS VOL connector code to use the latest VOL changes.
  Commented out memcpy overlap check while we investigate parallel filters issues.
  Yanked check for memcpy n > 0
  - Added H5MMprivate.h #includes where needed - Added casts to quiet H5MM_memcpy warnings - Removed char * casts from HDmemcpy
  Added an H5MM_memcpy call that checks for buffer overlap.
  Added the HDopen work-around on windows to pio_engine.c
  Adds _wopen support on Windows so that files with UTF-8 names can be opened.
  CMake: fix pthread linking to only be private
  Add API routines to retrieve, restore, reset, and free library state.
  Added a note of bug fix for HDFFV-10705.
  Fixed the MANIFEST
  ...
2019-03-26 02:43:47 -05:00
Dana Robinson
05a07f595c Updated the RADOS VOL code to correctly cleanup the connector
info after file create and open.
2019-03-26 02:41:12 -05:00
Dana Robinson
079edfc7bb Added a document to describe running mobject on jelly. 2019-03-26 00:09:51 -05:00
Dana Robinson
ca40a2026c Renamed fapl to info in H5VLrados.c 2019-03-25 20:00:50 -07:00
Dana Robinson
01d0586ce5 Merge branch 'rados_vol' into feature/rados_vol 2019-03-25 18:09:47 -07:00
Dana Robinson
e24bd8f117 Merge branch 'develop' into feature/rados_vol 2019-03-25 18:08:15 -07:00
Dana Robinson
23a23d7858 Hacked up the RADOS VOL connector code to use the latest VOL changes. 2019-03-19 09:52:19 -07:00
Dana Robinson
35c4b78dac Merge branch 'develop' into rados_vol 2019-03-19 06:42:58 -07:00
Dana Robinson
134f9c37be Moved files over from hdf5_rados. H5VLrados.c has not been updated
to work with the latest changes to develop.
2019-03-07 14:32:10 -08:00
Dana Robinson
1ec2de8c72 Merge branch 'develop' into rados_vol 2019-03-07 14:01:20 -08:00
Dana Robinson
be1fc58875 * Updated Makefile.am for the examples directory, making it more
like the one in hdf5_rados.
* Added a BRANCH.txt file that describes the branch and how
  to build.
* Added a run_rados_examples.sh script to examples. This builds
  and runs the RADOS VOL connector programs in a sane order.
2019-02-18 14:34:43 -08:00
Dana Robinson
bb19438495 Merge branch 'develop' into rados_vol 2019-02-18 13:23:15 -08:00
Dana Robinson
6d7835fced Merge branch 'develop' into rados_vol 2019-02-14 12:14:44 -08:00
Dana Robinson
25c17219d4 Merge branch 'develop' into rados_vol 2019-02-08 12:02:34 -08:00
Dana Robinson
4535dd7d58 Merge branch 'develop' into rados_vol 2019-01-14 22:48:55 -08:00
Dana Robinson
f33d4d03ef Renamed H5VL_rados_fapl_t to H5VL_rados_info_t to be in line
with recent VOL naming changes.
2018-12-07 22:56:29 -08:00
Dana Robinson
43ebf4637a Added some things that were missed from the develop merge. 2018-12-07 22:50:10 -08:00
Dana Robinson
d490f933cf Merge branch 'develop' into rados_vol and update
VOL connector code.
2018-12-07 17:14:26 -08:00
Dana Robinson
2d46ee0622 Merge branch 'rados_vol_develop' of https://bitbucket.hdfgroup.org/scm/~derobins/hdf5_der into rados_vol_develop 2018-12-05 00:24:30 -08:00
Dana Robinson
588f6b69ec Tweaks to the RADOS VOL connector code. 2018-12-05 00:23:31 -08:00
Dana Robinson
82b1809e3c Merge branch 'develop' into rados_vol_develop 2018-12-04 17:56:15 -08:00
Dana Robinson
5497b72ae0 Added a file that describes how to build this branch. 2018-11-01 14:50:02 -07:00
Dana Robinson
cd7403bb99 Updated MANIFEST 2018-11-01 14:43:44 -07:00
Dana Robinson
8af2e3cff6 Merge branch 'develop' into rados_vol_develop 2018-11-01 14:40:17 -07:00
Dana Robinson
633c9db2ce Updated the autotools to support RADOS. 2018-11-01 14:38:55 -07:00
Dana Robinson
934ef8bec0 Added RADOS files (not wired up yet) 2018-10-19 11:48:02 -07:00
29 changed files with 6363 additions and 7 deletions

55
BRANCH.txt Normal file
View File

@@ -0,0 +1,55 @@
This branch is a merge of Neil's original RADOS VOL connector
branch and develop and is kept in sync with the changes
in develop.
************
* BUILDING *
************
The code for the RADOS VOL connector lies entirely in
the H5VLrados* files in the src directory. The connector
is built as a static part of the library.
YOU MUST BUILD THE PARALLEL LIBRARY (--enable-parallel
in the autotools).
The autotools configuration files have been updated with
a --with-rados= option. CMake has not yet been updated
so you'll have to add the -I, -l, and -L flags yourself,
if necessary.
I build this branch on Ubuntu, with the system default
librados-dev package and its dependencies installed. On
Ubuntu, the librados libraries are installed in an odd
location, so I simplify the configure line by creating
an opt/librados directory in my home directory and
creating symlinks to the include and lib directories in
that.
***********
* TESTING *
***********
There are no tests for the RADOS VOL connector in the main
library, so running 'make check' won't provide much
information.
Once the library has been built, you can run some smoke
checks by running 'make install' and going to the
share/hdf5_examples/c/ directory and running the
run_rados_examples.sh script found there. That will
create a small pool (or clear it out if it exists)
and run all the example scripts in a sane order.
*** YOU WILL NEED TO COPY YOUR ceph.conf FILE
*** INTO THIS DIRECTORY FIRST!!!
This script is not as sophisticated as our usual test
scripts, so don't be surprised if it fails and you have
to run the tests manually.
Also note that CMake installs HDF5 to the system by
default, even in development branches. The autotools
will install HDF5 to an hdf5 subdirectory of the
build directory by default in development branches.

23
HOW_TO_BUILD.txt Normal file
View File

@@ -0,0 +1,23 @@
How to build this branch:
1) Install RADOS
Debian/Ubuntu
sudo apt-get install librados-dev
RHEL/CentOS
sudo yum install librados2-devel
2) Configure (autotools only)
You will need to use --with-rados and set the include and library paths. You'll also need to build the parallel library.
Using the default locations on Ubuntu:
../develop/configure --enable-parallel --with-rados=/usr/include/rados,/usr/lib 2>&1 | tee configure.out
3) Build and run tests
The 'tests' are the RADOS examples which are run via 'make check-install'

View File

@@ -23,9 +23,12 @@
./.autom4te.cfg _DO_NOT_DISTRIBUTE_
./.h5chkright.ini _DO_NOT_DISTRIBUTE_
./ACKNOWLEDGMENTS
./BRANCH.txt
./COPYING
./COPYING_LBNL_HDF5
./HOW_TO_BUILD.txt
./MANIFEST
./MOBJECT_ON_JELLY.txt _DO_NOT_DISTRIBUTE_
./Makefile.dist
./Makefile.am
./README.txt
@@ -166,6 +169,19 @@
./examples/h5_select.c
./examples/h5_attribute.c
./examples/h5_mount.c
./examples/h5rados_dset_create.c
./examples/h5rados_dset_open.c
./examples/h5rados_dset_read.c
./examples/h5rados_dset_rpartial.c
./examples/h5rados_dset_rss.c
./examples/h5rados_dset_wpartial.c
./examples/h5rados_dset_write.c
./examples/h5rados_dset_wss.c
./examples/h5rados_example.h
./examples/h5rados_file_create.c
./examples/h5rados_file_open.c
./examples/h5rados_group_create.c
./examples/h5rados_group_open.c
./examples/h5_reference.c
./examples/h5_ref2reg.c
./examples/h5_shared_mesg.c
@@ -178,6 +194,8 @@
./examples/h5_vds-percival.c
./examples/h5_vds-percival-unlim.c
./examples/h5_vds-percival-unlim-maxmin.c
./examples/run_mobject_examples.sh
./examples/run_rados_examples.sh
./examples/testh5cc.sh.in
./examples/README
@@ -918,6 +936,9 @@
./src/H5VLpkg.h
./src/H5VLprivate.h
./src/H5VLpublic.h
./src/H5VLrados.c
./src/H5VLrados.h
./src/H5VLrados_public.h
./src/H5VM.c
./src/H5VMprivate.h
./src/H5WB.c

39
MOBJECT_ON_JELLY.txt Normal file
View File

@@ -0,0 +1,39 @@
How to do an out-of-source build of the hdf5_rados branch on jelly.
Assumes you are in a separate build directory and that the source is in
a directory named hdf5_rados.
First run autogen in the source directory.
./autogen.sh
Now set up the environment. We're using Jerome's spack packages.
module load GCC
export SPACK_ROOT=/mnt/hdf/jsoumagne/spack
source $SPACK_ROOT/share/spack/setup-env.sh
source <(spack module tcl loads --dependencies mobject)
export CFLAGS=`pkg-config --cflags mobject-store`
export LDFLAGS=`pkg-config --libs mobject-store`
export CPPFLAGS=-DHDF5_USE_MOBJECT
Now change to your build directory and configure/build.
../hdf5_rados/configure --enable-parallel
make -j5
make install
Now switch to the examples directory and test mobject. You
will have to fire up mobject-store. I do this in the same
shell and set it to be a background test with CTRL-Z and bg.
cd hdf5/share/hdf5_examples/c
export MOBJECT_CLUSTER_FILE=/tmp/mobject-cluster-test.gid
mobject-server-daemon na+sm /tmp/mobject-cluster-test.gid
CTRL-Z
bg
sh run_mobject_examples.sh

View File

@@ -173,6 +173,7 @@ $Source = "";
"H5VL_request_notify_t" => "x",
"H5Z_func_t" => "x",
"H5Z_filter_func_t" => "x",
"rados_t" => "x",
"va_list" => "x",
"size_t" => "z",
"H5Z_SO_scale_type_t" => "Za",

View File

@@ -1329,6 +1329,85 @@ case "X-$withval" in
;;
esac
## ----------------------------------------------------------------------
## Is RADOS present? It has a header file 'librados.h' and a library
## '-lrados' and their locations might be specified with the '--with-rados'
## command-line switch. The value is an include path and/or a library path.
## If the library path is specified then it must be preceded by a comma.
##
AC_SUBST([HAVE_RADOS])
## Default is not present
HAVE_RADOS=no
AC_ARG_WITH([rados],
[AS_HELP_STRING([--with-rados=DIR],
[Use RADOS [default=no]])],,
[withval=no])
case $withval in
yes)
HAVE_RADOS="yes"
AC_CHECK_HEADERS([librados.h],, [unset HAVE_RADOS])
if test "x$HAVE_RADOS" = "xyes"; then
AC_CHECK_LIB([rados], [rados_read],, [unset HAVE_RADOS])
fi
if test -z "$HAVE_RADOS" -a -n "$HDF5_CONFIG_ABORT"; then
AC_MSG_ERROR([couldn't find RADOS library])
fi
;;
no)
HAVE_RADOS="no"
AC_MSG_CHECKING([for RADOS library])
AC_MSG_RESULT([suppressed])
;;
*)
HAVE_RADOS="yes"
case "$withval" in
*,*)
rados_inc="`echo $withval |cut -f1 -d,`"
rados_lib="`echo $withval |cut -f2 -d, -s`"
;;
*)
if test -n "$withval"; then
rados_inc="$withval/include"
rados_lib="$withval/lib"
fi
;;
esac
saved_CPPFLAGS="$CPPFLAGS"
saved_AM_CPPFLAGS="$AM_CPPFLAGS"
saved_LDFLAGS="$LDFLAGS"
saved_AM_LDFLAGS="$AM_LDFLAGS"
if test -n "$rados_inc"; then
CPPFLAGS="$CPPFLAGS -I$rados_inc"
AM_CPPFLAGS="$AM_CPPFLAGS -I$rados_inc"
fi
AC_CHECK_HEADERS([librados.h],,[CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_RADOS])
if test -n "$rados_lib"; then
LDFLAGS="$LDFLAGS -L$rados_lib"
AM_LDFLAGS="$AM_LDFLAGS -L$rados_lib"
fi
if test "x$HAVE_RADOS" = "xyes"; then
AC_CHECK_LIB([rados], [rados_read],, [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_RADOS])
fi
if test -z "$HAVE_RADOS" -a -n "$HDF5_CONFIG_ABORT"; then
AC_MSG_ERROR([couldn't find RADOS library])
fi
;;
esac
if test "x$HAVE_RADOS" = "xyes" ; then
AC_DEFINE([HAVE_RADOS], [1], [Define if RADOS is enabled])
fi
## ----------------------------------------------------------------------
## Make the external filters list available to *.in files
## At this point it's unset (no external filters by default) but it

View File

@@ -20,7 +20,10 @@
include $(top_srcdir)/config/commence.am
if BUILD_PARALLEL_CONDITIONAL
EXAMPLE_PROG_PARA = ph5example
EXAMPLE_PROG_PARA = ph5example h5rados_file_create h5rados_file_open \
h5rados_group_create h5rados_group_open h5rados_dset_create \
h5rados_dset_open h5rados_dset_write h5rados_dset_read \
h5rados_dset_wpartial h5rados_dset_rpartial
endif
INSTALL_SCRIPT_FILES = run-c-ex.sh
@@ -38,6 +41,7 @@ EXAMPLE_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \
h5_ref2reg h5_extlink h5_elink_unix2win h5_shared_mesg h5_vds h5_vds-exc \
h5_vds-exclim h5_vds-eiger h5_vds-simpleIO h5_vds-percival \
h5_vds-percival-unlim h5_vds-percival-unlim-maxmin
TEST_SCRIPT=testh5cc.sh
TEST_EXAMPLES_SCRIPT=$(INSTALL_SCRIPT_FILES)
@@ -50,8 +54,12 @@ INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \
h5_reference.c h5_drivers.c h5_extlink.c h5_elink_unix2win.c \
h5_ref2reg.c h5_shared_mesg.c ph5example.c h5_vds.c h5_vds-exc.c \
h5_vds-exclim.c h5_vds-eiger.c h5_vds-simpleIO.c h5_vds-percival.c \
h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c
h5_vds-percival-unlim.c h5_vds-percival-unlim-maxmin.c \
h5rados_example.h h5rados_file_create.c h5rados_file_open.c \
h5rados_dset_create.c h5rados_dset_open.c h5rados_dset_read.c h5rados_dset_rpartial.c \
h5rados_dset_rss.c h5rados_dset_wpartial.c h5rados_dset_write.c h5rados_dset_wss.c \
h5rados_group_create.c h5rados_group_open.c \
h5rados_example.h run_rados_examples.sh run_mobject_examples.sh
# How to build examples, using installed version of h5cc
@@ -127,6 +135,16 @@ h5_vds-simpleIO: $(srcdir)/h5_vds-simpleIO.c
h5_vds-percival: $(srcdir)/h5_vds-percival.c
h5_vds-percival-unlim: $(srcdir)/h5_vds-percival-unlim.c
h5_vds-percival-unlim-maxmin: $(srcdir)/h5_vds-percival-unlim-maxmin.c
h5rados_file_create: $(srcdir)/h5rados_file_create.c
h5rados_file_open: $(srcdir)/h5rados_file_open.c
h5rados_group_create: $(srcdir)/h5rados_group_create.c
h5rados_group_open: $(srcdir)/h5rados_group_open.c
h5rados_dset_create: $(srcdir)/h5rados_dset_create.c
h5rados_dset_open: $(srcdir)/h5rados_dset_open.c
h5rados_dset_write: $(srcdir)/h5rados_dset_write.c
h5rados_dset_read: $(srcdir)/h5rados_dset_read.c
h5rados_dset_wpartial: $(srcdir)/h5rados_dset_wpartial.c
h5rados_dset_rpartial: $(srcdir)/h5rados_dset_rpartial.c
if BUILD_SHARED_SZIP_CONDITIONAL
LD_LIBRARY_PATH=$(LL_PATH)

View File

@@ -0,0 +1,102 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, space = -1, fapl = -1, dcpl = H5P_DEFAULT;
hsize_t dims[2] = {4, 6};
hsize_t cdims[2];
(void)MPI_Init(&argc, &argv);
if((argc != 3) && (argc != 5))
PRINTF_ERROR("argc is not 3 or 5\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Set up DCPL */
if(argc == 5) {
cdims[0] = (hsize_t)atoi(argv[3]);
cdims[1] = (hsize_t)atoi(argv[4]);
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
ERROR;
if(H5Pset_chunk(dcpl, 2, cdims) < 0)
ERROR;
} /* end if */
/* Set up dataspace */
if((space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
printf("Creating dataset\n");
/* Create dataset */
if((dset = H5Dcreate2(file, argv[2], H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
ERROR;
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Sclose(space) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
if((dcpl != H5P_DEFAULT) && (H5Pclose(dcpl) < 0))
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Sclose(space);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,144 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, fapl = -1, space = -1, type = -1, dcpl = -1, dapl = -1, def_dcpl = -1, def_dapl = -1;
int ndims;
hsize_t dims[2];
htri_t tri_ret;
(void)MPI_Init(&argc, &argv);
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0)
ERROR;
printf("Opening dataset\n");
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
/* Check dataset dataspace */
if((space = H5Dget_space(dset)) < 0)
ERROR;
if((ndims = H5Sget_simple_extent_ndims(space)) < 0)
ERROR;
if(ndims != 2)
PRINTF_ERROR("ndims == %d, expected 2\n", ndims);
if(H5Sget_simple_extent_dims(space, dims, NULL) < 0)
ERROR;
if(dims[0] != 4)
PRINTF_ERROR("dims[0] == %d, expected 4\n", (int)dims[0]);
if(dims[1] != 6)
PRINTF_ERROR("dims[1] == %d, expected 6\n", (int)dims[1]);
/* Check dataset datatype */
if((type = H5Dget_type(dset)) < 0)
ERROR;
if((tri_ret = H5Tequal(type, H5T_NATIVE_INT)) < 0)
ERROR;
if(!tri_ret)
PRINTF_ERROR("datatype does not equal H5T_NATIVE_INT\n");
/* Check DCPL */
if((dcpl = H5Dget_create_plist(dset)) < 0)
ERROR;
if((def_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
ERROR;
if((tri_ret = H5Pequal(dcpl, def_dcpl)) < 0)
ERROR;
if(!tri_ret)
PRINTF_ERROR("DCPL does not equal default\n");
/* Check DAPL */
if((dapl = H5Dget_access_plist(dset)) < 0)
ERROR;
if((def_dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
ERROR;
if((tri_ret = H5Pequal(dapl, def_dapl)) < 0)
ERROR;
if(!tri_ret)
PRINTF_ERROR("DAPL does not equal default\n");
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
if(H5Sclose(space) < 0)
ERROR;
if(H5Tclose(type) < 0)
ERROR;
if(H5Pclose(dcpl) < 0)
ERROR;
if(H5Pclose(dapl) < 0)
ERROR;
if(H5Pclose(def_dcpl) < 0)
ERROR;
if(H5Pclose(def_dapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Pclose(fapl);
H5Sclose(space);
H5Tclose(type);
H5Pclose(dcpl);
H5Pclose(dapl);
H5Pclose(def_dcpl);
H5Pclose(def_dapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,104 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
#include <time.h>
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, fapl = -1;
int buf[4][6];
int i, j;
(void)MPI_Init(&argc, &argv);
/* Seed random number generator */
srand(time(NULL));
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0)
ERROR;
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
printf("Reading dataset\n");
/* Initialize buffer */
for(i = 0; i < 4; i++)
for(j = 0; j < 6; j++)
buf[i][j] = -1;
/* Read data */
if(H5Dread(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
ERROR;
/* Print buffer */
printf("Successfully read data. Buffer is:\n");
for(i = 0; i < 4; i++) {
for(j = 0; j < 6; j++)
printf("%d ", buf[i][j]);
printf("\n");
}
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,160 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
#include <time.h>
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, file_space = -1, mem_space = -1, fapl = -1;
hsize_t dims[2] = {4, 6};
hsize_t start[2], count[2];
int buf[4][6];
int rank, mpi_size;
char *file_sel_str[2] = {"XXX...", "...XXX"};
int i, j;
(void)MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
if(mpi_size > 2)
PRINTF_ERROR("mpi_size > 2\n");
/* Seed random number generator */
srand(time(NULL));
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
if(rank == 1)
MPI_Barrier(MPI_COMM_WORLD);
printf("---------------Rank %d---------------\n", rank);
printf("Selecting elements denoted with X\n");
printf("Memory File\n");
printf("...... %s\n", file_sel_str[rank]);
for(i = 1; i < 4; i++)
printf(".XXXX. %s\n", file_sel_str[rank]);
if(rank == 0)
MPI_Barrier(MPI_COMM_WORLD);
else
printf("Reading dataset\n");
MPI_Barrier(MPI_COMM_WORLD);
/* Set up dataspaces */
if((file_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
if((mem_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
start[0] = 0;
start[1] = 3 * rank;
count[0] = 4;
count[1] = 3;
if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
ERROR;
start[0] = 1;
start[1] = 1;
count[0] = 3;
count[1] = 4;
if(H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
ERROR;
/* Initialize buffer */
for(i = 0; i < 4; i++)
for(j = 0; j < 6; j++)
buf[i][j] = -1;
/* Read data */
if(H5Dread(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf) < 0)
ERROR;
if(rank == 1)
MPI_Barrier(MPI_COMM_WORLD);
/* Fill and print buffer */
printf("---------------Rank %d---------------\n", rank);
printf("Successfully read data. Buffer is:\n");
for(i = 0; i < 4; i++) {
for(j = 0; j < 6; j++)
printf("%d ", buf[i][j]);
printf("\n");
}
if(rank == 0)
MPI_Barrier(MPI_COMM_WORLD);
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Sclose(file_space) < 0)
ERROR;
if(H5Sclose(mem_space) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Sclose(file_space);
H5Sclose(mem_space);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

152
examples/h5rados_dset_rss.c Normal file
View File

@@ -0,0 +1,152 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, file_space = -1, mem_space = -1, fapl = -1;
hsize_t dims[2] = {4, 6};
hsize_t fstart[2], count[2], mstart[2];
int buf[4][6];
int i, j;
(void)MPI_Init(&argc, &argv);
if(argc != 9)
PRINTF_ERROR("argc != 9\n");
fstart[0] = (hsize_t)atoi(argv[3]);
fstart[1] = (hsize_t)atoi(argv[4]);
count[0] = (hsize_t)atoi(argv[5]);
count[1] = (hsize_t)atoi(argv[6]);
mstart[0] = (hsize_t)atoi(argv[7]);
mstart[1] = (hsize_t)atoi(argv[8]);
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, "ceph.conf") < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
printf("Selecting elements denoted with X\n");
printf("File:\n");
for(i = 0; i < 4; i++) {
if((i >= fstart[0]) && (i < fstart[0] + count[0])) {
for(j = 0; j < 6; j++)
if((j >= fstart[1]) && (j < fstart[1] + count[1]))
printf("X");
else
printf(".");
printf("\n");
}
else
printf("......\n");
}
printf("\nMemory:\n");
for(i = 0; i < 4; i++) {
if((i >= mstart[0]) && (i < mstart[0] + count[0])) {
for(j = 0; j < 6; j++)
if((j >= mstart[1]) && (j < mstart[1] + count[1]))
printf("X");
else
printf(".");
printf("\n");
}
else
printf("......\n");
}
/* Set up dataspaces */
if((file_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
if((mem_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, fstart, NULL, count, NULL) < 0)
ERROR;
if(H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, mstart, NULL, count, NULL) < 0)
ERROR;
/* Initialize buffer */
for(i = 0; i < 4; i++)
for(j = 0; j < 6; j++)
buf[i][j] = -1;
/* Read data */
if(H5Dread(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf) < 0)
ERROR;
/* Fill and print buffer */
printf("Successfully read data. Buffer is:\n");
for(i = 0; i < 4; i++) {
for(j = 0; j < 6; j++)
printf("%d ", buf[i][j]);
printf("\n");
}
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Sclose(file_space) < 0)
ERROR;
if(H5Sclose(mem_space) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Sclose(file_space);
H5Sclose(mem_space);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,147 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
#include <time.h>
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, file_space = -1, mem_space = -1, fapl = -1;
hsize_t dims[2] = {4, 6};
hsize_t start[2], count[2];
int buf[4][6];
int rank, mpi_size;
char *file_sel_str[2] = {"XXX...", "...XXX"};
int i, j;
(void)MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
if(mpi_size != 2)
PRINTF_ERROR("mpi_size != 2\n");
/* Seed random number generator */
srand(time(NULL));
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
if(rank == 1)
MPI_Barrier(MPI_COMM_WORLD);
printf("---------------Rank %d---------------\n", rank);
printf("Selecting elements denoted with X\n");
printf("Memory File\n");
printf("...... %s\n", file_sel_str[rank]);
for(i = 1; i < 4; i++)
printf(".XXXX. %s\n", file_sel_str[rank]);
/* Fill and print buffer */
printf("Writing data. Buffer is:\n");
for(i = 0; i < 4; i++) {
for(j = 0; j < 6; j++) {
buf[i][j] = rand() % 10;
printf("%d ", buf[i][j]);
}
printf("\n");
}
if(rank == 0)
MPI_Barrier(MPI_COMM_WORLD);
/* Set up dataspaces */
if((file_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
if((mem_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
start[0] = 0;
start[1] = 3 * rank;
count[0] = 4;
count[1] = 3;
if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
ERROR;
start[0] = 1;
start[1] = 1;
count[0] = 3;
count[1] = 4;
if(H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
ERROR;
/* Write data */
if(H5Dwrite(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf) < 0)
ERROR;
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Sclose(file_space) < 0)
ERROR;
if(H5Sclose(mem_space) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Sclose(file_space);
H5Sclose(mem_space);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,99 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
#include <time.h>
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, fapl = -1;
int buf[4][6];
int i, j;
(void)MPI_Init(&argc, &argv);
/* Seed random number generator */
srand(time(NULL));
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
/* Fill and print buffer */
printf("Writing data. Buffer is:\n");
for(i = 0; i < 4; i++) {
for(j = 0; j < 6; j++) {
buf[i][j] = rand() % 10;
printf("%d ", buf[i][j]);
}
printf("\n");
}
/* Write data */
if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
ERROR;
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

153
examples/h5rados_dset_wss.c Normal file
View File

@@ -0,0 +1,153 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
#include <time.h>
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, dset = -1, file_space = -1, mem_space = -1, fapl = -1;
hsize_t dims[2] = {4, 6};
hsize_t mstart[2], count[2], fstart[2];
int buf[4][6];
int i, j;
(void)MPI_Init(&argc, &argv);
/* Seed random number generator */
srand(time(NULL));
if(argc != 9)
PRINTF_ERROR("argc != 9\n");
mstart[0] = (hsize_t)atoi(argv[3]);
mstart[1] = (hsize_t)atoi(argv[4]);
count[0] = (hsize_t)atoi(argv[5]);
count[1] = (hsize_t)atoi(argv[6]);
fstart[0] = (hsize_t)atoi(argv[7]);
fstart[1] = (hsize_t)atoi(argv[8]);
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, "ceph.conf") < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
/* Open dataset */
if((dset = H5Dopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
printf("Selecting elements denoted with X\n");
printf("Memory:\n");
for(i = 0; i < 4; i++) {
if((i >= mstart[0]) && (i < mstart[0] + count[0])) {
for(j = 0; j < 6; j++)
if((j >= mstart[1]) && (j < mstart[1] + count[1]))
printf("X");
else
printf(".");
printf("\n");
}
else
printf("......\n");
}
printf("\nFile:\n");
for(i = 0; i < 4; i++) {
if((i >= fstart[0]) && (i < fstart[0] + count[0])) {
for(j = 0; j < 6; j++)
if((j >= fstart[1]) && (j < fstart[1] + count[1]))
printf("X");
else
printf(".");
printf("\n");
}
else
printf("......\n");
}
/* Fill and print buffer */
printf("Writing data. Buffer is:\n");
for(i = 0; i < 4; i++) {
for(j = 0; j < 6; j++) {
buf[i][j] = rand() % 10;
printf("%d ", buf[i][j]);
}
printf("\n");
}
/* Set up dataspaces */
if((file_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
if((mem_space = H5Screate_simple(2, dims, NULL)) < 0)
ERROR;
if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, fstart, NULL, count, NULL) < 0)
ERROR;
if(H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, mstart, NULL, count, NULL) < 0)
ERROR;
/* Write data */
if(H5Dwrite(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf) < 0)
ERROR;
/* Close */
if(H5Dclose(dset) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Sclose(file_space) < 0)
ERROR;
if(H5Sclose(mem_space) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Dclose(dset);
H5Fclose(file);
H5Sclose(file_space);
H5Sclose(mem_space);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,37 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <mpi.h>
#include <hdf5.h>
#include <H5VLrados_public.h>
/* Macros for printing standard messages and issuing errors */
#define AT() printf (" at %s:%d in %s()...\n", __FILE__, __LINE__, __FUNCTION__)
#define FAILED() do {puts("*FAILED*");fflush(stdout);} while(0)
#define ERROR do {FAILED(); AT(); goto error;} while(0)
#define PRINTF_ERROR(...) do {FAILED(); AT(); printf(" " __VA_ARGS__); printf("\n"); goto error;} while(0)
/* Config file */
#ifdef HDF5_USE_MOBJECT
#define CEPH_CONFIG_FILE "/tmp/mobject-cluster-test.gid"
#else
#define CEPH_CONFIG_FILE "ceph.conf"
#endif

View File

@@ -0,0 +1,72 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, fapl = -1;
(void)MPI_Init(&argc, &argv);
if(argc != 2)
PRINTF_ERROR("argc != 2\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Create file */
if((file = H5Fcreate(argv[1], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
ERROR;
/* Close */
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,72 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, fapl = -1;
(void)MPI_Init(&argc, &argv);
if(argc != 2)
PRINTF_ERROR("argc != 2\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Create file */
if((file = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0)
ERROR;
/* Close */
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,81 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, fapl = -1, grp = -1;
(void)MPI_Init(&argc, &argv);
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* OPEN file */
if((file = H5Fopen(argv[1], H5F_ACC_RDWR, fapl)) < 0)
ERROR;
printf("Creating group\n");
/* Create group */
if((grp = H5Gcreate2(file, argv[2], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
ERROR;
/* Close */
if(H5Gclose(grp) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Gclose(grp);
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -0,0 +1,81 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
#include "h5rados_example.h"
int main(int argc, char *argv[]) {
rados_t cluster;
char *pool = "mypool";
hid_t file = -1, fapl = -1, grp = -1;
(void)MPI_Init(&argc, &argv);
if(argc != 3)
PRINTF_ERROR("argc != 3\n");
if(rados_create(&cluster, NULL) < 0)
ERROR;
if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
if(H5VLrados_init(cluster, pool) < 0)
ERROR;
/* Set up FAPL */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
ERROR;
if(H5Pset_fapl_rados(fapl, MPI_COMM_WORLD, MPI_INFO_NULL) < 0)
ERROR;
if(H5Pset_all_coll_metadata_ops(fapl, true) < 0)
ERROR;
/* Open file */
if((file = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0)
ERROR;
printf("Opening group\n");
/* Open group */
if((grp = H5Gopen2(file, argv[2], H5P_DEFAULT)) < 0)
ERROR;
/* Close */
if(H5Gclose(grp) < 0)
ERROR;
if(H5Fclose(file) < 0)
ERROR;
if(H5Pclose(fapl) < 0)
ERROR;
printf("Success\n");
(void)MPI_Finalize();
return 0;
error:
H5E_BEGIN_TRY {
H5Gclose(grp);
H5Fclose(file);
H5Pclose(fapl);
} H5E_END_TRY;
(void)MPI_Finalize();
return 1;
}

View File

@@ -136,7 +136,7 @@ then
rm h5_vds-percival &&\
RunTest h5_vds-percival-unlim &&\
rm h5_vds-percival-unlim &&\
RunTest h5_vds-percival-unlim-maxmin&&\
RunTest h5_vds-percival-unlim-maxmin &&\
rm h5_vds-percival-unlim-maxmin &&\
RunTest h5_vds &&\
rm h5_vds); then

View File

@@ -0,0 +1,61 @@
#! /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.
#
# This source code was developed under the Mochi project
# (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
# Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
# Build mobject examples.
# Assumes mobject stuff can be found
echo "Building mobject examples"
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_file_create h5rados_file_create.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_file_open h5rados_file_open.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_dset_create h5rados_dset_create.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_dset_open h5rados_dset_open.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_group_create h5rados_group_create.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_group_open h5rados_group_open.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_dset_write h5rados_dset_write.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_dset_read h5rados_dset_read.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_dset_rpartial h5rados_dset_rpartial.c
../../../bin/h5pcc -DHDF5_USE_MOBJECT -g -o h5rados_dset_wpartial h5rados_dset_wpartial.c
echo "DONE"
echo
# Run the mobject examples
echo "Running mobject examples"
# File create/open
echo "./h5rados_file_create testfile"
mpiexec -n 2 ./h5rados_file_create testfile
echo "./h5rados_file_open testfile"
mpiexec -n 2 ./h5rados_file_open testfile
# Dataset create/open
echo "./h5rados_dset_create testfile testdset"
mpiexec -n 2 ./h5rados_dset_create testfile testdset
echo "./h5rados_dset_open testfile testdset"
mpiexec -n 2 ./h5rados_dset_open testfile testdset
# Group create/open
echo "./h5rados_group_create testfile testgroup"
mpiexec -n 2 ./h5rados_group_create testfile testgroup
echo "./h5rados_group_open testfile testgroup"
mpiexec -n 2 ./h5rados_group_open testfile testgroup
# Dataset read/write
echo "./h5rados_dset_write testfile testdset"
mpiexec -n 2 ./h5rados_dset_write testfile testdset
echo "./h5rados_dset_read testfile testdset"
mpiexec -n 2 ./h5rados_dset_read testfile testdset
# Dataset read/write (partial)
echo "./h5rados_dset_wpartial testfile testdset"
mpiexec -n 2 ./h5rados_dset_wpartial testfile testdset
echo "./h5rados_dset_rpartial testfile testdset"
mpiexec -n 2 ./h5rados_dset_rpartial testfile testdset
echo

84
examples/run_rados_examples.sh Executable file
View File

@@ -0,0 +1,84 @@
#! /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.
#
# This source code was developed under the Mochi project
# (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
# Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
# Build RADOS examples.
# Assumes RADOS can be found in the usual location.
echo "Building RADOS examples"
../../../bin/h5pcc -g -o h5rados_file_create h5rados_file_create.c -lrados
../../../bin/h5pcc -g -o h5rados_file_open h5rados_file_open.c -lrados
../../../bin/h5pcc -g -o h5rados_dset_create h5rados_dset_create.c -lrados
../../../bin/h5pcc -g -o h5rados_dset_open h5rados_dset_open.c -lrados
../../../bin/h5pcc -g -o h5rados_group_create h5rados_group_create.c -lrados
../../../bin/h5pcc -g -o h5rados_group_open h5rados_group_open.c -lrados
../../../bin/h5pcc -g -o h5rados_dset_write h5rados_dset_write.c -lrados
../../../bin/h5pcc -g -o h5rados_dset_read h5rados_dset_read.c -lrados
../../../bin/h5pcc -g -o h5rados_dset_rpartial h5rados_dset_rpartial.c -lrados
../../../bin/h5pcc -g -o h5rados_dset_wpartial h5rados_dset_wpartial.c -lrados
echo "DONE"
echo
# Create the pool
echo "Creating the test pool"
echo "(Ceph makes it hard to delete pools, so we never do that"
echo "and you may see a message that the pool already exists.)"
ceph osd pool create mypool 128
echo
# Dump some Ceph info
echo "Pool status at start of tests:"
rados -p mypool ls
echo
# Clean out the test pool
echo "Cleaning out the test pool"
for i in $(rados -p mypool ls); do echo $i; rados -p mypool rm $i; done
echo
# Run the RADOS examples
echo "Running RADOS examples"
# File create/open
echo "./h5rados_file_create testfile"
mpiexec -n 2 ./h5rados_file_create testfile
echo "./h5rados_file_open testfile"
mpiexec -n 2 ./h5rados_file_open testfile
# Dataset create/open
echo "./h5rados_dset_create testfile testdset"
mpiexec -n 2 ./h5rados_dset_create testfile testdset
echo "./h5rados_dset_open testfile testdset"
mpiexec -n 2 ./h5rados_dset_open testfile testdset
# Group create/open
echo "./h5rados_group_create testfile testgroup"
mpiexec -n 2 ./h5rados_group_create testfile testgroup
echo "./h5rados_group_open testfile testgroup"
mpiexec -n 2 ./h5rados_group_open testfile testgroup
# Dataset read/write
echo "./h5rados_dset_write testfile testdset"
mpiexec -n 2 ./h5rados_dset_write testfile testdset
echo "./h5rados_dset_read testfile testdset"
mpiexec -n 2 ./h5rados_dset_read testfile testdset
# Dataset read/write (partial)
echo "./h5rados_dset_wpartial testfile testdset"
mpiexec -n 2 ./h5rados_dset_wpartial testfile testdset
echo "./h5rados_dset_rpartial testfile testdset"
mpiexec -n 2 ./h5rados_dset_rpartial testfile testdset
echo
# Dump the Ceph info again
echo "Pool status at end of tests:"
rados -p mypool ls
echo

View File

@@ -5049,6 +5049,34 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info)
if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Call the internal function */
if(H5P_get_vol_info(plist, vol_info) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_vol_info() */
/*-------------------------------------------------------------------------
* Function: H5P_get_vol_info
*
* Purpose: Private version of H5Pget_vol_info().
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
H5P_get_vol_info(H5P_genplist_t *plist, void **vol_info)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(plist);
/* Get the current VOL info */
if(TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) {
void *new_connector_info = NULL; /* Copy of connector info */
@@ -5078,8 +5106,8 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_vol_info() */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P_get_vol_info() */
/*-------------------------------------------------------------------------

View File

@@ -170,6 +170,7 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name);
H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name);
H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2);
H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass);
H5_DLL herr_t H5P_get_vol_info(H5P_genplist_t *plist, void **vol_info);
/* Internal helper routines */
H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops,

4360
src/H5VLrados.c Normal file

File diff suppressed because it is too large Load Diff

125
src/H5VLrados.h Normal file
View File

@@ -0,0 +1,125 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
/*
* Programmer: Neil Fortner <nfortne2@hdfgroup.org>
* December, 2017
*
* Purpose: The private header file for the RADOS VOL plugin.
*/
#ifndef H5VLrados_H
#define H5VLrados_H
/* Include package's public header */
#include "H5VLrados_public.h"
#define HDF5_VOL_RADOS_VERSION_1 1 /* Version number of RADOS VOL plugin */
#ifdef __cplusplus
extern "C" {
#endif
/* FAPL property to tell the VOL plugin to open a saved snapshot when opening a
* file */
#define H5VL_RADOS_SNAP_OPEN_ID "rados_snap_open"
/* Common object and attribute information */
typedef struct H5VL_rados_item_t {
H5I_type_t type;
struct H5VL_rados_file_t *file;
int rc;
} H5VL_rados_item_t;
/* Common object information */
typedef struct H5VL_rados_obj_t {
H5VL_rados_item_t item; /* Must be first */
uint64_t bin_oid;
char *oid;
} H5VL_rados_obj_t;
/* The file struct */
typedef struct H5VL_rados_file_t {
H5VL_rados_item_t item; /* Must be first */
char *file_name;
size_t file_name_len;
unsigned flags;
char *glob_md_oid;
struct H5VL_rados_group_t *root_grp;
uint64_t max_oid;
hbool_t max_oid_dirty;
hid_t fcpl_id;
hid_t fapl_id;
MPI_Comm comm;
MPI_Info info;
int my_rank;
int num_procs;
hbool_t collective;
} H5VL_rados_file_t;
/* The group struct */
typedef struct H5VL_rados_group_t {
H5VL_rados_obj_t obj; /* Must be first */
hid_t gcpl_id;
hid_t gapl_id;
} H5VL_rados_group_t;
/* The dataset struct */
typedef struct H5VL_rados_dset_t {
H5VL_rados_obj_t obj; /* Must be first */
hid_t type_id;
hid_t space_id;
hid_t dcpl_id;
hid_t dapl_id;
} H5VL_rados_dset_t;
/* The datatype struct */
/* Note we could speed things up a bit by caching the serialized datatype. We
* may also not need to keep the type_id around. -NAF */
typedef struct H5VL_rados_dtype_t {
H5VL_rados_obj_t obj; /* Must be first */
hid_t type_id;
hid_t tcpl_id;
hid_t tapl_id;
} H5VL_rados_dtype_t;
/* The attribute struct */
typedef struct H5VL_rados_attr_t {
H5VL_rados_item_t item; /* Must be first */
H5VL_rados_obj_t *parent;
char *name;
hid_t type_id;
hid_t space_id;
} H5VL_rados_attr_t;
/* The link value struct */
typedef struct H5VL_rados_link_val_t {
H5L_type_t type;
union {
uint64_t hard;
char *soft;
} target;
} H5VL_rados_link_val_t;
extern hid_t H5VL_RADOS_g;
H5_DLL herr_t H5VL_rados_init(void);
#ifdef __cplusplus
}
#endif
#endif /* H5VLrados_H */

54
src/H5VLrados_public.h Normal file
View File

@@ -0,0 +1,54 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* 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. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This source code was developed under the Mochi project
* (https://www.mcs.anl.gov/research/projects/mochi), supported by the U.S.
* Department of Energy, Office of Science, under contract DE-AC02-06CH11357.
*/
/*
* Programmer: Neil Fortner <nfortne2@hdfgroup.gov>
* December, 2016
*
* Purpose: The public header file for the RADOS VOL plugin.
*/
#ifndef H5VLrados_public_H
#define H5VLrados_public_H
/* External headers needed by this file */
#ifdef HDF5_USE_MOBJECT
#include <librados-mobject-store.h>
#else
#include <rados/librados.h>
#endif
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"
#define H5VL_RADOS_VERSION 1
#define H5VL_RADOS_VALUE 268
#define H5VL_RADOS_NAME "rados_vol_connector"
#ifdef __cplusplus
extern "C" {
#endif
H5_DLL herr_t H5VLrados_init(rados_t rados_cluster, const char *rados_pool);
H5_DLL herr_t H5VLrados_term(void);
H5_DLL herr_t H5Pset_fapl_rados(hid_t fapl_id, MPI_Comm comm, MPI_Info info);
#ifdef __cplusplus
}
#endif
#endif /* H5VLrados_public_H */

View File

@@ -118,6 +118,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5VLnative_attr.c H5VLnative_dataset.c H5VLnative_datatype.c \
H5VLnative_file.c H5VLnative_group.c H5VLnative_link.c H5VLnative_object.c \
H5VLpassthru.c \
H5VLrados.c \
H5VM.c H5WB.c H5Z.c \
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c \
H5Zscaleoffset.c H5Zszip.c H5Ztrans.c
@@ -144,7 +145,9 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
H5Rpublic.h H5Spublic.h H5Tpublic.h \
H5VLnative.h H5VLpassthru.h H5VLpublic.h H5Zpublic.h
H5VLnative.h H5VLpassthru.h H5VLpublic.h \
H5VLrados_public.h \
H5Zpublic.h
# install libhdf5.settings in lib directory
settingsdir=$(libdir)