summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-02-22 19:08:12 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-02-22 19:08:12 (GMT)
commite4b71d49a12d384e89931a620428e950dd98e4e8 (patch)
tree94798cf8cb723798fc7fda00a281b712ccdfb427 /examples
parent3964f612eba8872d6fc8778f2523fd4bce47f649 (diff)
parent0e402e436d0c58acc72e45ab6153d5662b3148e0 (diff)
downloadhdf5-e4b71d49a12d384e89931a620428e950dd98e4e8.zip
hdf5-e4b71d49a12d384e89931a620428e950dd98e4e8.tar.gz
hdf5-e4b71d49a12d384e89931a620428e950dd98e4e8.tar.bz2
Merge pull request #1574 in HDFFV/hdf5 from ~DEROBINS/hdf5_der:hdf5_rados to hdf5_rados
* commit '0e402e436d0c58acc72e45ab6153d5662b3148e0': Updated the tests to use mobject. Added a RADOS/mobject #ifdef switch. Moved the rados_stat() modifications into a helper function. Finished implementation of RADOS wrappers for calls not implemented in mobject. * Added a rados_read() wrapper function (still uses rados_read()). * Some cleanup in the write wrapper. rados_write_full calls now use write_ops. Added a helper function to wrap rados_write_full(). Both rados_stats calls are wrapped. You can #define OLD_RADOS_CALLS to enable the old way of doing things. Converted one of the stats calls to use a read op instead. * Added a script to run the RADOS examples in order. * Updated BRANCH.txt with useful information about building and testing. * Makefile.am now installs everything you need as well as the test script.
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am3
-rw-r--r--examples/h5rados_dset_create.c2
-rw-r--r--examples/h5rados_dset_open.c2
-rw-r--r--examples/h5rados_dset_read.c2
-rw-r--r--examples/h5rados_dset_rpartial.c2
-rw-r--r--examples/h5rados_dset_wpartial.c2
-rw-r--r--examples/h5rados_dset_write.c2
-rw-r--r--examples/h5rados_example.h8
-rw-r--r--examples/h5rados_file_create.c2
-rw-r--r--examples/h5rados_file_open.c2
-rw-r--r--examples/h5rados_group_create.c2
-rw-r--r--examples/h5rados_group_open.c2
-rw-r--r--examples/run_mobject_examples.sh48
-rwxr-xr-xexamples/run_rados_examples.sh71
14 files changed, 138 insertions, 12 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 323541f..7e56f86 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -63,7 +63,8 @@ INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \
h5rados_file_create.c h5rados_file_open.c h5rados_group_create.c \
h5rados_group_open.c h5rados_dset_create.c \
h5rados_dset_open.c h5rados_dset_write.c h5rados_dset_read.c \
- h5rados_dset_wpartial.c h5rados_dset_rpartial.c
+ h5rados_dset_wpartial.c h5rados_dset_rpartial.c \
+ h5rados_example.h run_rados_examples.sh run_mobject_examples.sh
diff --git a/examples/h5rados_dset_create.c b/examples/h5rados_dset_create.c
index 0e14a7f..2ec6bfa 100644
--- a/examples/h5rados_dset_create.c
+++ b/examples/h5rados_dset_create.c
@@ -14,7 +14,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_open.c b/examples/h5rados_dset_open.c
index 19e29ed..a0d4fa7 100644
--- a/examples/h5rados_dset_open.c
+++ b/examples/h5rados_dset_open.c
@@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_read.c b/examples/h5rados_dset_read.c
index fc7292c..5dbb91d 100644
--- a/examples/h5rados_dset_read.c
+++ b/examples/h5rados_dset_read.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_rpartial.c b/examples/h5rados_dset_rpartial.c
index 622b961..f6faad7 100644
--- a/examples/h5rados_dset_rpartial.c
+++ b/examples/h5rados_dset_rpartial.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_wpartial.c b/examples/h5rados_dset_wpartial.c
index bb53982..048625e 100644
--- a/examples/h5rados_dset_wpartial.c
+++ b/examples/h5rados_dset_wpartial.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_dset_write.c b/examples/h5rados_dset_write.c
index dad96fa..17e6898 100644
--- a/examples/h5rados_dset_write.c
+++ b/examples/h5rados_dset_write.c
@@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_example.h b/examples/h5rados_example.h
index 4516b15..8da9487 100644
--- a/examples/h5rados_example.h
+++ b/examples/h5rados_example.h
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <mpi.h>
#include <hdf5.h>
-#include <rados/librados.h>
#include <H5VLrados_public.h>
/* Macros for printing standard messages and issuing errors */
@@ -12,3 +11,10 @@
#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
+
diff --git a/examples/h5rados_file_create.c b/examples/h5rados_file_create.c
index 493be18..04101b3 100644
--- a/examples/h5rados_file_create.c
+++ b/examples/h5rados_file_create.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_file_open.c b/examples/h5rados_file_open.c
index 176d26e..881ab10 100644
--- a/examples/h5rados_file_open.c
+++ b/examples/h5rados_file_open.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_group_create.c b/examples/h5rados_group_create.c
index fcfbbc0..68c6a6d 100644
--- a/examples/h5rados_group_create.c
+++ b/examples/h5rados_group_create.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/h5rados_group_open.c b/examples/h5rados_group_open.c
index 3339480..4fde06c 100644
--- a/examples/h5rados_group_open.c
+++ b/examples/h5rados_group_open.c
@@ -12,7 +12,7 @@ int main(int argc, char *argv[]) {
if(rados_create(&cluster, NULL) < 0)
ERROR;
- if(rados_conf_read_file(cluster, "ceph.conf") < 0)
+ if(rados_conf_read_file(cluster, CEPH_CONFIG_FILE) < 0)
ERROR;
/* Initialize VOL */
diff --git a/examples/run_mobject_examples.sh b/examples/run_mobject_examples.sh
new file mode 100644
index 0000000..767387d
--- /dev/null
+++ b/examples/run_mobject_examples.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Build mobject examples.
+# Assumes mobject stuff can be found
+echo "Building mobject examples"
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_file_create h5rados_file_create.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_file_open h5rados_file_open.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_create h5rados_dset_create.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_open h5rados_dset_open.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_group_create h5rados_group_create.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_group_open h5rados_group_open.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_write h5rados_dset_write.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_read h5rados_dset_read.c
+
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -o h5rados_dset_rpartial h5rados_dset_rpartial.c
+../../../bin/h5pcc -DHDF5_USE_MOBJECT -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
+
diff --git a/examples/run_rados_examples.sh b/examples/run_rados_examples.sh
new file mode 100755
index 0000000..7782a56
--- /dev/null
+++ b/examples/run_rados_examples.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+
+# Build RADOS examples.
+# Assumes RADOS can be found in the usual location.
+echo "Building RADOS examples"
+../../../bin/h5pcc -o h5rados_file_create h5rados_file_create.c -lrados
+../../../bin/h5pcc -o h5rados_file_open h5rados_file_open.c -lrados
+../../../bin/h5pcc -o h5rados_dset_create h5rados_dset_create.c -lrados
+../../../bin/h5pcc -o h5rados_dset_open h5rados_dset_open.c -lrados
+../../../bin/h5pcc -o h5rados_group_create h5rados_group_create.c -lrados
+../../../bin/h5pcc -o h5rados_group_open h5rados_group_open.c -lrados
+../../../bin/h5pcc -o h5rados_dset_write h5rados_dset_write.c -lrados
+../../../bin/h5pcc -o h5rados_dset_read h5rados_dset_read.c -lrados
+
+../../../bin/h5pcc -o h5rados_dset_rpartial h5rados_dset_rpartial.c -lrados
+../../../bin/h5pcc -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
+