Compare commits

..

63 Commits

Author SHA1 Message Date
gsell c41bd6ec54 Merge branch '21-hdf5-1-12-and-newer-support' into 'master'
Resolve "hdf5 1.12 and newer support"

Closes #21

See merge request H5hut/src!6
2024-10-02 14:58:27 +02:00
gsell a69a88c49c version bumped to 2.0.0rc7 2024-10-02 14:57:51 +02:00
gsell 4088d02f55 hdf5 >=1.12.0 support added 2024-10-02 14:48:53 +02:00
gsell 5f57c23499 Merge branch '20-unknown-macro-ac_msg_erro' into 'master'
Resolve "unknown macro AC_MSG_ERROR"

Closes #20

See merge request H5hut/src!5
2020-08-18 09:52:31 +02:00
gsell b71fa8c9dc LT_INIT added to configure.ac, should fix unknown AC_MSG_ERROR 2020-08-18 09:51:44 +02:00
gsell 7e7a85f14f Merge branch '19-release-2-0-0rc6' into 'master'
Resolve "release 2.0.0rc6"

Closes #19

See merge request H5hut/src!4
2019-06-20 20:49:00 +02:00
gsell fc1322432c version set to 2.0.0rc6 2019-06-20 20:48:48 +02:00
gsell f5778e0197 Merge branch '18-memory-leaks-in-h5part' into 'master'
Resolve "memory leaks in H5Part"

Closes #18

See merge request H5hut/src!3
2019-06-20 20:42:33 +02:00
gsell fb084fdff4 memory leaks in H5Port core functions fixed 2019-06-20 20:42:42 +02:00
gsell be7cd1d471 Merge branch '17-in-configure-ac-exit-after-ac_msg_error-is-not-required' into 'master'
Resolve "in configure.ac: exit after AC_MSG_ERROR is not required"

Closes #17

See merge request H5hut/src!2
2019-06-20 19:01:02 +02:00
gsell f7b7a45a28 configure.ac: exit calls after ASC_MSG_ERROR removed 2019-06-20 19:01:17 +02:00
gsell e41db835eb Merge branch '15-move-dissolving-ghost-zones-into-dedicated-function' into 'master'
Resolve "move dissolving ghost-zones into dedicated function"

Closes #15

See merge request H5hut/src!1
2019-06-20 18:57:49 +02:00
gsell 8140378213 H5Block3dSetView() does not dissolve ghost-zones any more
- new API function H5Block3dSetViewDissolveGhostZones() added
2019-06-20 18:52:02 +02:00
gsell 6a4d711b99 test: use independent IO in h5u_test_{read,write}3() for hdf5 > 1.8.12
Since MPI-POSIX VFD has been removed from hdf5 > 1.8.12, but a test
with stride data should be performed, we use independent IO instead for
hdf5 > 1.8.12
2018-11-19 17:08:48 +01:00
gsell 2ae76250e6 src/h5core/h5u_model.c: bug fixed in h5_set_view()
In h5_set_view() u->shape was created two times.
2018-11-19 17:01:08 +01:00
gsell f1cb1c981e Merge branch 'master' of gitlab.psi.ch:H5hut/src 2018-11-19 14:51:52 +01:00
gsell 627d6673e1 src/include/h5core/h5_log.h: bugfix: declaration of 'h5_initialized()' declared insite 'extern C' 2018-11-19 14:51:28 +01:00
gsell ed85fb32b7 changes merged from upstrean 2018-11-19 14:47:57 +01:00
gsell df2be38428 examples/H5Part/write_setview.c
- include of "mpi.h" removed. There is no need for it and this breaks the serial case
2018-11-08 16:42:03 +01:00
gsell d423367d4f most warnings fixed if compiling with NDEBUG defined 2018-11-08 15:34:32 +01:00
gsell 1985a0a2e0 src/h5core/h5u_model.c:
- h5u_get_totalnum_particles_by_idx():
  - comment added
  - definition of 'total' and 'dmax' moved
2018-11-05 16:47:48 +01:00
gsell 24533c4c2e examples/H5/openclose.c:
- set DEBUGMASK to all
2018-11-05 16:43:47 +01:00
Achim Gsell 72365540a3 src/include/h5core/h5_log.h: missing backslashes in definition of macro 'H5_API_ENTER()' if NDEBUG is set fixed 2018-11-02 23:56:27 +01:00
Gsell Achim 4daf9b786c * C-API
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
- Dataset names longer then 64 bytes are handled as error.
- Same for step/iteration names.
* core API
- we use the term 'iteration' instead of 'step'
- we use the term 'item' instead of 'point'
- re-factor function and variable names
- in printing messages/debug output fixed
- do not flush (sync to disk) after writing a dataset by default,
  can be controlled by a property
2018-09-14 16:46:40 +02:00
gsell 072a2781fc configure.ac
- set version to 2.0.0rc5
2018-09-04 10:34:04 +02:00
gsell 9c9bfda054 src/Python/Makefileam
- print message if Python is disabled
2018-09-04 10:33:44 +02:00
gsell 604dade2a1 src/h5core/h5b_model.c
- warning in 'h5b_3d_set_grid()' if compiled serial fixed
2018-09-04 10:33:09 +02:00
gsell 2da69d1095 error in logging/debug output fixed, see issue #13 2018-09-04 10:32:04 +02:00
gsell 15317a9bb0 do not include 'h5_init.h' where not required 2018-09-04 10:30:13 +02:00
gsell c5f3b7fa02 src/h5core/{h5_file.c,h5_init.c,private/h5_init.h}
- refactor 'h5_initialize()' and 'h5_finalize()'
2018-09-04 10:28:08 +02:00
gsell a81c79e5c4 src/h5core/Makefile.am:
- adapt to moved h5_init
2018-09-04 10:21:38 +02:00
gsell 664cee709b src/h5core/h5_init.c:
- moved from 'private'
2018-09-04 10:17:47 +02:00
gsell ecc4618bd4 close data types in with H5Finalize() 2018-02-02 11:10:18 +01:00
gsell 8bdebd0c55 src/h5core/private/h5t_types.h
- in definition of 'struct h5_dta_types': define type for parallel H5Grid only if enabled
2018-02-01 17:51:09 +01:00
gsell 5baed631b7 examples/H5/openclose.c
- call to H5Finalize() added
2018-02-01 17:48:28 +01:00
gsell 65109b73a9 example/H5/openclose.c
- call to H5SetDebugMask() added
2018-02-01 15:26:14 +01:00
gsell 792e86e01e src/h5core/h5_log.c
- warning in initialization of 'h5_rfmts' fixed
2018-02-01 15:25:27 +01:00
gsell 11ab169164 src/h5core/private/h5t_ref_elements.c
- bug in initialization of h5t_tet_ref_elem fixed
2018-02-01 15:24:44 +01:00
gsell 7c899f99ce src/include/H5_log.h
- H5_DEBUG_NONE added to documentation of H5SetDebugMask()
2018-02-01 15:23:32 +01:00
gsell 12ef028ed2 src/include/h5core/h5_log.h
- macro H5_DEBUG_NONE added
2018-02-01 15:21:30 +01:00
gsell 094117a631 src/h5core/h5_file.c:
- memory leak fixed
2018-02-01 15:10:18 +01:00
gsell acc8b75ad9 - several "duplicate const" warnings fixed
- some useless tests whether an unsigned int is less than zero removed
2018-02-01 14:25:29 +01:00
gsell 078a51d60d examples/H5/openclose.c: explizit set verbosity of output 2018-01-05 12:16:15 +01:00
gsell 06a941eb2c configure.ac
- test whether we are using the right hdf5 flavor added:
  parallel if we request parallel otherwise non-parallel
2017-07-27 18:36:30 +02:00
gsell 269c5efbde src/include/h5core/h5file.h
- no need to include 'mpi.h' and 'hdf5.h' here
2017-07-27 18:34:00 +02:00
gsell e7a60fbe9f src/include/h5core/h5b_module.h
- the function to define a grid are now available as dummy function in the serial version
2017-07-27 18:33:14 +02:00
gsell 2ed8ad093c use the H5_HAVE_PARALLEL macro from hdf5 instead of the macro PARALLEL_IO 2017-07-27 18:31:34 +02:00
gsell 3a9e0e4153 src/include/h5core/h5_types.h
- define dummy MPI data-types only if MPI_VERSION is not set.
  According to the MPI specification, this macro must be set after
  including the header MPI header file 'mpi.h'
2017-07-27 18:29:21 +02:00
gsell aa1f4eacc8 examples/H5Part/read_stridedf.f90
- bugfix in parallel version
2017-07-26 17:00:03 +02:00
gsell c33ef6d390 serial H5hut can now be used with MPI, resolving #12
src/h5core/private/h5_init.h:
- remove definition of MPI dummies for serial version
src/h5core/private/h5_types.h:
- define the MPI communicator in 'struct h5_prop_file' only in parallel version
src/h5core/h5_file.c
- adapt to above changes
2017-07-26 16:59:16 +02:00
gsell 9a32a0b7f1 examples/H5/Makefile.am
- do not use GNU extension for pattern rules
2017-06-30 18:25:39 +02:00
gsell 22d6893770 autotool configuration:
- changes to support VTK 8.0
- better check for Fortran compiler
2017-06-30 18:24:56 +02:00
gsell 6e0f0eeedd we have to call cmake in configure to determine VTK headers and libs.
This call creates the directory 'CMakeFiles' which we want to ignore.
2017-06-30 18:23:05 +02:00
gsell 542daf7fc2 C examples:
- define dummy MPI macros to be used in serial compilation, closing #10
- cleanup some "unused variable" warnings
- fix some format warnings, using C99 format macros
2017-06-23 15:37:46 +02:00
gsell f79c808e8d src/h5core/h5_err.c
- include stdlib.h added, closing #9
2017-06-23 15:31:56 +02:00
gsell b6e482f56a src/h5core/h5t_store.c
- comments edited
2017-06-23 15:27:53 +02:00
gsell 6d3014bad5 Fortran examples:
- adapted for serial compilation, closing #8
2017-06-23 15:27:19 +02:00
gsell 20424235e8 configure.ac
- set Fortran compiler with AC_PROG_FC, closing #7
2017-06-23 15:22:33 +02:00
gsell 7d73439b10 Makefile.am
- 'ax_pkg_swig.m4' added to 'EXTRADIST'
2017-03-18 09:49:37 +01:00
gsell e447d536a3 configure.ac:
- set version to 2.0.0rc3
2017-03-18 09:27:11 +01:00
gsell 74df1bc676 src/h5core/h5_attribs.c: bugfixes 2016-09-23 17:03:20 +02:00
gsell 9e4c8bd5a4 src/h5core/h5u_io.h
- conditional flushing step data removed, for the time being we flush anyway
2016-09-23 16:45:20 +02:00
gsell bb1cd9c860 src/h5core/h5_file.c
- prototype of a 'h5_set_prop_file_flush_step()' function added
2016-09-23 16:44:30 +02:00
132 changed files with 2789 additions and 1046 deletions
+1
View File
@@ -9,6 +9,7 @@
.deps
.dirstamp
.libs
CMakeFiles
INSTALL
Makefile
Makefile.in
+15
View File
@@ -0,0 +1,15 @@
2018-09-14 Gsell Achim <achi.gsell@psi.ch>
* C-API
- H5PartSetNumPoints() renamed to H5PartSetNumItems()
- H5PartGetNumPoints() renamed to H5PartGetNumItems()
- Dataset names longer then 64 bytes are handled as error.
- Same for step/iteration names.
* core API
- we use the term 'iteration' instead of 'step'
- we use the term 'item' instead of 'point'
- re-factor function and variable names
- in printing messages/debug output fixed
- do not flush (sync to disk) after writing a dataset by default,
can be controlled by a property
+3 -1
View File
@@ -1,5 +1,7 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = autogen.sh
EXTRA_DIST = \
autogen.sh \
ax_pkg_swig.m4
SUBDIRS = \
src \
+982
View File
@@ -0,0 +1,982 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
# or '14' (for the C++14 standard).
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for an extended mode.
#
# The third argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline support for the specified C++ standard is
# required and that the macro should error out if no mode with that
# support is found. If specified 'optional', then configuration proceeds
# regardless, after defining HAVE_CXX${VERSION} if and only if a
# supporting mode is found.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
AX_REQUIRE_DEFINED([AC_MSG_WARN])
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
[$2], [noext], [],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
AC_LANG_PUSH([C++])dnl
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
ax_cv_cxx_compile_cxx$1,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[ax_cv_cxx_compile_cxx$1=yes],
[ax_cv_cxx_compile_cxx$1=no])])
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
ac_success=yes
fi
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
fi])
m4_if([$2], [ext], [], [dnl
if test x$ac_success = xno; then
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
if test x$ac_success = xyes; then
break
fi
done
fi])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
fi
fi
if test x$ac_success = xno; then
HAVE_CXX$1=0
AC_MSG_NOTICE([No compiler with C++$1 support was found])
else
HAVE_CXX$1=1
AC_DEFINE(HAVE_CXX$1,1,
[define if the compiler supports basic C++$1 syntax])
fi
AC_SUBST(HAVE_CXX$1)
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
])
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
)
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
)
dnl Tests for new features in C++11
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
// If the compiler admits that it is not ready for C++11, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201103L
#error "This is not a C++11 compiler"
#else
namespace cxx11
{
namespace test_static_assert
{
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
}
namespace test_final_override
{
struct Base
{
virtual void f() {}
};
struct Derived : public Base
{
virtual void f() override {}
};
}
namespace test_double_right_angle_brackets
{
template < typename T >
struct check {};
typedef check<void> single_type;
typedef check<check<void>> double_type;
typedef check<check<check<void>>> triple_type;
typedef check<check<check<check<void>>>> quadruple_type;
}
namespace test_decltype
{
int
f()
{
int a = 1;
decltype(a) b = 2;
return a + b;
}
}
namespace test_type_deduction
{
template < typename T1, typename T2 >
struct is_same
{
static const bool value = false;
};
template < typename T >
struct is_same<T, T>
{
static const bool value = true;
};
template < typename T1, typename T2 >
auto
add(T1 a1, T2 a2) -> decltype(a1 + a2)
{
return a1 + a2;
}
int
test(const int c, volatile int v)
{
static_assert(is_same<int, decltype(0)>::value == true, "");
static_assert(is_same<int, decltype(c)>::value == false, "");
static_assert(is_same<int, decltype(v)>::value == false, "");
auto ac = c;
auto av = v;
auto sumi = ac + av + 'x';
auto sumf = ac + av + 1.0;
static_assert(is_same<int, decltype(ac)>::value == true, "");
static_assert(is_same<int, decltype(av)>::value == true, "");
static_assert(is_same<int, decltype(sumi)>::value == true, "");
static_assert(is_same<int, decltype(sumf)>::value == false, "");
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
return (sumf > 0.0) ? sumi : add(c, v);
}
}
namespace test_noexcept
{
int f() { return 0; }
int g() noexcept { return 0; }
static_assert(noexcept(f()) == false, "");
static_assert(noexcept(g()) == true, "");
}
namespace test_constexpr
{
template < typename CharT >
unsigned long constexpr
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
{
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
}
template < typename CharT >
unsigned long constexpr
strlen_c(const CharT *const s) noexcept
{
return strlen_c_r(s, 0UL);
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("1") == 1UL, "");
static_assert(strlen_c("example") == 7UL, "");
static_assert(strlen_c("another\0example") == 7UL, "");
}
namespace test_rvalue_references
{
template < int N >
struct answer
{
static constexpr int value = N;
};
answer<1> f(int&) { return answer<1>(); }
answer<2> f(const int&) { return answer<2>(); }
answer<3> f(int&&) { return answer<3>(); }
void
test()
{
int i = 0;
const int c = 0;
static_assert(decltype(f(i))::value == 1, "");
static_assert(decltype(f(c))::value == 2, "");
static_assert(decltype(f(0))::value == 3, "");
}
}
namespace test_uniform_initialization
{
struct test
{
static const int zero {};
static const int one {1};
};
static_assert(test::zero == 0, "");
static_assert(test::one == 1, "");
}
namespace test_lambdas
{
void
test1()
{
auto lambda1 = [](){};
auto lambda2 = lambda1;
lambda1();
lambda2();
}
int
test2()
{
auto a = [](int i, int j){ return i + j; }(1, 2);
auto b = []() -> int { return '0'; }();
auto c = [=](){ return a + b; }();
auto d = [&](){ return c; }();
auto e = [a, &b](int x) mutable {
const auto identity = [](int y){ return y; };
for (auto i = 0; i < a; ++i)
a += b--;
return x + identity(a + b);
}(0);
return a + b + c + d + e;
}
int
test3()
{
const auto nullary = [](){ return 0; };
const auto unary = [](int x){ return x; };
using nullary_t = decltype(nullary);
using unary_t = decltype(unary);
const auto higher1st = [](nullary_t f){ return f(); };
const auto higher2nd = [unary](nullary_t f1){
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
};
return higher1st(nullary) + higher2nd(nullary)(unary);
}
}
namespace test_variadic_templates
{
template <int...>
struct sum;
template <int N0, int... N1toN>
struct sum<N0, N1toN...>
{
static constexpr auto value = N0 + sum<N1toN...>::value;
};
template <>
struct sum<>
{
static constexpr auto value = 0;
};
static_assert(sum<>::value == 0, "");
static_assert(sum<1>::value == 1, "");
static_assert(sum<23>::value == 23, "");
static_assert(sum<1, 2>::value == 3, "");
static_assert(sum<5, 5, 11>::value == 21, "");
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
}
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
// because of this.
namespace test_template_alias_sfinae
{
struct foo {};
template<typename T>
using member = typename T::member_type;
template<typename T>
void func(...) {}
template<typename T>
void func(member<T>*) {}
void test();
void test() { func<foo>(0); }
}
} // namespace cxx11
#endif // __cplusplus >= 201103L
]])
dnl Tests for new features in C++14
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
// If the compiler admits that it is not ready for C++14, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201402L
#error "This is not a C++14 compiler"
#else
namespace cxx14
{
namespace test_polymorphic_lambdas
{
int
test()
{
const auto lambda = [](auto&&... args){
const auto istiny = [](auto x){
return (sizeof(x) == 1UL) ? 1 : 0;
};
const int aretiny[] = { istiny(args)... };
return aretiny[0];
};
return lambda(1, 1L, 1.0f, '1');
}
}
namespace test_binary_literals
{
constexpr auto ivii = 0b0000000000101010;
static_assert(ivii == 42, "wrong value");
}
namespace test_generalized_constexpr
{
template < typename CharT >
constexpr unsigned long
strlen_c(const CharT *const s) noexcept
{
auto length = 0UL;
for (auto p = s; *p; ++p)
++length;
return length;
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("x") == 1UL, "");
static_assert(strlen_c("test") == 4UL, "");
static_assert(strlen_c("another\0test") == 7UL, "");
}
namespace test_lambda_init_capture
{
int
test()
{
auto x = 0;
const auto lambda1 = [a = x](int b){ return a + b; };
const auto lambda2 = [a = lambda1(x)](){ return a; };
return lambda2();
}
}
namespace test_digit_separators
{
constexpr auto ten_million = 100'000'000;
static_assert(ten_million == 100000000, "");
}
namespace test_return_type_deduction
{
auto f(int& x) { return x; }
decltype(auto) g(int& x) { return x; }
template < typename T1, typename T2 >
struct is_same
{
static constexpr auto value = false;
};
template < typename T >
struct is_same<T, T>
{
static constexpr auto value = true;
};
int
test()
{
auto x = 0;
static_assert(is_same<int, decltype(f(x))>::value, "");
static_assert(is_same<int&, decltype(g(x))>::value, "");
return x;
}
}
} // namespace cxx14
#endif // __cplusplus >= 201402L
]])
dnl Tests for new features in C++17
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
// If the compiler admits that it is not ready for C++17, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus <= 201402L
#error "This is not a C++17 compiler"
#else
#if defined(__clang__)
#define REALLY_CLANG
#else
#if defined(__GNUC__)
#define REALLY_GCC
#endif
#endif
#include <initializer_list>
#include <utility>
#include <type_traits>
namespace cxx17
{
#if !defined(REALLY_CLANG)
namespace test_constexpr_lambdas
{
// TODO: test it with clang++ from git
constexpr int foo = [](){return 42;}();
}
#endif // !defined(REALLY_CLANG)
namespace test::nested_namespace::definitions
{
}
namespace test_fold_expression
{
template<typename... Args>
int multiply(Args... args)
{
return (args * ... * 1);
}
template<typename... Args>
bool all(Args... args)
{
return (args && ...);
}
}
namespace test_extended_static_assert
{
static_assert (true);
}
namespace test_auto_brace_init_list
{
auto foo = {5};
auto bar {5};
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
static_assert(std::is_same<int, decltype(bar)>::value);
}
namespace test_typename_in_template_template_parameter
{
template<template<typename> typename X> struct D;
}
namespace test_fallthrough_nodiscard_maybe_unused_attributes
{
int f1()
{
return 42;
}
[[nodiscard]] int f2()
{
[[maybe_unused]] auto unused = f1();
switch (f1())
{
case 17:
f1();
[[fallthrough]];
case 42:
f1();
}
return f1();
}
}
namespace test_extended_aggregate_initialization
{
struct base1
{
int b1, b2 = 42;
};
struct base2
{
base2() {
b3 = 42;
}
int b3;
};
struct derived : base1, base2
{
int d;
};
derived d1 {{1, 2}, {}, 4}; // full initialization
derived d2 {{}, {}, 4}; // value-initialized bases
}
namespace test_general_range_based_for_loop
{
struct iter
{
int i;
int& operator* ()
{
return i;
}
const int& operator* () const
{
return i;
}
iter& operator++()
{
++i;
return *this;
}
};
struct sentinel
{
int i;
};
bool operator== (const iter& i, const sentinel& s)
{
return i.i == s.i;
}
bool operator!= (const iter& i, const sentinel& s)
{
return !(i == s);
}
struct range
{
iter begin() const
{
return {0};
}
sentinel end() const
{
return {5};
}
};
void f()
{
range r {};
for (auto i : r)
{
[[maybe_unused]] auto v = i;
}
}
}
namespace test_lambda_capture_asterisk_this_by_value
{
struct t
{
int i;
int foo()
{
return [*this]()
{
return i;
}();
}
};
}
namespace test_enum_class_construction
{
enum class byte : unsigned char
{};
byte foo {42};
}
namespace test_constexpr_if
{
template <bool cond>
int f ()
{
if constexpr(cond)
{
return 13;
}
else
{
return 42;
}
}
}
namespace test_selection_statement_with_initializer
{
int f()
{
return 13;
}
int f2()
{
if (auto i = f(); i > 0)
{
return 3;
}
switch (auto i = f(); i + 4)
{
case 17:
return 2;
default:
return 1;
}
}
}
#if !defined(REALLY_CLANG)
namespace test_template_argument_deduction_for_class_templates
{
// TODO: test it with clang++ from git
template <typename T1, typename T2>
struct pair
{
pair (T1 p1, T2 p2)
: m1 {p1},
m2 {p2}
{}
T1 m1;
T2 m2;
};
void f()
{
[[maybe_unused]] auto p = pair{13, 42u};
}
}
#endif // !defined(REALLY_CLANG)
namespace test_non_type_auto_template_parameters
{
template <auto n>
struct B
{};
B<5> b1;
B<'a'> b2;
}
#if !defined(REALLY_CLANG)
namespace test_structured_bindings
{
// TODO: test it with clang++ from git
int arr[2] = { 1, 2 };
std::pair<int, int> pr = { 1, 2 };
auto f1() -> int(&)[2]
{
return arr;
}
auto f2() -> std::pair<int, int>&
{
return pr;
}
struct S
{
int x1 : 2;
volatile double y1;
};
S f3()
{
return {};
}
auto [ x1, y1 ] = f1();
auto& [ xr1, yr1 ] = f1();
auto [ x2, y2 ] = f2();
auto& [ xr2, yr2 ] = f2();
const auto [ x3, y3 ] = f3();
}
#endif // !defined(REALLY_CLANG)
#if !defined(REALLY_CLANG)
namespace test_exception_spec_type_system
{
// TODO: test it with clang++ from git
struct Good {};
struct Bad {};
void g1() noexcept;
void g2();
template<typename T>
Bad
f(T*, T*);
template<typename T1, typename T2>
Good
f(T1*, T2*);
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
}
#endif // !defined(REALLY_CLANG)
namespace test_inline_variables
{
template<class T> void f(T)
{}
template<class T> inline T g(T)
{
return T{};
}
template<> inline void f<>(int)
{}
template<> int g<>(int)
{
return 5;
}
}
} // namespace cxx17
#endif // __cplusplus <= 201402L
]])
+39
View File
@@ -0,0 +1,39 @@
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# =============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# standard; if necessary, add switches to CXX and CXXCPP to enable
# support.
#
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++11. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
# download the ax_cxx_compile_stdcxx.m4 file.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 18
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])
+123 -63
View File
@@ -1,15 +1,16 @@
#
# Copyright (c) 2006-2016, The Regents of the University of California,
# Copyright (c) 2006-2018, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.
#
# License: see file COPYING in top level of source distribution.
#
AC_INIT([H5hut], [2.0.0rc2], [h5part@lists.psi.ch], H5hut)
AC_INIT([H5hut], [2.0.0rc7], [h5part@lists.psi.ch], H5hut)
AC_PREREQ(2.60)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
AM_INIT_AUTOMAKE
ENABLE_DEBUG='no'
@@ -119,23 +120,44 @@ if test "x$ENABLE_PARALLEL" = "xyes"; then
if test "x$MPICXX" != "x"; then
CXX=$MPICXX
fi
if test "x$MPIFC" != "x"; then
FC=$MPIFC
else
FC=''
F77=''
F90=''
fi
c_compilers="mpicc cc"
cxx_compilers="mpic++ CC"
fc_compiler="mpif90 mpif77 mpifort"
else
c_compilers="pgcc pathcc icc gcc cc_r cc"
cxx_compilers="pgcc pathcc icc g++ cc_r c++"
fc_compiler="pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran"
fi
AC_PROG_CC($c_compilers)
if test "x$ac_cv_prog_cc_c89" = "xno"; then
AC_MSG_ERROR([C compiler not found!])
fi
AC_PROG_CXX($cxx_compilers)
if test "X$ENABLE_FORTRAN" = "Xyes"; then
AC_PROG_FC($fc_compiler)
if test "x$FC" = "x"; then
AC_MSG_ERROR([Fortran compiler not found!])
fi
fi
CC=`which $CC`
CXX=`which $CXX`
FC=`which $FC`
AX_CXX_COMPILE_STDCXX_11
AC_PROG_CC_C99
if test "x$ac_cv_prog_cc_c99" = "xno"; then
AC_MSG_ERROR([Cannot set C compiler to use C99 standard!])
exit 1
fi
@@ -239,6 +261,68 @@ AC_DEFINE_UNQUOTED(MY_UNAME, "$uname", "")
###############################################################################
# PROCESS ARGUMENTS
###############################################################################
# check libraries
AC_CHECK_LIB([z], [compress2])
# hdf5
if test -z "${HDF5_PREFIX}"; then
# alternatives to HDF5_PREFIX
if test -n "${HDF5_DIR}"; then
HDF5_PREFIX=${HDF5_DIR}
fi
fi
if test -n "${HDF5_PREFIX}"; then
CPPFLAGS="$CPPFLAGS -I$HDF5_PREFIX/include"
LDFLAGS="$LDFLAGS -L$HDF5_PREFIX/lib"
fi
AC_CHECK_LIB([hdf5], [H5open])
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
[AC_MSG_ERROR([Cannot compile and link a HDF5 program])])
AC_MSG_CHECKING([checking whether hdf5 lib supports parallel IO])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include "hdf5.h"
#ifndef H5_HAVE_PARALLEL
# error macro not defined
#endif
]])], [H5_HAVE_PARALLEL="yes"], [H5_HAVE_PARALLEL="no"])
AC_MSG_RESULT([$H5_HAVE_PARALLEL])
# lustre
AC_MSG_CHECKING([for lustre API ])
AC_MSG_RESULT([])
if test -n "${LUSTREPATH}"; then
P=${LUSTREPATH}
elif test -n "${LUSTREROOT}" ; then
P=${LUSTREROOT}
elif test -n "${LUSTREHOME}" ; then
P=${LUSTREHOME}
elif test -n "${LUSTRE_DIR}" ; then
P=${LUSTRE_DIR}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/lustre"
P="$P /opt/lustre"
fi
PATH_Search LUSTREROOT "$P" usr/include/lustre/liblustreapi.h
if test -z "$LUSTREROOT"; then
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
else
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
CPPFLAGS="$CPPFLAGS -I$LUSTREROOT/usr/include"
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
LIBS="$LIBS -llustreapi"
fi
LIBS="$LIBS -lm"
############################ enabled bindings ###############################
# C enabled?
AC_MSG_CHECKING([if C interface enabled])
if test "X$ENABLE_C" = "Xyes"; then
@@ -252,15 +336,6 @@ AC_MSG_CHECKING([if fortran interface enabled])
if test "X$ENABLE_FORTRAN" = "Xyes"; then
AC_MSG_RESULT([yes])
AC_LANG_PUSH(Fortran)
FC=''
F77=''
F90=''
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_PROG_FC(mpif90 mpif77)
else
AC_PROG_FC(pgf90 ifort xlf_r pathf90 g95 g90 ftn gfortran)
fi
FC=`which $FC`
# Query Fortran symbol mangling. __AC_FC_NAME_MANGLING sets
# ac_cv_{f77,fc}_mangling. The value contains three fields, separated
@@ -349,6 +424,13 @@ fi
AC_MSG_CHECKING([if parallel interface enabled])
if test "X$ENABLE_PARALLEL" = "Xyes"; then
AC_MSG_RESULT([yes])
AS_IF([test "x$H5_HAVE_PARALLEL" = "xno"],
[AC_MSG_ERROR([hdf5 does not support parallel IO!])])
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
AC_MSG_ERROR([VTK to H5hut grid converter cannot be compiled parallel!])
fi
CPPFLAGS="${CPPFLAGS} -DPARALLEL_IO -DMPICH_IGNORE_CXX_SEEK"
if test "X$ENABLE_EXPERIMENTAL" = "Xyes"; then
@@ -366,67 +448,44 @@ if test "X$ENABLE_PARALLEL" = "Xyes"; then
if test "X$r" = "Xno"; then
AC_MSG_ERROR([ParMETIS])
exit 1
fi
fi
else # --enable-parallel=no
AC_MSG_RESULT([no])
AS_IF([test "x$H5_HAVE_PARALLEL" = "xyes"],
[AC_MSG_ERROR([hdf5 with support for parallel IO cannot be used for non-parallel H5hut!])])
fi
###############################################################################
# LIBRARY PATHS
if test -z "${HDF5_PREFIX}"; then
# alternatives to HDF5_PREFIX
if test -n "${HDF5_DIR}"; then
HDF5_PREFIX=${HDF5_DIR}
fi
fi
if test -n "${HDF5_PREFIX}"; then
CPPFLAGS="$CPPFLAGS -I$HDF5_PREFIX/include"
LDFLAGS="$LDFLAGS -L$HDF5_PREFIX/lib"
fi
AC_CHECK_LIB([z], [compress2])
AC_CHECK_LIB([hdf5], [H5open])
AS_IF([test "x$ac_cv_lib_hdf5_H5open" != xyes],
[AC_MSG_ERROR([Cannot compile and link a HDF5 program]);
exit 1])
AC_MSG_CHECKING([for lustre API ])
AC_MSG_RESULT([])
if test -n "${LUSTREPATH}"; then
P=${LUSTREPATH}
elif test -n "${LUSTREROOT}" ; then
P=${LUSTREROOT}
elif test -n "${LUSTREHOME}" ; then
P=${LUSTREHOME}
elif test -n "${LUSTRE_DIR}" ; then
P=${LUSTRE_DIR}
else
P=''
P="$P /usr"
P="$P /usr/local"
P="$P /usr/local/lustre"
P="$P /opt/lustre"
fi
PATH_Search LUSTREROOT "$P" usr/include/lustre/liblustreapi.h
if test -z "$LUSTREROOT"; then
AC_MSG_WARN([Couldn't locate the lustre API... building without support for lustre striping!])
else
CFLAGS="$CFLAGS -DH5_USE_LUSTRE"
CPPFLAGS="$CPPFLAGS -I$LUSTREROOT/usr/include"
LDFLAGS="$LDFLAGS -L$LUSTREROOT/usr/lib"
LIBS="$LIBS -llustreapi"
fi
LIBS="$LIBS -lm"
###############################################################################
# TOOLS
AC_MSG_CHECKING([if we have to compile the VTK to H5hut grid converter])
if test "X$ENABLE_VTKCONVERTER" = "Xyes"; then
AC_MSG_RESULT([yes])
# :TODO: add test whether we can compile/link a prog with vtk
if test -n "$VTK_PREFIX"; then
SAVE_C_INCLUDE_PATH="$C_INCLUDE_PATH"
SAVE_CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH"
SAVE_LIBRARY_PATH="$LIBRARY_PATH"
C_INCLUDE_PATH="$C_INCLUDE_PATH $VTK_PREFIX/include"
CPLUS_INCLUDE_PATH="$CPLUS_INCLUDE_PATH $VTK_PREFIX/include"
LIBRARY_PATH="$LIBRARY_PATH $VTK_PREFIX/lib"
fi
AC_MSG_CHECKING([VTK inlcude files])
VTK_INCLUDES=`cmake --find-package -DNAME=VTK -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=COMPILE 2>/dev/null`
if test "X$?" != "X0"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot compile VTK to H5hut converter])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_CHECKING([VTK libraries])
VTK_LIBS=`cmake --find-package -DNAME=VTK -DCOMPILER_ID=GNU -DLANGUAGE=C -DMODE=LINK 2>/dev/null`
if test "X$?" != "X0"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot compile VTK to H5hut converter]);
else
AC_MSG_RESULT([yes])
fi
else
AC_MSG_RESULT([no])
fi
@@ -450,7 +509,8 @@ AC_SUBST(CFLAGS)
AC_SUBST(FFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(AM_LDFLAGS)
AC_SUBST(VTK_INCLUDES)
AC_SUBST(VTK_LIBS)
AC_CONFIG_FILES([
Makefile
src/Makefile
+4 -3
View File
@@ -8,6 +8,7 @@
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
@@ -39,7 +40,6 @@ noinst_PROGRAMS += \
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += \
openclosef \
queryf \
@@ -56,7 +56,8 @@ write_file_attribsf_SOURCES = write_file_attribsf.f90
write_step_attribsf_SOURCES = write_step_attribsf.f90
endif
endif
endif
%.o : %.f90
all: ${noinst_PROGRAMS}
.f90.o:
$(FC) $(FFLAGS) -c $<
+1
View File
@@ -17,6 +17,7 @@
#define VERBOSITY H5_VERBOSE_ERROR
#define DEBUG_MSK H5_DEBUG_ALL
#include "examples.h"
int
main (
+19 -7
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
Copyright (c) 2006-2018, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
@@ -9,6 +9,20 @@
#include "H5hut.h"
#include "examples.h"
#if !defined(VERBOSITY)
#define VERBOSITY H5_VERBOSE_ERROR
#endif
/*
Use H5_DEBUG_ALL to get full debug output
*/
#if !defined(DEBUGMASK)
//#define DEBUGMASK H5_DEBUG_NONE
#define DEBUGMASK H5_DEBUG_ALL
#endif
int
main (
int argc,
@@ -16,18 +30,16 @@ main (
) {
MPI_Comm comm = MPI_COMM_WORLD;
int myproc;
int nprocs;
MPI_Init (&argc, &argv);
MPI_Comm_size (comm, &nprocs);
MPI_Comm_rank (comm, &myproc);
H5SetVerbosityLevel (VERBOSITY);
H5SetDebugMask (DEBUGMASK);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileMPIOCollective (prop, &comm);
h5_file_t f = H5OpenFile ("testfile.h5", H5_O_WRONLY, prop);
H5CloseProp (prop);
H5CloseFile (f);
H5Finalize ();
MPI_Finalize ();
return 0;
}
+16 -5
View File
@@ -14,22 +14,33 @@ program openclose
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
integer :: comm, rank, ierr
#endif
integer :: comm, rank
integer*8 :: file_id, status
integer*8 :: props
#if defined(PARALLEL_IO)
integer :: ierr
comm = MPI_COMM_WORLD
call mpi_init(ierr)
call mpi_comm_rank(comm, rank, ierr)
#else
comm = 0
rank = 1
#endif
props = h5_createprop_file ()
#if defined(PARALLEL_IO)
status = h5_setprop_file_mpio_collective (props, comm)
#endif
file_id = h5_openfile ("testfile.h5", H5_O_WRONLY, props)
status = h5_closeprop (props)
status = h5_closefile (file_id);
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
end program openclose
+2
View File
@@ -9,6 +9,8 @@
#include "H5hut.h"
#include "examples.h"
#define FNAME1 "example_file_attribs.h5"
#define FNAME2 "example_step_attribs.h5"
+10 -5
View File
@@ -1,5 +1,5 @@
!
! Copyright (c) 2006-2013, The Regents of the University of California,
! Copyright (c) 2006-2017, The Regents of the University of California,
! through Lawrence Berkeley National Laboratory (subject to receipt of any
! required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
! Institut (Switzerland). All rights reserved.!
@@ -7,15 +7,17 @@
! License: see file COPYING in top level of source distribution.
!
include 'H5hut.f90'
program query
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! the file name we want to read
character (len=*), parameter :: FNAME1 = "example_file_attribs.h5"
character (len=*), parameter :: FNAME2 = "example_step_attribs.h5"
character (len=*), parameter :: FNAME1 = "example_file_attribs.h5"
character (len=*), parameter :: FNAME2 = "example_step_attribs.h5"
! verbosity level: set it to a power of 2 minus one or zero
integer*8, parameter :: verbosity_level = 1
@@ -23,7 +25,9 @@
! used for mpi error return
integer :: ierr
#if defined(PARALLEL_IO)
call mpi_init (ierr)
#endif
! abort program on any H5hut error
call h5_abort_on_error ()
@@ -33,8 +37,9 @@
call query_file (FNAME1);
call query_file (FNAME2);
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
call exit (ierr)
contains
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
+9 -4
View File
@@ -11,7 +11,9 @@
program read_file_attribs
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! the file name we want to read
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
@@ -40,9 +42,6 @@
real*4, allocatable :: r4_value (:)
real*8, allocatable :: r8_value (:)
! used for mpi error return
integer :: ierr
! H5hut file id
integer*8 :: file_id
@@ -58,7 +57,12 @@
! loop index
integer*8 i
#if defined(PARALLEL_IO)
! used for mpi error return
integer :: ierr
call mpi_init (ierr)
#endif
! abort program on any H5hut error
call h5_abort_on_error ()
@@ -109,6 +113,7 @@
! cleanup
status = h5_closefile (file_id)
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
end program read_file_attribs
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
+12 -6
View File
@@ -11,8 +11,11 @@
program read_step_attribs
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! the file name we want to read
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
@@ -36,9 +39,6 @@
real*4, allocatable :: r4_value (:)
real*8, allocatable :: r8_value (:)
! used for mpi error return
integer :: ierr
! H5hut file id
integer*8 :: file_id
@@ -54,8 +54,13 @@
! loop index
integer*8 i
call mpi_init (ierr)
#if defined(PARALLEL_IO)
! used for mpi error return
integer :: ierr
call mpi_init (ierr)
#endif
! abort program on any H5hut error
call h5_abort_on_error ()
@@ -108,6 +113,7 @@
! cleanup
status = h5_closefile (file_id)
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
end program read_step_attribs
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#define FNAME "example_file_attribs.h5"
+11 -4
View File
@@ -11,8 +11,11 @@
program write_file_attribs
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
integer*8, parameter :: verbosity_level = 1
character (len=*), parameter :: FNAME = "example_file_attribs.h5"
@@ -29,11 +32,13 @@
real*4, parameter, dimension(*) :: r4_value = (/2.71828/)
real*8, parameter, dimension(*) :: r8_value = (/3.141592653589793238462643383279502884197169/)
integer :: ierr
integer*8 :: file_id, status
#if defined(PARALLEL_IO)
integer :: ierr
call mpi_init(ierr)
#endif
! abort program on any H5hut error
call h5_abort_on_error()
@@ -51,6 +56,8 @@
! cleanup
status = h5_closefile (file_id)
call mpi_finalize(ierr)
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
end program write_file_attribs
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#define FNAME "example_step_attribs.h5"
+11 -4
View File
@@ -11,8 +11,11 @@
program write_step_attribs
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
integer*8, parameter :: verbosity_level = 1
character (len=*), parameter :: FNAME = "example_step_attribs.h5"
@@ -29,11 +32,13 @@
real*4, parameter, dimension(*) :: r4_value = (/2.71828/)
real*8, parameter, dimension(*) :: r8_value = (/3.141592653589793238462643383279502884197169/)
integer :: ierr
integer*8 :: file_id, status
#if defined(PARALLEL_IO)
integer :: ierr
call mpi_init(ierr)
#endif
! abort program on any H5hut error
call h5_abort_on_error()
@@ -54,6 +59,8 @@
! cleanup
status = h5_closefile (file_id)
call mpi_finalize(ierr)
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
end program write_step_attribs
+1 -2
View File
@@ -8,6 +8,7 @@
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
@@ -34,10 +35,8 @@ noinst_PROGRAMS += \
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += read_write_scalar_fieldf
endif
endif
attach_field_attributes_SOURCES = attach_field_attributes.c
dump_field_attributes_SOURCES = dump_field_attributes.c
+1 -5
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_field.h5";
@@ -23,11 +24,6 @@ main (
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
//H5SetDebugMask (-1);
+7 -4
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
Copyright (c) 2006-2017, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
@@ -8,6 +8,9 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <inttypes.h>
// name of output file
const char* fname = "example_field.h5";
@@ -30,9 +33,9 @@ dump_int64_attrib (
attrib_data);
printf ("Attribute: '%s'\n", attrib_name);
printf (" Type: H5_INT64_T\n");
printf (" Data: %lld", attrib_data[0]);
printf (" Data: %" PRId64, attrib_data[0]);
for (size_t i = 1; i < attrib_nelems; i++) {
printf (", %lld", attrib_data[i]);
printf (", %" PRId64, attrib_data[i]);
}
printf ("\n");
}
@@ -174,7 +177,7 @@ main (
h5_ssize_t n_attribs = H5BlockGetNumFieldAttribs (
file,
field_name);
printf ("Field has %lld attributes attached.\n",
printf ("Field has %" PRId64 " attributes attached.\n",
n_attribs);
// dump all attached attributes
+10
View File
@@ -1,4 +1,14 @@
/*
Copyright (c) 2006-2017, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include <H5hut.h>
#include "examples.h"
#define XSIZE 8
#define YSIZE 8
+7 -4
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
Copyright (c) 2006-2017, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
@@ -8,6 +8,9 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <inttypes.h>
// name of output file
const char* fname = "example_write_field.h5";
@@ -69,10 +72,10 @@ main (
} else if (type == H5_STRING_T) {
stype = "H5_STRING_T";
}
printf ("rank of field: %lld\n", field_rank);
printf ("dims of field: [%lld, %lld, %lld]\n",
printf ("rank of field: %" PRId64 "\n", field_rank);
printf ("dims of field: [%" PRId64 ", %" PRId64 ", %" PRId64"]\n",
field_dims[0], field_dims[1], field_dims[2]);
printf ("rank of field data: %lld\n", elem_rank);
printf ("rank of field data: %" PRId64 "\n", elem_rank);
printf ("type of field data: '%s'\n", stype);
done:
// done
+2 -1
View File
@@ -1,5 +1,5 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
Copyright (c) 2006-2017, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
+15 -2
View File
@@ -11,13 +11,17 @@ include 'H5hut.f90'
program read_write_scalar_field
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
integer :: comm = 0
integer :: mpi_err
#endif
integer :: nargs = 0
integer :: comm_rank = 0
integer :: comm_size = 1
integer :: comm = 0
integer :: mpi_err
integer*8 :: h5_err
integer :: i
character(len=32) :: arg_str
@@ -174,10 +178,15 @@ program read_write_scalar_field
end do
! init MPI & H5hut
#if defined(PARALLEL_IO)
comm = MPI_COMM_WORLD
call mpi_init(mpi_err)
call mpi_comm_rank(comm, comm_rank, mpi_err)
call mpi_comm_size (comm, comm_size, mpi_err)
#else
comm_size = 1
comm_rank = 0
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (511_8)
@@ -215,7 +224,9 @@ program read_write_scalar_field
case default
print *, "Run this test on 1, 8, 16 or 32 cores!"
#if defined(PARALLEL_IO)
call mpi_finalize
#endif
call exit (1)
end select
@@ -233,7 +244,9 @@ program read_write_scalar_field
endif
print "('[proc ', I3, ']: Cleanup.')", comm_rank
#if defined(PARALLEL_IO)
call mpi_finalize
#endif
print "('[proc ', I3, ']: Done.')", comm_rank
call exit (0)
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_field.h5";
+1 -1
View File
@@ -3,7 +3,7 @@
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef H5_HAVE_PARALLEL
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
+1 -1
View File
@@ -3,7 +3,7 @@
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef H5_HAVE_PARALLEL
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
+1 -1
View File
@@ -4,7 +4,7 @@
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef H5_HAVE_PARALLEL
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
+2 -2
View File
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include "H5hut.h"
#if defined (PARALLEL_IO)
#if defined (H5_HAVE_PARALLEL)
#include <mpi.h>
#endif
@@ -87,7 +87,7 @@ done:
H5FedCloseMesh (m);
H5CloseFile (f);
#if defined (PARALLEL_IO)
#if defined (H5_HAVE_PARALLEL)
MPI_Finalize ();
#endif
+2 -2
View File
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include "H5hut.h"
#if defined (PARALLEL_IO)
#if defined (H5_HAVE_PARALLEL)
#include <mpi.h>
#endif
@@ -253,7 +253,7 @@ main (
/* done */
H5CloseFile (f);
#if defined (PARALLEL_IO)
#if defined (H5_HAVE_PARALLEL)
MPI_Finalize ();
#endif
+1 -1
View File
@@ -3,7 +3,7 @@
#include "H5hut.h"
#ifndef PARALLEL_IO
#ifndef H5_HAVE_PARALLEL
#ifndef MPI_COMM_WORLD
#define MPI_COMM_WORLD 0
#endif
+2 -3
View File
@@ -1,5 +1,5 @@
#
# Copyright (c) 2006-2015, The Regents of the University of California,
# Copyright (c) 2006-2017, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory (subject to receipt of any
# required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
# Institut (Switzerland). All rights reserved.!
@@ -8,6 +8,7 @@
#
AM_CPPFLAGS += -I${abs_top_srcdir}/src/include
AM_CPPFLAGS += -I${abs_top_srcdir}/examples/include
FFLAGS += -cpp $(AM_CPPFLAGS)
AM_LDFLAGS += -L${abs_top_builddir}/src/h5core/.libs
@@ -42,7 +43,6 @@ noinst_PROGRAMS += \
endif
if ENABLE_FORTRAN
if ENABLE_PARALLEL
noinst_PROGRAMS += \
read_core_vfdf \
read_canonicalviewf \
@@ -54,7 +54,6 @@ noinst_PROGRAMS += \
write_setviewf \
write_stridedf
endif
endif
EXTRA_PROGRAMS =
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#define FNAME "example_setview.h5"
#define VERBOSITY H5_VERBOSE_ERROR
+1 -2
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
@@ -25,8 +26,6 @@ main (
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
+10 -2
View File
@@ -11,7 +11,10 @@ include 'H5hut.f90'
program read_canonicalview
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of input file
character (len=*), parameter :: fname = "example_setview.h5"
@@ -19,17 +22,19 @@ program read_canonicalview
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer :: comm_rank = 0
integer*8 :: file, h5_ierror
integer*8 :: num_particles
integer*8 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -53,6 +58,9 @@ program read_canonicalview
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program read_canonicalview
+1 -2
View File
@@ -14,6 +14,7 @@
the VFD core driver.
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
@@ -32,8 +33,6 @@ main (
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
+10 -3
View File
@@ -11,7 +11,10 @@ include 'H5hut.f90'
program read_core_vfd
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of input file
character (len=*), parameter :: fname = "example_core_vfd.h5"
@@ -19,8 +22,6 @@ program read_core_vfd
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: prop
integer*8 :: num_particles
@@ -28,10 +29,13 @@ program read_core_vfd
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
integer :: comm_rank = 0
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -57,6 +61,9 @@ program read_core_vfd
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program read_core_vfd
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
+11 -1
View File
@@ -11,7 +11,10 @@ include 'H5hut.f90'
program read_setnparticles
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of input file
character (len=*), parameter :: fname = "example_setnparticles.h5"
@@ -19,17 +22,21 @@ program read_setnparticles
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer :: comm_size = 1
integer :: comm_rank = 0
integer*8 :: file, h5_ierror
integer*8 :: num_particles, num_particles_total
integer*8 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -61,6 +68,9 @@ program read_setnparticles
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program read_setnparticles
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
+13 -3
View File
@@ -11,25 +11,32 @@ include 'H5hut.f90'
program read_setviewf
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of input file
character (len=*), parameter :: fname = "example_setview.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer :: comm_size = 1
integer :: comm_rank = 0
integer*8 :: file, h5_ierror
integer*8 :: num_particles, num_particles_total
integer*8 :: i, start, end, remainder
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -78,6 +85,9 @@ program read_setviewf
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program read_setviewf
+1
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
#include <stdlib.h>
+14 -2
View File
@@ -11,24 +11,33 @@ include 'H5hut.f90'
program read_stridedf
use H5hut
implicit none
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of input file
character (len=*), parameter :: fname = "example_strided.h5"
! H5hut verbosity level
integer*8, parameter :: h5_verbosity = H5_VERBOSE_DEFAULT
integer :: comm, comm_size, comm_rank, mpi_ierror
integer*8 :: file, h5_ierror
integer*8 :: num_particles, num_particles_total
real*8, allocatable :: data(:)
integer*8 :: i, start
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, comm_size, comm_rank, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_error)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#else
integer :: comm_size = 1
integer :: comm_rank = 0
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -68,6 +77,9 @@ program read_stridedf
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program read_stridedf
+1 -2
View File
@@ -14,6 +14,7 @@
the VFD core driver.
*/
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_core_vfd.h5";
@@ -33,8 +34,6 @@ main (
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
+13 -4
View File
@@ -11,8 +11,11 @@ include 'H5hut.f90'
program write_core_vfd
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of output file
character (len=*), parameter :: fname = "example_core_vfd.h5"
@@ -22,17 +25,20 @@ program write_core_vfd
! number of particles we are going to write per core
integer*4, parameter :: num_particles = 32
integer :: comm, comm_size, comm_rank, mpi_ierror
integer :: comm_rank = 0
integer*8 :: file, h5_ierror
integer*8 :: prop
integer*4 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -57,6 +63,9 @@ program write_core_vfd
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program write_core_vfd
+1 -2
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_setnparticles.h5";
@@ -27,8 +28,6 @@ main (
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
+12 -4
View File
@@ -11,8 +11,10 @@ include 'H5hut.f90'
program write_setnparticles
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of output file
character (len=*), parameter :: fname = "example_setnparticles.h5"
@@ -23,16 +25,19 @@ program write_setnparticles
! number of particles we are going to write per core
integer*8, parameter :: num_particles = 32
integer :: comm, comm_size, comm_rank, mpi_ierror
integer :: comm_rank = 0
integer*8 :: file, h5_ierror
integer*4 :: i
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -55,6 +60,9 @@ program write_setnparticles
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program write_setnparticles
+52 -7
View File
@@ -7,36 +7,79 @@
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
const h5_int64_t h5_debug_mask = 0;
// we are going to write multiple consecutive blocks
const h5_int64_t num_blocks = 4;
const h5_int64_t num_particles_per_block = 32;
//const h5_int64_t num_blocks = 32;
//const h5_int64_t num_particles_per_block = 1048576*8;
int
main (
int argc,
char* argv[]
){
if (argc < 3) {
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
exit (1);
}
char* endptr = NULL;
long long n = strtoll (argv[1], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1) {
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "first argument (number of block) to large!\n");
exit (1);
}
h5_int64_t num_blocks = (h5_int64_t)n;
n = strtoll (argv[2], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1024) {
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "second argument (sizeof block) to large!\n");
exit (1);
}
h5_int64_t num_particles_per_block = (h5_int64_t)n;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debug_mask);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileAlign (prop, 1048576*8);
H5SetPropFileMPIOIndependent (prop, &comm);
//H5SetPropFileMPIOCollective (prop, &comm);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, H5_PROP_DEFAULT);
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
//H5PartSetChunkSize (file, 1048576*1);
H5SetStep (file, 0);
/*
@@ -53,7 +96,9 @@ main (
// write multiple consecutive blocks
for (int i = 0; i < num_blocks; i++) {
// create fake data
h5_int32_t data[num_particles_per_block];
//h5_int32_t data[num_particles_per_block];
h5_int64_t *data;
data = calloc (num_particles_per_block, sizeof(*data));
for (int j = 0; j < num_particles_per_block; j++) {
data[j] = j + i*num_particles_per_block + offset;
}
@@ -64,7 +109,7 @@ main (
offset + i*num_particles_per_block,
offset + (i+1)*num_particles_per_block - 1);
// write data
H5PartWriteDataInt32 (file, "data", data);
H5PartWriteDataInt64 (file, "data", data);
}
// done
+120
View File
@@ -0,0 +1,120 @@
/*
Copyright (c) 2006-2015, The Regents of the University of California,
through Lawrence Berkeley National Laboratory (subject to receipt of any
required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
Institut (Switzerland). All rights reserved.
License: see file COPYING in top level of source distribution.
*/
#include <stdlib.h>
#include <mpi.h>
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_setview.h5";
// H5hut verbosity level
const h5_int64_t h5_verbosity = H5_VERBOSE_DEFAULT;
const h5_int64_t h5_debug_mask = 0;
// we are going to write multiple consecutive blocks
//const h5_int64_t num_blocks = 32;
//const h5_int64_t num_particles_per_block = 1048576*8;
int
main (
int argc,
char* argv[]
){
if (argc < 3) {
fprintf (stderr, "Usage: %s <number_of_blocks> <sizeof_block>\n", argv[0]);
exit (1);
}
char* endptr = NULL;
long long n = strtoll (argv[1], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "first argument (number of blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1) {
fprintf (stderr, "first argument (number of block) must be >= 1!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "first argument (number of block) to large!\n");
exit (1);
}
h5_int64_t num_blocks = (h5_int64_t)n;
n = strtoll (argv[2], &endptr, 10);
if (*endptr != 0) {
fprintf (stderr, "second argument (sizeof blocks) is not a unsigned integer!\n");
exit (1);
}
if (n < 1024) {
fprintf (stderr, "second argument (sizeof block) must be >= 1024!\n");
exit (1);
}
if (n == LLONG_MAX) {
fprintf (stderr, "second argument (sizeof block) to large!\n");
exit (1);
}
h5_int64_t num_particles_per_block = (h5_int64_t)n;
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
H5SetVerbosityLevel (h5_verbosity);
H5SetDebugMask (h5_debug_mask);
h5_prop_t prop = H5CreateFileProp ();
H5SetPropFileAlign (prop, 1048576*8);
H5SetPropFileMPIOIndependent (prop, &comm);
//H5SetPropFileMPIOCollective (prop, &comm);
// open file and create first step
h5_file_t file = H5OpenFile (fname, H5_O_WRONLY, prop);
//H5PartSetChunkSize (file, 1048576*1);
H5SetStep (file, 0);
/*
If we want to write consecutive blocks, the 'view' can be defined
with H5PartSetview(). Otherwise we have to define the total number
of particles with H5PartSetNumParticles().
*/
const h5_int64_t offset = comm_rank * num_blocks * num_particles_per_block;
H5PartSetView (
file,
offset,
offset + num_blocks*num_particles_per_block -1);
dataset_id = H5PartCreateDataSet (file, "data");
// write multiple consecutive blocks
for (int i = 0; i < num_blocks; i++) {
// create fake data
//h5_int32_t data[num_particles_per_block];
h5_int64_t *data;
data = calloc (num_particles_per_block, sizeof(*data));
for (int j = 0; j < num_particles_per_block; j++) {
data[j] = j + i*num_particles_per_block + offset;
}
// set the "view" to select a subset of the dataset
H5PartSetViewOnDataset (
file,
offset + i*num_particles_per_block,
offset + (i+1)*num_particles_per_block - 1);
// write data
H5PartWriteDatasetInt64 (dataset_id, data);
}
H5CloseDataset (dataset_id);
// done
H5CloseFile(file);
MPI_Finalize();
return 0;
}
+13 -4
View File
@@ -11,8 +11,11 @@ include 'H5hut.f90'
program write_setview
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! name of output file
character (len=*), parameter :: fname = "example_setview.h5"
@@ -23,16 +26,19 @@ program write_setview
integer*8, parameter :: num_blocks = 4;
integer*8, parameter :: num_particles_per_block = 32
integer :: comm, comm_size, comm_rank, mpi_ierror
integer :: comm_rank = 0
integer*8 :: file, h5_ierror
integer*8 :: i, j, offset
integer*4, allocatable :: data(:)
! initialize MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, mpi_ierror
comm = MPI_COMM_WORLD
call mpi_init (mpi_ierror)
call mpi_comm_size (comm, comm_size, mpi_ierror)
call mpi_comm_rank (comm, comm_rank, mpi_ierror)
#endif
call h5_abort_on_error ()
call h5_set_verbosity_level (h5_verbosity)
@@ -61,6 +67,9 @@ program write_setview
! cleanup
deallocate (data)
h5_ierror = h5_closefile (file)
call mpi_finalize (mpi_ierror)
#if defined(PARALLEL_IO)
call mpi_finalize (mpi_ierror)
#endif
end program write_setview
+1 -2
View File
@@ -8,6 +8,7 @@
*/
#include "H5hut.h"
#include "examples.h"
// name of output file
const char* fname = "example_strided.h5";
@@ -27,8 +28,6 @@ main (
// initialize MPI & H5hut
MPI_Init (&argc, &argv);
MPI_Comm comm = MPI_COMM_WORLD;
int comm_size = 1;
MPI_Comm_size (comm, &comm_size);
int comm_rank = 0;
MPI_Comm_rank (comm, &comm_rank);
H5AbortOnError ();
+11 -2
View File
@@ -11,22 +11,29 @@ include 'H5hut.f90'
program write_stridedf
use H5hut
implicit none
include 'mpif.h'
#if defined(PARALLEL_IO)
include 'mpif.h'
#endif
! the file name we want to read
character (len=*), parameter :: FNAME = "example_strided.h5"
integer*8, parameter :: NPOINTS = 99
integer :: comm, rank, ierr
integer :: rank = 0
integer*8 :: file, status
integer*4 :: i
real*8, allocatable :: particles(:)
integer*8, allocatable :: id(:)
! init MPI & H5hut
#if defined(PARALLEL_IO)
integer :: comm, ierr
comm = MPI_COMM_WORLD
call mpi_init(ierr)
call mpi_comm_rank(comm, rank, ierr)
#endif
call h5_abort_on_error ()
! create fake data
@@ -66,6 +73,8 @@ program write_stridedf
deallocate(particles, id)
#if defined(PARALLEL_IO)
call mpi_finalize(ierr)
#endif
end program write_stridedf
+3
View File
@@ -0,0 +1,3 @@
#ifndef PARALLEL_IO
#endif
+13
View File
@@ -0,0 +1,13 @@
#ifndef __EXAMPLES_H
#define __EXAMPLES_H
#if !defined (H5_HAVE_PARALLEL)
#define MPI_COMM_WORLD (0)
#define MPI_Init(argc, argv)
#define MPI_Comm_size(comm,nprocs) {comm = 0; *nprocs = 1;}
#define MPI_Comm_rank(comm,rank) {comm = 0; (void)(comm); *rank = 0;}
#define MPI_Finalize()
#endif
#endif
+4 -5
View File
@@ -25,7 +25,7 @@ h5_createprop_file (
H5_API_RETURN ((h5_int64_t)h5_create_prop (H5_PROP_FILE));
}
#if defined(PARALLEL_IO)
#if defined(H5_HAVE_PARALLEL)
#define h5_setprop_file_mpio FC_MANGLING( \
h5_setprop_file_mpio, \
H5_SETPROP_FILE_MPIO)
@@ -165,10 +165,9 @@ h5_openfile (
h5_int64_t* _props,
const int _len_fname
) {
int len_fname = strlenf (_fname, _len_fname);
H5_API_ENTER (h5_int64_t,
"fname = %*s, mode=%lld, props=%lld",
len_fname, _fname, (long long int)*_mode, (long long int)*_props);
_len_fname, _fname, (long long int)*_mode, (long long int)*_props);
char* fname = h5_strdupfor2c (_fname, _len_fname);
h5_int64_t mode = *_mode;
h5_prop_t props = (h5_prop_t)*_props;
@@ -222,7 +221,7 @@ h5_flushstep (
) {
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_flush_step (fh));
H5_API_RETURN (h5_flush_iteration (fh));
}
#define h5_finalize FC_MANGLING( \
@@ -233,7 +232,7 @@ h5_finalize (
void
) {
H5_API_ENTER (h5_int64_t, "%s", "");
H5_API_RETURN (h5_close_hdf5());
H5_API_RETURN (h5_close_h5hut ());
}
+3 -2
View File
@@ -69,7 +69,8 @@ h5bl_3d_setview (
f,
*i_start-1, *i_end-1,
*j_start-1, *j_end-1,
*k_start-1, *k_end-1 ));
*k_start-1, *k_end-1,
0));
}
#define h5bl_3d_getview FC_MANGLING ( \
@@ -188,7 +189,7 @@ h5bl_3d_getchunk (
}
#ifdef PARALLEL_IO
#if defined(H5_HAVE_PARALLEL)
#define h5bl_3d_setgrid FC_MANGLING ( \
h5bl_3d_setgrid, \
h5bl_3d_setgrid)
+8 -8
View File
@@ -28,7 +28,7 @@ h5pt_writedata_r8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -49,7 +49,7 @@ h5pt_writedata_r4 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -70,7 +70,7 @@ h5pt_writedata_i8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_INT64_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -91,7 +91,7 @@ h5pt_writedata_i4 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_write_data (
h5_int64_t herr = h5u_write_dataset (
f, name2, (void*)data, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -114,7 +114,7 @@ h5pt_readdata_r8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_FLOAT64_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -135,7 +135,7 @@ h5pt_readdata_r4 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_FLOAT32_T );
free ( name2 );
H5_API_RETURN(herr);
@@ -156,7 +156,7 @@ h5pt_readdata_i8 (
"fh=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_INT64_T );
free ( name2 );
@@ -178,7 +178,7 @@ h5pt_readdata_i4 (
"hf=%p, name='%s', data=%p, l_name=%d",
(h5_file_p)f, name, data, l_name);
char *name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5u_read_data (
h5_int64_t herr = h5u_read_dataset (
f, name2, data, H5_INT32_T );
free ( name2 );
H5_API_RETURN(herr);
+7 -7
View File
@@ -22,13 +22,13 @@
h5_int64_t
h5pt_setnpoints (
const h5_int64_t* const fh,
const h5_int64_t* const npoints
const h5_int64_t* const num_items
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, npoints=%lld",
(h5_file_p)f, (long long)*npoints);
H5_API_RETURN (h5u_set_num_points (f, *npoints, 1));
(h5_file_p)f, (long long)*num_items);
H5_API_RETURN (h5u_set_num_items (f, *num_items, 1));
}
#define h5pt_setnpoints_strided FC_MANGLING ( \
@@ -37,14 +37,14 @@ h5pt_setnpoints (
h5_int64_t
h5pt_setnpoints_strided (
const h5_int64_t* const fh,
const h5_int64_t* const npoints,
const h5_int64_t* const num_items,
const h5_int64_t* const stride
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t,
"fh=%p, npoints=%lld, stride=%lld",
(h5_file_p)f, (long long)*npoints, (long long)*stride);
H5_API_RETURN (h5u_set_num_points (f, *npoints, *stride));
(h5_file_p)f, (long long)*num_items, (long long)*stride);
H5_API_RETURN (h5u_set_num_items (f, *num_items, *stride));
}
@@ -172,7 +172,7 @@ h5pt_getnpoints (
) {
h5_file_t f = h5_filehandlefor2c (fh);
H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
H5_API_RETURN (h5u_get_num_points (f));
H5_API_RETURN (h5u_get_num_items (f));
}
#define h5pt_getdatasetname FC_MANGLING ( \
+19 -17
View File
@@ -380,7 +380,7 @@ h5_getnstepattribs (
H5_API_ENTER (h5_int64_t,
"fh=%p",
(h5_file_p)f);
H5_API_RETURN (h5_get_num_step_attribs (f));
H5_API_RETURN (h5_get_num_iteration_attribs (f));
}
#define h5_getstepattribinfo FC_MANGLING( \
@@ -405,7 +405,7 @@ h5_getstepattribinfo (
(h5_file_p)f,
(long long)*attrib_idx,
attrib_name, attrib_type, attrib_nelem);
h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
h5_int64_t h5err = h5_get_iteration_attrib_info_by_idx (
f,
*attrib_idx - 1,
attrib_name, l_attrib_name,
@@ -435,7 +435,7 @@ h5_getstepattribinfo_by_name (
(h5_file_p)fh,
l_name, _name, _type, _nelem);
char* name = h5_strdupfor2c (_name, l_name);
h5_int64_t h5err = h5_get_step_attrib_info_by_name (
h5_int64_t h5err = h5_get_iteration_attrib_info_by_name (
f,
name,
_type,
@@ -459,7 +459,7 @@ h5_getstepattribinfo_by_name (
*/
static inline h5_int64_t
write_step_attrib (
write_iteration_attrib (
const h5_file_t fh,
const char* name,
const int l_name,
@@ -468,13 +468,14 @@ write_step_attrib (
const hsize_t l_buffer
) {
char *name2 = h5_strdupfor2c (name, l_name);
h5_int64_t herr = h5_write_step_attrib (fh, name2, type, buffer, l_buffer );
h5_int64_t herr = h5_write_iteration_attrib (
fh, name2, type, buffer, l_buffer );
free (name2);
return herr;
}
static inline h5_int64_t
read_step_attrib (
read_iteration_attrib (
const h5_file_t fh,
const char* name,
const int l_name,
@@ -482,7 +483,7 @@ read_step_attrib (
void* const buffer
) {
char* name2 = h5_strdupfor2c ( name, l_name );
h5_int64_t herr = h5_read_step_attrib (fh, name2, type, buffer);
h5_int64_t herr = h5_read_iteration_attrib (fh, name2, type, buffer);
free (name2);
return herr;
}
@@ -503,7 +504,7 @@ h5_writestepattrib_string (
"f=%p, name='%.*s', buffer='%.*s'",
(h5_file_p)f, l_name, name, l_buffer, buffer);
char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
h5_int64_t herr = write_step_attrib (
h5_int64_t herr = write_iteration_attrib (
f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
free (buffer2);
H5_API_RETURN (herr);
@@ -524,7 +525,8 @@ h5_readstepattrib_string (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer='%.*s'",
(h5_file_p)f, l_name, name, l_buffer, buffer);
h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer);
h5_int64_t herr = read_iteration_attrib (
f, name, l_name, H5_STRING_T, buffer);
h5_strc2for (buffer, l_buffer);
H5_API_RETURN (herr);
}
@@ -544,7 +546,7 @@ h5_writestepattrib_r8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_FLOAT64_T,
@@ -565,7 +567,7 @@ h5_readstepattrib_r8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_FLOAT64_T,
@@ -587,7 +589,7 @@ h5_writestepattrib_r4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_FLOAT32_T,
@@ -608,7 +610,7 @@ h5_readstepattrib_r4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_FLOAT32_T,
@@ -630,7 +632,7 @@ h5_writestepattrib_i8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_INT64_T,
@@ -651,7 +653,7 @@ h5_readstepattrib_i8 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_INT64_T,
@@ -673,7 +675,7 @@ h5_writestepattrib_i4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p, nelem=%lld",
(h5_file_p)f, l_name, name, buffer, (long long)*nelem);
H5_API_RETURN (write_step_attrib(
H5_API_RETURN (write_iteration_attrib(
f,
name, l_name,
H5_INT32_T,
@@ -694,7 +696,7 @@ h5_readstepattrib_i4 (
H5_API_ENTER (h5_int64_t,
"f=%p, name='%.*s', buffer=%p",
(h5_file_p)f, l_name, name, buffer);
H5_API_RETURN (read_step_attrib(
H5_API_RETURN (read_iteration_attrib(
f,
name, l_name,
H5_INT32_T,
+4 -4
View File
@@ -28,7 +28,7 @@ h5_hasstep (
int,
"f=%p, stepno=%lld",
(h5_file_p)fh, (long long int)step);
H5_API_RETURN (h5_has_step (fh, (*step)-1));
H5_API_RETURN (h5_has_iteration (fh, (*step)-1));
}
#define h5_setstep FC_MANGLING( \
@@ -41,7 +41,7 @@ h5_setstep (
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p, step=%lld", (h5_file_p)fh, (long long)*step);
H5_API_RETURN (h5_set_step (fh, (*step)-1));
H5_API_RETURN (h5_set_iteration (fh, (*step)-1));
}
#define h5_getstep FC_MANGLING( \
@@ -54,7 +54,7 @@ h5_getstep (
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_get_step (fh) + 1);
H5_API_RETURN (h5_get_iteration (fh) + 1);
}
#define h5_getnsteps FC_MANGLING( \
@@ -67,5 +67,5 @@ h5_getnsteps (
h5_file_t fh = h5_filehandlefor2c(f);
H5_API_ENTER (h5_int64_t, "f=%p", (h5_file_p)fh);
H5_API_RETURN (h5_get_num_steps (fh));
H5_API_RETURN (h5_get_num_iterations (fh));
}
+2
View File
@@ -28,6 +28,8 @@ H5hut_wrap.c : $(SWIG_SOURCES)
endif
else
$(info Python is disabled)
endif
clean: clean-am
+1 -1
View File
@@ -60,7 +60,7 @@ libH5hut_la_SOURCES = \
h5b_model.c \
h5b_attribs.c \
private/h5_hdf5.c \
private/h5_init.c \
h5_init.c \
private/h5_hsearch.c \
private/h5_maps.c \
private/h5_fcmp.c \
+24 -32
View File
@@ -31,7 +31,7 @@ h5_has_file_attrib (
}
h5_err_t
h5_has_step_attrib (
h5_has_iteration_attrib (
const h5_file_t f_,
const char* const attrib_name
) {
@@ -41,9 +41,8 @@ h5_has_step_attrib (
"attrib_name='%s'",
f,
attrib_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_attribute_exists (f->step_gid, attrib_name));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_attribute_exists (f->iteration_gid, attrib_name));
H5_RETURN (ret_value);
}
@@ -59,14 +58,13 @@ h5_get_num_file_attribs (
}
h5_ssize_t
h5_get_num_step_attribs (
h5_get_num_iteration_attribs (
const h5_file_t f_ /*!< handle to open file */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_get_num_attribute (f->step_gid));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_get_num_attribute (f->iteration_gid));
H5_RETURN (ret_value);
}
@@ -122,7 +120,7 @@ h5_get_file_attrib_info_by_name (
}
h5_err_t
h5_get_step_attrib_info_by_idx (
h5_get_iteration_attrib_info_by_idx (
const h5_file_t f_, /*!< handle to open file */
const h5_size_t attrib_idx, /*!< index of attribute */
char* attrib_name, /*!< OUT: name of attribute */
@@ -140,10 +138,9 @@ h5_get_step_attrib_info_by_idx (
(long long unsigned)attrib_idx,
attrib_name, (long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->step_gid,
f->iteration_gid,
attrib_idx,
attrib_name, len_attrib_name,
attrib_type, attrib_nelem));
@@ -151,7 +148,7 @@ h5_get_step_attrib_info_by_idx (
}
h5_err_t
h5_get_step_attrib_info_by_name (
h5_get_iteration_attrib_info_by_name (
const h5_file_t f_, /*!< handle to open file */
const char* const attrib_name, /*!< OUT: name of attribute */
h5_int64_t* const attrib_type, /*!< OUT: H5 type of attribute */
@@ -165,10 +162,9 @@ h5_get_step_attrib_info_by_name (
f,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type, attrib_nelem));
H5_RETURN (ret_value);
@@ -199,7 +195,7 @@ h5_read_file_attrib (
}
h5_err_t
h5_read_step_attrib (
h5_read_iteration_attrib (
const h5_file_t f_,
const char* const attrib_name,
const h5_types_t attrib_type,
@@ -213,12 +209,10 @@ h5_read_step_attrib (
attrib_name,
(long long int)attrib_type,
attrib_value);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_READABLE_MODE (f);
check_iteration_is_readable (f);
TRY (ret_value = h5priv_read_attrib (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type,
attrib_value));
@@ -231,17 +225,17 @@ h5_write_file_attrib (
const char* const attrib_name,
const h5_types_t attrib_type,
const void* const attrib_value,
const hsize_t attrib_nelem
const h5_size_t attrib_nelem
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%lld, "
"attrib_value=%p, attrib_nelem=%llu",
"attrib_value=%p, attrib_nelem=%lld",
f,
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem);
(long long)attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
if (is_appendonly (f)) {
@@ -263,7 +257,7 @@ h5_write_file_attrib (
}
h5_err_t
h5_write_step_attrib (
h5_write_iteration_attrib (
const h5_file_t f_,
const char* const attrib_name,
const h5_types_t attrib_type,
@@ -273,25 +267,23 @@ h5_write_step_attrib (
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, attrib_name='%s', attrib_type=%lld, "
"attrib_value=%p, attrib_nelem=%llu",
"attrib_value=%p, attrib_nelem=%lld",
f,
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
CHECK_WRITABLE_MODE (f);
(long long)attrib_nelem);
check_iteration_is_writable (f);
if (is_appendonly (f)) {
TRY (h5priv_append_attrib (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type,
attrib_value,
attrib_nelem));
} else {
TRY (h5priv_write_attrib (
f->step_gid,
f->iteration_gid,
attrib_name,
attrib_type,
attrib_value,
+9 -5
View File
@@ -9,7 +9,11 @@
#include "h5core/h5_log.h"
#include "h5core/h5_err.h"
#include "private/h5_init.h"
extern int h5_myproc;
#include <stdlib.h>
static h5_errorhandler_t h5_errhandler = h5_report_errorhandler;
h5_err_t h5_errno;
@@ -99,7 +103,7 @@ h5_verror (
const char* const fmt,
va_list ap
) {
if (h5_log_level == 0) return;
if (__h5_log_level == 0) return;
char fmt2[2048];
snprintf (fmt2,
sizeof(fmt2), "[proc %d] E: %s: %s\n",
@@ -123,7 +127,7 @@ h5_report_errorhandler (
const char* const fmt,
va_list ap
) {
if (h5_log_level > 0) {
if (__h5_log_level > 0) {
h5_verror (fmt, ap);
}
return h5_errno;
@@ -140,10 +144,10 @@ h5_abort_errorhandler (
const char* const fmt,
va_list ap
) {
if (h5_log_level > 0) {
if (__h5_log_level > 0) {
h5_verror (fmt, ap);
}
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
MPI_Abort(MPI_COMM_WORLD, -(int)h5_errno);
#else
exit (-(int)h5_errno);
+118 -79
View File
@@ -42,12 +42,7 @@ h5_check_filehandle (
const h5_file_t f_ /*!< filehandle to check validity of */
) {
h5_file_p f = (h5_file_p)f_;
if (f == NULL || f_ == H5_FAILURE || f->file < 0 || f->u == NULL || f->b == NULL) {
return h5_error (
H5_ERR_BADF,
"Called with bad filehandle.");
}
return H5_SUCCESS;
return is_valid_file_handle (f) ? H5_SUCCESS : H5_ERR;
}
hid_t
@@ -56,7 +51,7 @@ h5_get_hdf5_file(
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (hid_t, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
H5_RETURN (f->file);
}
@@ -69,7 +64,7 @@ hdf5_error_handler (
void* __f
) {
UNUSED_ARGUMENT (__f);
if (h5_get_loglevel() >= 5) {
if (h5_get_loglevel() >= 4) {
H5Eprint (estack_id, stderr);
}
return 0;
@@ -80,7 +75,7 @@ mpi_init (
const h5_file_p f
) {
H5_INLINE_FUNC_ENTER (h5_err_t);
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
TRY (h5priv_mpi_comm_size (f->props->comm, &f->nprocs));
TRY (h5priv_mpi_comm_rank (f->props->comm, &f->myproc));
@@ -97,7 +92,7 @@ mpi_init (
TRY (hdf5_set_fapl_mpiposix_property (f->props->access_prop,
f->props->comm, use_gpfs));
} else if ((f->props->flags & H5_VFD_CORE)) {
} else if ((f->props->flags & H5_VFD_CORE_IO)) {
h5_info("Selecting CORE VFD");
TRY (hdf5_set_fapl_core (f->props->access_prop,
f->props->align, 1));
@@ -117,7 +112,7 @@ mpi_init (
}
#else
// VFD_MPIO_POSIX has been removed in HDF5 1.8.13
if ((f->props->flags & H5_VFD_CORE)) {
if ((f->props->flags & H5_VFD_CORE_IO)) {
h5_info("Selecting CORE VFD");
TRY (hdf5_set_fapl_core (f->props->access_prop,
f->props->align, 1));
@@ -141,7 +136,7 @@ mpi_init (
TRY (h5_optimize_for_lustre(f, filename));
}
#endif
#endif /* PARALLEL_IO */
#endif /* H5_HAVE_PARALLEL */
H5_RETURN (H5_SUCCESS);
}
@@ -175,13 +170,15 @@ set_default_file_props (
h5_prop_file_t* props = (h5_prop_file_t*)_props;
bzero (props, sizeof (*props));
props->class = H5_PROP_FILE;
TRY (props->prefix_step_name = h5_calloc (1, H5_STEPNAME_LEN));
TRY (props->prefix_iteration_name = h5_calloc (1, H5_ITERATION_NAME_LEN));
strncpy (
props->prefix_step_name,
H5_STEPNAME,
H5_STEPNAME_LEN - 1);
props->width_step_idx = H5_STEPWIDTH;
props->prefix_iteration_name,
H5_ITERATION_NAME,
H5_ITERATION_NAME_LEN - 1);
props->width_iteration_idx = H5_ITERATION_NUM_WIDTH;
#ifdef H5_HAVE_PARALLEL
props->comm = MPI_COMM_WORLD;
#endif
H5_RETURN (H5_SUCCESS);
}
@@ -199,14 +196,17 @@ h5_set_prop_file_mpio_collective (
"Invalid property class: %lld",
(long long int)props->class);
}
props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE);
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE_IO);
props->flags |= H5_VFD_MPIO_COLLECTIVE;
props->comm = *comm;
if (props->throttle > 0) {
h5_warn ("Throttling is not permitted with collective VFD. Reset throttling.");
props->throttle = 0;
}
#else
h5_info ("Setting MPIO collective property ignored in serial H5hut");
#endif
H5_RETURN (H5_SUCCESS);
}
@@ -224,9 +224,13 @@ h5_set_prop_file_mpio_independent (
"Invalid property class: %lld",
(long long int)props->class);
}
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE);
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE_IO);
props->flags |= H5_VFD_MPIO_INDEPENDENT;
props->comm = *comm;
#else
h5_info ("Setting MPIO independent property ignored in serial H5hut");
#endif
H5_RETURN (H5_SUCCESS);
}
@@ -245,9 +249,13 @@ h5_set_prop_file_mpio_posix (
"Invalid property class: %lld",
(long long int)props->class);
}
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE);
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_POSIX | H5_VFD_CORE_IO);
props->flags |= H5_VFD_MPIO_INDEPENDENT;
props->comm = *comm;
#else
h5_info ("Setting MPIO POSIX property ignored in serial H5hut");
#endif
H5_RETURN (H5_SUCCESS);
}
#endif
@@ -258,7 +266,8 @@ h5_set_prop_file_core_vfd (
const h5_int64_t increment
) {
h5_prop_file_t* props = (h5_prop_file_t*)_props;
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld", props, (long long int)increment);
H5_CORE_API_ENTER (h5_err_t, "props=%p, increment=%lld",
props, (long long int)increment);
if (props->class != H5_PROP_FILE) {
H5_RETURN_ERROR (
@@ -266,7 +275,10 @@ h5_set_prop_file_core_vfd (
"Invalid property class: %lld",
(long long int)props->class);
}
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_INDEPENDENT | H5_VFD_MPIO_POSIX);
#ifdef H5_HAVE_PARALLEL
props->flags &= ~(H5_VFD_MPIO_COLLECTIVE |
H5_VFD_MPIO_INDEPENDENT |
H5_VFD_MPIO_POSIX);
props->flags |= H5_VFD_MPIO_INDEPENDENT;
props->comm = MPI_COMM_SELF;
props->increment = increment;
@@ -274,6 +286,9 @@ h5_set_prop_file_core_vfd (
h5_warn ("Throttling is not permitted with core VFD. Reset throttling.");
props->throttle = 0;
}
#else
h5_info ("Setting MPIO core property ignored in serial H5hut");
#endif
H5_RETURN (H5_SUCCESS);
}
@@ -298,6 +313,25 @@ h5_set_prop_file_align (
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_set_prop_file_flush_after_write (
h5_prop_t _props
) {
h5_prop_file_t* props = (h5_prop_file_t*)_props;
H5_CORE_API_ENTER (
h5_err_t,
"props=%p",
props);
if (props->class != H5_PROP_FILE) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid property class: %lld",
(long long int)props->class);
}
props->flush = 1;
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_set_prop_file_throttle (
h5_prop_t _props,
@@ -314,6 +348,7 @@ h5_set_prop_file_throttle (
"Invalid property class: %lld",
(long long int)props->class);
}
#ifdef H5_HAVE_PARALLEL
// throttle only if VFD is MPIO independent od POSIX
h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT;
#if H5_VERSION_LE(1,8,12)
@@ -333,6 +368,9 @@ h5_set_prop_file_throttle (
}
props->throttle = throttle;
#else
h5_info ("Setting the throttle property in serial H5hut");
#endif
H5_RETURN (H5_SUCCESS);
}
@@ -369,7 +407,7 @@ h5_close_prop (
switch (prop->class) {
case H5_PROP_FILE: {
h5_prop_file_t* file_prop = (h5_prop_file_t*)prop;
TRY (h5_free (file_prop->prefix_step_name));
TRY (h5_free (file_prop->prefix_iteration_name));
break;
}
default:
@@ -394,14 +432,14 @@ open_file (
f->nprocs = 1; // queried later
f->myproc = 0; // queried later
f->step_gid = -1;
f->iteration_gid = -1;
TRY (f->step_name = h5_calloc (2, H5_STEPNAME_LEN));
TRY (f->iteration_name = h5_calloc (2, H5_ITERATION_NAME_LEN));
sprintf (
f->step_name,
f->iteration_name,
"%s#%0*lld",
f->props->prefix_step_name,
f->props->width_step_idx, (long long)f->step_idx);
f->props->prefix_iteration_name,
f->props->width_iteration_idx, (long long)f->iteration_idx);
TRY (hdf5_set_errorhandler (H5E_DEFAULT, hdf5_error_handler, NULL));
@@ -468,7 +506,6 @@ h5_open_file2 (
TRY (f = h5_calloc (1, sizeof (*f)));
TRY (f->props = (h5_prop_file_t*)h5_create_prop (H5_PROP_FILE));
TRY (set_default_file_props (f->props));
if (props != H5_PROP_DEFAULT) {
if (props->class != H5_PROP_FILE) {
@@ -477,21 +514,25 @@ h5_open_file2 (
"Invalid property class: %lld.",
(long long int)props->class);
}
#ifdef H5_HAVE_PARALLEL
f->props->comm = props->comm;
#endif
f->props->flags = props->flags;
f->props->throttle = props->throttle;
f->props->align = props->align;
strncpy (
f->props->prefix_step_name,
props->prefix_step_name,
H5_STEPNAME_LEN - 1);
f->props->width_step_idx = props->width_step_idx;
f->props->prefix_iteration_name,
props->prefix_iteration_name,
H5_ITERATION_NAME_LEN - 1);
f->props->width_iteration_idx = props->width_iteration_idx;
}
TRY (open_file (f, filename, mode));
TRY (h5_set_stepname_fmt ((uintptr_t)f, H5_STEPNAME, H5_STEPWIDTH));
TRY (h5_set_iteration_name_fmt ((uintptr_t)f,
H5_ITERATION_NAME,
H5_ITERATION_NUM_WIDTH));
H5_RETURN ((h5_file_t)f);
}
@@ -552,9 +593,9 @@ h5_close_file (
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
h5_errno = H5_SUCCESS;
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
TRY (h5priv_close_step (f));
TRY (h5priv_close_iteration (f));
TRY (h5upriv_close_file (f));
TRY (h5bpriv_close_file (f));
TRY (hdf5_close_property (f->props->xfer_prop));
@@ -564,31 +605,31 @@ h5_close_file (
TRY (hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
TRY (h5_close_prop ((h5_prop_t)f->props));
TRY (hdf5_close_file (f->file));
TRY (h5_free (f->step_name));
TRY (h5_free (f->iteration_name));
TRY (h5_free (f));
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_close_hdf5 (
h5_close_h5hut (
void
) {
H5_CORE_API_ENTER (h5_err_t, "%s", "");
TRY (ret_value = hdf5_close ());
H5_RETURN (ret_value);
TRY (h5_finalize ());
TRY (hdf5_close ());
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_flush_step (
h5_flush_iteration (
const h5_file_t f_
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
ret_value = H5_SUCCESS;
if (f->step_gid >= 0) {
TRY (ret_value = hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
if (f->iteration_gid >= 0) {
TRY (ret_value = hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
}
H5_RETURN (ret_value);
}
@@ -599,7 +640,7 @@ h5_flush_file (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_is_writable (f);
TRY (ret_value = hdf5_flush (f->file, H5F_SCOPE_GLOBAL));
H5_RETURN (ret_value);
}
@@ -608,15 +649,15 @@ h5_flush_file (
/*!
\ingroup h5_core_filehandling
Define format of the step names.
Define format of the iteration names.
Example: ==H5FedDefineStepNameFormat( f, "Step", 6 )== defines step names
like ==Step#000042==.
Example: ==h5_set_iteration_name_fmt (f, "Step", 6)==
defines iteration names like ==Step#000042==.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_set_stepname_fmt (
h5_set_iteration_name_fmt (
const h5_file_t f_,
const char* name,
int width
@@ -625,14 +666,14 @@ h5_set_stepname_fmt (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', width=%d",
f, name, width);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
if (width < 0) width = 0;
else if (width > H5_STEPNAME_LEN - 1) width = H5_STEPNAME_LEN - 1;
else if (width > H5_ITERATION_NAME_LEN - 1) width = H5_ITERATION_NAME_LEN - 1;
strncpy (
f->props->prefix_step_name,
f->props->prefix_iteration_name,
name,
H5_STEPNAME_LEN - 1);
f->props->width_step_idx = width;
H5_ITERATION_NAME_LEN - 1);
f->props->width_iteration_idx = width;
H5_RETURN (H5_SUCCESS);
}
@@ -640,16 +681,16 @@ h5_set_stepname_fmt (
/*!
\ingroup h5_core_filehandling
Get format of the step names.
Get format of the iteration names.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_get_stepname_fmt (
h5_get_iteration_name_fmt (
const h5_file_t f_, /*!< Handle to file */
char* const name, /*!< OUT: Prefix */
const int l_name, /*!< length of buffer name */
int* const width /*!< OUT: Width of the number */
char* const name, /*!< OUT: Prefix */
const int l_name, /*!< length of buffer name */
int* const width /*!< OUT: Width of the number */
) {
h5_file_p f = (h5_file_p)f_;
UNUSED_ARGUMENT (f);
@@ -662,19 +703,18 @@ h5_get_stepname_fmt (
/*!
\ingroup h5_core_filehandling
Get current step number.
Get current iteration number.
\return Current step number or error code
\return Current iteration number or error code
*/
h5_id_t
h5_get_step (
h5_get_iteration (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_id_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
H5_RETURN (f->step_idx);
check_iteration_is_readable (f);
H5_RETURN (f->iteration_idx);
}
/*!
@@ -690,43 +730,42 @@ h5_get_num_procs (
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
H5_RETURN (f->nprocs);
}
/*!
\ingroup h5_core_filehandling
Get number of steps.
Get number of iterations.
\return Number of steps or error code
\return Number of iterations or error code
*/
h5_ssize_t
h5_get_num_steps(
h5_get_num_iterations (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
CHECK_FILEHANDLE (f);
check_file_handle_is_valid (f);
TRY (ret_value = hdf5_get_num_groups_matching_prefix (
f->root_gid,
f->props->prefix_step_name));
f->props->prefix_iteration_name));
H5_RETURN (ret_value);
}
/*!
\ingroup h5_core_filehandling
Start traversing steps.
Start traversing iterations.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_start_traverse_steps (
h5_start_traverse_iterations (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (int, "f=%p", f);
H5_CORE_API_ENTER (int, "f=%p", (void*)f_);
/*
fast test: Does Step#0 or Step#1 exist?
@@ -740,12 +779,12 @@ h5_start_traverse_steps (
/*!
\ingroup h5_core_filehandling
Go to next step.
Go to next iteration.
\return \c H5_SUCCESS or error code
*/
h5_err_t
h5_traverse_steps (
h5_traverse_iterations (
const h5_file_t f_ /*!< file handle */
) {
h5_file_p f = (h5_file_p)f_;
@@ -69,6 +69,19 @@ create_array_types (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_array_types (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_coord3d_t));
TRY (hdf5_close_type (h5_dta_types.h5_3glb_idx_t));
TRY (hdf5_close_type (h5_dta_types.h5_4glb_idx_t));
TRY (hdf5_close_type (h5_dta_types.h5_4chk_idx_t));
TRY (hdf5_close_type (h5_dta_types.h5_coord6d_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_vertex_type (
void
@@ -95,6 +108,16 @@ create_vertex_type (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_vertex_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_vertex_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_triangle_type (
void
@@ -158,7 +181,16 @@ create_triangle_type (
}
static inline h5_err_t
create_tag_types (
close_triangle_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_triangle_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_tag_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
@@ -183,6 +215,15 @@ create_tag_types (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_tag_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5t_glb_tag_idx_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_tet_type (
void
@@ -245,6 +286,15 @@ create_tet_type (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_tet_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_tet_t));
H5_RETURN (H5_SUCCESS);
}
#if defined(WITH_PARALLEL_H5GRID)
static inline h5_err_t
@@ -301,6 +351,16 @@ create_chunk_type (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_chunk_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_chunk_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_octree_type (
void
@@ -350,6 +410,15 @@ create_octree_type (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_octree_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_octree_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_userdata_type (
void
@@ -369,6 +438,15 @@ create_userdata_type (
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
close_userdata_type (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (hdf5_close_type (h5_dta_types.h5_userdata_t));
H5_RETURN (H5_SUCCESS);
}
static inline h5_err_t
create_mpi_type_glb_tet (
void
@@ -663,15 +741,16 @@ _h5_exit (int status) {
}
h5_err_t
h5priv_initialize (
h5_initialize (
void
) {
if (h5_initialized) return 0;
memset (&h5_call_stack, 0, sizeof (h5_call_stack));
// must be set here, otherwise next statement will fail!
h5_initialized = 1;
H5_CORE_API_ENTER (h5_err_t, "%s", "void");
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
ret_value = H5_SUCCESS;
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
int mpi_is_initialized;
MPI_Initialized (&mpi_is_initialized);
if (!mpi_is_initialized) {
@@ -690,7 +769,7 @@ h5priv_initialize (
TRY (create_vertex_type ());
TRY (create_triangle_type ());
TRY (create_tet_type ());
TRY (create_tag_types ());
TRY (create_tag_type ());
#if defined(WITH_PARALLEL_H5GRID)
TRY (create_chunk_type ());
@@ -705,3 +784,21 @@ h5priv_initialize (
#endif
H5_RETURN ((ret_value != H5_SUCCESS) ? _h5_exit (42) : H5_SUCCESS);
}
h5_err_t
h5_finalize (
void
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "%s", "void");
TRY (close_array_types ());
TRY (close_vertex_type ());
TRY (close_triangle_type ());
TRY (close_tag_type ());
TRY (close_tet_type ());
#if defined(WITH_PARALLEL_H5GRID)
TRY (close_chunk_type ());
TRY (close_octree_type ());
TRY (close_userdata_type ());
#endif
H5_RETURN (H5_SUCCESS);
}
+47 -35
View File
@@ -9,35 +9,42 @@
#include "h5core/h5_log.h"
#include "h5core/h5_err.h"
#include "private/h5_init.h"
h5_int32_t h5_log_level = H5_VERBOSE_ERROR;
extern int h5_myproc;
h5_int64_t __h5_log_level = H5_VERBOSE_ERROR;
h5_int64_t __h5_debug_mask = 0;
struct call_stack h5_call_stack;
char *h5_rfmts[] = {
[e_int] "%d",
[e_ssize_t] "%ld",
[e_char_p] "%s",
[e_void_p] "%p",
[e_h5_err_t] "%lld",
[e_h5_int64_t] "%lld",
[e_h5_id_t] "%lld",
[e_h5_ssize_t] "%lld",
[e_h5_errorhandler_t] "%p",
[e_h5_file_p] "%p",
[e_h5_file_t] "0x%08x",
[e_h5_lvl_idx_t] "%d",
[e_h5t_iterator_p] "%p",
[e_h5_loc_id_t] "%ld",
[e_h5_loc_idx_t] "%ld",
[e_hid_t] "%lld",
[e_H5O_type_t] "%ld",
[e_h5_glb_elem_p] "%p",
[e_h5_prop_p] "%p",
[e_h5_prop_t] "0x%08x",
[e_h5_prop_file_p] "%p",
[e_h5_prop_file_t] "0x%08x",
[e_herr_t] "%ld"
[e_int] = "%d",
[e_ssize_t] = "%ld",
[e_char_p] = "%s",
[e_void_p] = "%p",
[e_h5_err_t] = "%lld",
[e_h5_int32_t] = "%ld",
[e_h5_uint32_t] = "%lu",
[e_h5_int64_t] = "%lld",
[e_h5_uint64_t] = "%llu",
[e_h5_id_t] = "%lld",
[e_h5_ssize_t] = "%lld",
[e_h5_errorhandler_t] = "%p",
[e_h5_file_p] = "%p",
[e_h5_file_t] = "0x%08x",
[e_h5_lvl_idx_t] = "%d",
[e_h5t_iterator_p] = "%p",
[e_h5_loc_id_t] = "%ld",
[e_h5_loc_idx_t] = "%ld",
[e_hid_t] = "%lld",
[e_H5O_type_t] = "%ld",
[e_h5_glb_elem_p] = "%p",
[e_h5_prop_p] = "%p",
[e_h5_prop_t] = "0x%08x",
[e_h5_prop_file_p] = "%p",
[e_h5_prop_file_t] = "0x%08x",
[e_herr_t] = "%ld"
};
/*!
@@ -56,12 +63,17 @@ char *h5_rfmts[] = {
*/
h5_err_t
h5_set_loglevel (
const h5_id_t level /*!< debug level */
const h5_int64_t level /*!< log level */
) {
if (level < 0)
h5_log_level = ((1 << 20) - 1) & ~0x7;
else
h5_log_level = level;
__h5_log_level = level & 0x7;
return H5_SUCCESS;
}
h5_err_t
h5_set_debug_mask (
const h5_int64_t mask /*!< debug level */
) {
__h5_debug_mask = mask;
return H5_SUCCESS;
}
@@ -72,11 +84,11 @@ h5_set_loglevel (
\return current debug level
*/
h5_err_t
h5_int64_t
h5_get_loglevel (
void
) {
return h5_log_level;
return __h5_log_level;
}
void
@@ -98,7 +110,7 @@ h5_warn (
const char* fmt,
...
) {
if (h5_log_level >= 2) {
if (__h5_log_level >= 2) {
va_list ap;
va_start (ap, fmt);
h5priv_vprintf (stderr, "W", h5_get_funcname(), fmt, ap);
@@ -112,7 +124,7 @@ h5_info (
const char* fmt,
...
) {
if (h5_log_level >= 3) {
if (__h5_log_level >= 3) {
va_list ap;
va_start (ap, fmt);
h5priv_vprintf (stdout, "I", h5_get_funcname(), fmt, ap);
@@ -125,7 +137,7 @@ h5_debug (
const char* const fmt,
...
) {
if (h5_log_level >= 4) {
if (__h5_log_level >= 4) {
char prefix[1024];
snprintf (prefix, sizeof(prefix), "%*s %s",
h5_call_stack_get_level(), "",
+39 -39
View File
@@ -15,94 +15,94 @@
#include "private/h5_model.h"
h5_err_t
h5priv_close_step (
h5priv_close_iteration (
const h5_file_p f
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p", f);
if (f->step_gid <= 0)
if (f->iteration_gid <= 0)
H5_LEAVE (H5_SUCCESS);
TRY (hdf5_close_group (f->step_gid));
TRY (hdf5_close_group (f->iteration_gid));
f->step_gid = -1;
f->iteration_gid = -1;
H5_RETURN (H5_SUCCESS);
}
h5_err_t
h5_set_step (
h5_set_iteration (
const h5_file_t f_, /*!< [in] Handle to open file */
const h5_id_t step_idx /*!< [in] Step to set. */
const h5_id_t iteration_idx /*!< [in] Iteration to set. */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, step_idx=%lld",
f, (long long)step_idx);
"f=%p, iteration_idx=%lld",
f, (long long)iteration_idx);
CHECK_FILEHANDLE (f);
TRY (h5priv_close_step (f));
f->step_idx = step_idx;
TRY (h5priv_close_iteration (f));
f->iteration_idx = iteration_idx;
sprintf (
f->step_name,
f->iteration_name,
"%s#%0*lld",
f->props->prefix_step_name, f->props->width_step_idx,
(long long) f->step_idx);
f->props->prefix_iteration_name, f->props->width_iteration_idx,
(long long) f->iteration_idx);
h5_info (
"Open step #%lld for file %lld",
(long long)f->step_idx,
"Open iteration #%lld in file %lld",
(long long)f->iteration_idx,
(long long)(size_t) f);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->file, f->step_name));
TRY (exists = hdf5_link_exists (f->file, f->iteration_name));
if (exists) {
TRY (f->step_gid = h5priv_open_group (
TRY (f->iteration_gid = h5priv_open_group (
f->file,
f->step_name));
f->iteration_name));
} else if (is_writable (f)) {
TRY (f->step_gid = h5priv_create_group (
TRY (f->iteration_gid = h5priv_create_group (
f->file,
f->step_name));
f->iteration_name));
}
H5_RETURN (H5_SUCCESS);
}
/*
returns:
TRUE (value > 0): if step exists
FALSE (i.e. 0): if step does not exist
TRUE (value > 0): if iteration exists
FALSE (i.e. 0): if iteration does not exist
H5_FAILURE: on error
*/
h5_err_t
h5_has_step (
h5_has_iteration (
const h5_file_t f_, /*!< [in] Handle to open file */
const h5_id_t step_idx /*!< [in] Step number to query */
const h5_id_t iteration_idx /*!< [in] Step number to query */
) {
h5_file_p f = (h5_file_p)f_;
H5_CORE_API_ENTER (h5_err_t, "f=%p, step_idx=%lld", f, (long long)step_idx);
H5_CORE_API_ENTER (h5_err_t,
"f=%p, iteration_idx=%lld",
f, (long long)iteration_idx);
CHECK_FILEHANDLE (f);
char name[2*H5_STEPNAME_LEN];
char name[2*H5_ITERATION_NAME_LEN];
sprintf (name,
"%s#%0*lld",
f->props->prefix_step_name, f->props->width_step_idx,
(long long)step_idx);
f->props->prefix_iteration_name, f->props->width_iteration_idx,
(long long)iteration_idx);
TRY (ret_value = hdf5_link_exists (f->file, name));
H5_RETURN (ret_value);
}
h5_err_t
h5priv_normalize_dataset_name (
const char *name,
char *name2
char* const name
) {
H5_CORE_API_ENTER (h5_err_t, "name='%s', name2='%p'", name, name2);
if ( strlen(name) > H5_DATANAME_LEN-1 ) {
strncpy ( name2, name, H5_DATANAME_LEN-1 );
name2[H5_DATANAME_LEN-1] = '\0';
h5_warn ("Truncated name '%s' to '%s'.", name, name2);
} else {
strcpy (name2, name);
H5_CORE_API_ENTER (h5_err_t, "name='%s'", name);
if (strlen(name) > H5_DATANAME_LEN-1) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Dataset name '%s' to long! "
"Must be less then %d characters.",
name, H5_DATANAME_LEN);
}
if ( strcmp( name2, H5BLOCK_GROUPNAME_BLOCK ) == 0 ) {
if (strcmp (name, H5BLOCK_GROUPNAME_BLOCK) == 0) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Can't create dataset or field with name '%s'"
+9 -17
View File
@@ -33,9 +33,7 @@ h5b_write_field_attrib (
(long long int)attrib_type,
attrib_value,
(long long)attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
TRY( h5bpriv_create_field_group(f, field_name) );
if (is_appendonly (f)) {
@@ -74,8 +72,7 @@ h5b_read_field_attrib (
attrib_name,
(long long)attrib_type,
buffer);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -102,8 +99,7 @@ h5b_has_field_attrib (
f,
field_name,
attrib_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -120,8 +116,7 @@ h5b_get_num_field_attribs (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p field_name='%s'", f, field_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -151,8 +146,7 @@ h5b_get_field_attrib_info_by_idx (
(long long unsigned)attrib_idx,
attrib_name, (long long unsigned)len_attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
TRY (ret_value = h5priv_get_attrib_info_by_idx (
f->b->field_gid,
@@ -180,8 +174,7 @@ h5b_get_field_attrib_info_by_name (
field_name,
attrib_name,
attrib_type, attrib_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_field_group(f, field_name));
TRY (ret_value = h5priv_get_attrib_info_by_name (
f->b->field_gid,
@@ -248,8 +241,7 @@ h5b_set_3d_field_coords (
field_name,
attrib_name,
coords, (long long unsigned)n_coords);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
TRY (check_coords (f, rank, n_coords));
TRY (h5b_write_field_attrib (
@@ -284,8 +276,8 @@ h5b_get_3d_field_coords (
field_name,
attrib_name,
coords, (long long unsigned)n_coords);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
TRY (check_coords (f, rank, n_coords));
TRY (h5b_read_field_attrib (
+6 -12
View File
@@ -47,7 +47,7 @@ h5bpriv_open_file (
b = f->b;
memset (b, 0, sizeof (*b));
#if defined(PARALLEL_IO)
#ifdef H5_HAVE_PARALLEL
size_t n = sizeof (struct h5b_partition) / sizeof (h5_int64_t);
TRY (h5priv_mpi_type_contiguous(n, MPI_LONG_LONG, &b->partition_mpi_t));
#endif
@@ -88,7 +88,7 @@ h5bpriv_close_file (
TRY (hdf5_close_dataspace (b->diskshape));
TRY (hdf5_close_dataspace (b->memshape));
TRY (hdf5_close_property (b->dcreate_prop));
#if defined(PARALLEL_IO)
#ifdef H5_HAVE_PARALLEL
TRY (h5priv_mpi_type_free (&b->partition_mpi_t));
#endif
TRY (h5_free (f->b));
@@ -256,9 +256,7 @@ h5b_write_scalar_data (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, field_name='%s', data=%p, type=%lld",
f, field_name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_create_field_group (f, field_name));
@@ -285,9 +283,7 @@ h5b_write_vector3d_data (
"zdata=%p, "
"type=%lld",
f, field_name, xdata, ydata, zdata, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_writable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_create_field_group(f, field_name));
@@ -430,8 +426,7 @@ h5b_read_scalar_data (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, field_name='%s', data=%p, type=%lld",
f, field_name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_open_field_group(f, field_name));
@@ -457,8 +452,7 @@ h5b_read_vector3d_data (
"zdata=%p, "
"type=%lld",
f, field_name, xdata, ydata, zdata, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
CHECK_LAYOUT (f);
TRY (h5bpriv_open_field_group(f, field_name));
+77 -83
View File
@@ -41,9 +41,8 @@ h5b_has_field_data (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
H5_RETURN (ret_value);
}
@@ -74,7 +73,7 @@ _normalize_partition (
}
}
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
/* MLH: this could be improved with an MPI_Reduce and MAX operator...
* but the user_layout array-of-structs would need to be a struct-of-arrays */
static void
@@ -418,7 +417,6 @@ _dissolve_ghostzones (
p_el = p_save;
}
}
}
h5_free (p_begin);
H5_RETURN (H5_SUCCESS);
@@ -453,12 +451,12 @@ h5bpriv_open_block_group (
h5b_fdata_t *b = f->b;
TRY (hdf5_close_group (b->block_gid));
b->block_gid = hdf5_open_group (f->step_gid, H5BLOCK_GROUPNAME_BLOCK);
b->block_gid = hdf5_open_group (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK);
if (f->b->block_gid < 0)
H5_RETURN_ERROR (
H5_ERR_INVAL,
"%s",
"Time step does not contain H5Block data!");
"step/iteration does not contain H5Block data!");
H5_RETURN (H5_SUCCESS);
}
@@ -469,14 +467,14 @@ _create_block_group (
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "f=%p", f);
h5_err_t exists;
TRY (exists = hdf5_link_exists (f->step_gid, H5BLOCK_GROUPNAME_BLOCK));
TRY (exists = hdf5_link_exists (f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK));
if (exists > 0) {
TRY (h5bpriv_open_block_group(f));
} else {
TRY (hdf5_close_group(f->b->block_gid) );
TRY (f->b->block_gid = hdf5_create_group(
f->step_gid, H5BLOCK_GROUPNAME_BLOCK) );
f->iteration_gid, H5BLOCK_GROUPNAME_BLOCK) );
}
H5_RETURN (H5_SUCCESS);
}
@@ -484,19 +482,18 @@ _create_block_group (
h5_err_t
h5bpriv_open_field_group (
const h5_file_p f, /*!< IN: file handle */
const char *name
char* const name
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
char name2[H5_DATANAME_LEN];
h5priv_normalize_dataset_name (name, name2);
h5priv_normalize_dataset_name (name);
TRY (hdf5_close_group (f->b->field_gid));
TRY (h5bpriv_open_block_group (f));
f->b->field_gid = hdf5_open_group (f->b->block_gid, name2);
f->b->field_gid = hdf5_open_group (f->b->block_gid, name);
if (f->b->field_gid < 0)
return h5_error(
H5_ERR_INVAL,
"Field '%s' does not exist!", name2);
"Field '%s' does not exist!", name);
H5_RETURN (H5_SUCCESS);
}
@@ -504,24 +501,23 @@ h5bpriv_open_field_group (
h5_err_t
h5bpriv_create_field_group (
const h5_file_p f, /*!< IN: file handle */
const char *name /*!< IN: name of field group to create */
char* const name /*!< IN: name of field group to create */
) {
H5_PRIV_API_ENTER (h5_err_t, "f=%p, name='%s'", f, name);
h5b_fdata_t *b = f->b;
TRY( _create_block_group(f) );
char name2[H5_DATANAME_LEN];
h5priv_normalize_dataset_name (name, name2);
h5priv_normalize_dataset_name (name);
h5_err_t exists;
TRY (exists = hdf5_link_exists ( b->block_gid, name2));
TRY (exists = hdf5_link_exists ( b->block_gid, name));
if (exists > 0) {
TRY (h5bpriv_open_field_group (f, name2));
TRY (h5bpriv_open_field_group (f, name));
} else {
TRY (hdf5_close_group (f->b->field_gid) );
TRY (b->field_gid = hdf5_create_group (b->block_gid, name2));
TRY (b->field_gid = hdf5_create_group (b->block_gid, name));
}
H5_RETURN (H5_SUCCESS);
@@ -535,8 +531,7 @@ h5b_3d_has_view (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, ",
f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
H5_RETURN (((h5_file_p)fh)->b->have_layout > 0);
}
@@ -548,7 +543,8 @@ h5b_3d_set_view (
const h5_size_t j_start, /*!< IN: start index of \c j */
const h5_size_t j_end, /*!< IN: end index of \c j */
const h5_size_t k_start, /*!< IN: start index of \c k */
const h5_size_t k_end /*!< IN: end index of \c k */
const h5_size_t k_end, /*!< IN: end index of \c k */
const h5_int64_t dissolve_ghostzones /*!< IN: bool: dissolve ghost-zones */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
@@ -560,8 +556,7 @@ h5b_3d_set_view (
(long long unsigned)i_start, (long long unsigned)i_end,
(long long unsigned)j_start, (long long unsigned)j_end,
(long long unsigned)k_start, (long long unsigned)k_end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_fdata_t *b = f->b;
b->user_layout[0].i_start = i_start;
b->user_layout[0].i_end = i_end;
@@ -571,12 +566,11 @@ h5b_3d_set_view (
b->user_layout[0].k_end = k_end;
_normalize_partition(&b->user_layout[0]);
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
h5b_partition_t *user_layout;
h5b_partition_t *write_layout;
TRY (user_layout = h5_calloc (f->nprocs, sizeof (*user_layout)));
TRY (write_layout = h5_calloc (f->nprocs, sizeof (*write_layout)));
user_layout[f->myproc] = b->user_layout[0];
@@ -585,11 +579,7 @@ h5b_3d_set_view (
user_layout, 1, f->b->partition_mpi_t, f->props->comm));
_get_max_dimensions(f, user_layout);
TRY (_dissolve_ghostzones (f, user_layout, write_layout));
b->user_layout[0] = user_layout[f->myproc];
b->write_layout[0] = write_layout[f->myproc];
//b->user_layout[0] = user_layout[f->myproc];
h5_debug (
"User layout: %lld:%lld, %lld:%lld, %lld:%lld",
(long long)b->user_layout[0].i_start,
@@ -599,17 +589,25 @@ h5b_3d_set_view (
(long long)b->user_layout[0].k_start,
(long long)b->user_layout[0].k_end );
h5_debug (
"Ghost-zone layout: %lld:%lld, %lld:%lld, %lld:%lld",
(long long)b->write_layout[0].i_start,
(long long)b->write_layout[0].i_end,
(long long)b->write_layout[0].j_start,
(long long)b->write_layout[0].j_end,
(long long)b->write_layout[0].k_start,
(long long)b->write_layout[0].k_end );
if (dissolve_ghostzones) {
TRY (write_layout = h5_calloc (f->nprocs, sizeof (*write_layout)));
TRY (_dissolve_ghostzones (f, user_layout, write_layout));
b->write_layout[0] = write_layout[f->myproc];
h5_debug (
"Ghost-zone layout: %lld:%lld, %lld:%lld, %lld:%lld",
(long long)b->write_layout[0].i_start,
(long long)b->write_layout[0].i_end,
(long long)b->write_layout[0].j_start,
(long long)b->write_layout[0].j_end,
(long long)b->write_layout[0].k_start,
(long long)b->write_layout[0].k_end );
h5_free(write_layout);
} else {
b->write_layout[0] = b->user_layout[0];
}
h5_free(user_layout);
h5_free(write_layout);
#else
b->write_layout[0] = b->user_layout[0];
b->i_max = b->user_layout->i_end;
@@ -642,8 +640,7 @@ h5b_3d_get_view (
i_start, i_end,
j_start, j_end,
k_start, k_end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_partition_t *p = f->b->user_layout;
*i_start = p->i_start;
@@ -676,8 +673,7 @@ h5b_3d_get_reduced_view (
i_start, i_end,
j_start, j_end,
k_start, k_end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_partition_t *p = f->b->write_layout;
*i_start = p->i_start;
@@ -704,8 +700,7 @@ h5b_3d_set_chunk (
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( i == 0 || j == 0 || k == 0 )
{
h5_info ("Disabling chunking" );
@@ -724,21 +719,20 @@ h5b_3d_set_chunk (
h5_err_t
h5b_3d_get_chunk (
const h5_file_t fh, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *const i, /*!< OUT: size of \c i */
h5_size_t *const j, /*!< OUT: size of \c j */
h5_size_t *const k /*!< OUT: size of \c k */
char* const field_name, /*!< IN: name of dataset */
h5_size_t* const i, /*!< OUT: size of \c i */
h5_size_t* const j, /*!< OUT: size of \c j */
h5_size_t* const k /*!< OUT: size of \c k */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, i=%p, j=%p, k=%p",
f, i, j, k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5b_fdata_t *b = f->b;
TRY( h5bpriv_open_field_group ( f, field_name ) );
TRY (h5bpriv_open_field_group (f, field_name));
hid_t dataset_id;
hid_t plist_id;
@@ -762,7 +756,6 @@ h5b_3d_get_chunk (
H5_RETURN (H5_SUCCESS);
}
#ifdef PARALLEL_IO
h5_err_t
h5b_3d_set_grid (
const h5_file_t fh, /*!< IN: File handle */
@@ -777,8 +770,7 @@ h5b_3d_set_grid (
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if (i*j*k != f->nprocs) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -794,13 +786,15 @@ h5b_3d_set_grid (
f->b->j_grid = j;
f->b->i_grid = k;
#ifdef H5_HAVE_PARALLEL
int dims[3] = { k, j, i };
int period[3] = { 0, 0, 0 };
TRY( h5priv_mpi_cart_create(
f->props->comm, 3, dims, period, 0, &f->b->cart_comm) );
#else
h5_warn ("Defining a grid in serial case doesn't make much sense!");
#endif
f->b->have_grid = 1;
H5_RETURN (H5_SUCCESS);
}
@@ -816,19 +810,23 @@ h5b_3d_get_grid_coords (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, proc=%d, i=%p, j=%p, k=%p",
f, proc, i, j, k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( !f->b->have_grid )
H5_RETURN_ERROR (
H5_ERR_INVAL,
"%s",
"Grid dimensions have not been set!");
#ifdef H5_HAVE_PARALLEL
int coords[3];
TRY( h5priv_mpi_cart_coords(f->b->cart_comm, proc, 3, coords) );
*k = coords[0];
*j = coords[1];
*i = coords[2];
#else
*k = *j = *i = 1;
h5_warn ("Defining grid in serial case doesn't make much sense!");
#endif
H5_RETURN (H5_SUCCESS);
}
@@ -846,8 +844,7 @@ h5b_3d_set_dims (
(long long unsigned)i,
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( !f->b->have_grid )
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -855,11 +852,14 @@ h5b_3d_set_dims (
"Grid dimensions have not been set!");
h5_size_t dims[3] = { k, j, i };
#ifdef H5_HAVE_PARALLEL
h5_size_t check_dims[3] = { k, j, i };
TRY( h5priv_mpi_bcast(
check_dims, 3, MPI_LONG_LONG, 0, f->props->comm) );
#else
h5_size_t check_dims[3] = { 1, 1, 1 };
h5_warn ("Defining grid in serial case doesn't make much sense!");
#endif
if ( dims[0] != check_dims[0] ||
dims[1] != check_dims[1] ||
dims[2] != check_dims[2]
@@ -899,7 +899,6 @@ h5b_3d_set_dims (
H5_RETURN (H5_SUCCESS);
}
#endif
h5_err_t
h5b_3d_set_halo (
@@ -916,8 +915,7 @@ h5b_3d_set_halo (
(long long unsigned)j,
(long long unsigned)k);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
if ( !f->b->have_grid ) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
@@ -947,8 +945,7 @@ h5b_get_num_fields (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_block_group(f));
TRY (ret_value = hdf5_get_num_objs_in_group (f->b->block_gid));
@@ -964,35 +961,33 @@ h5b_has_field (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s'",
f, name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
const char* path[] = { H5BLOCK_GROUPNAME_BLOCK, name };
TRY (ret_value = h5priv_link_exists_(f->step_gid, path, 2));
TRY (ret_value = h5priv_link_exists_(f->iteration_gid, path, 2));
H5_RETURN (ret_value);
}
h5_err_t
h5b_get_field_info_by_name (
const h5_file_t fh, /*!< IN: file handle */
const char *name, /*!< IN: field name */
h5_size_t *field_rank, /*!< OUT: field rank */
h5_size_t *field_dims, /*!< OUT: field dimensions */
h5_size_t *elem_rank, /*!< OUT: element rank */
h5_int64_t *type /*!< OUT: datatype */
char* const name, /*!< IN: field name */
h5_size_t* field_rank, /*!< OUT: field rank */
h5_size_t* field_dims, /*!< OUT: field dimensions */
h5_size_t* elem_rank, /*!< OUT: element rank */
h5_int64_t* type /*!< OUT: datatype */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', "
"field_rank=%p, field_dims=%p, elem_rank=%p, type=%p",
f, name, field_rank, field_dims, elem_rank, type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
/* give it plenty of space even though we don't expect rank > 3 */
hsize_t dims[16];
TRY( h5bpriv_open_field_group(f, name) );
TRY (h5bpriv_open_field_group (f, name));
hid_t dataset_id;
hid_t dataspace_id;
@@ -1046,8 +1041,7 @@ h5b_get_field_info (
(long long unsigned)idx,
name, (long long unsigned)len_name,
field_rank, field_dims, elem_rank, type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5bpriv_open_block_group(f));
TRY (hdf5_get_objname_by_idx(
+6 -6
View File
@@ -2002,7 +2002,7 @@ distribute_octree_parmetis (
TRY (vtxdist = h5_calloc (m->f->nprocs+1, sizeof (*vtxdist)));
vtxdist[0] = 0;
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("vtxdist[%d]: %d", 0, 0);
}
#endif
@@ -2014,7 +2014,7 @@ distribute_octree_parmetis (
vtxdist[i] = vtxdist[i-1] + n;
}
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("vtxdist[%d]: %d", i, vtxdist[i]);
}
#endif
@@ -2060,7 +2060,7 @@ distribute_octree_parmetis (
}
xadj[i+1] = xadj[i] + num_neigh;
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("xadj[%d]: %d", i+1, xadj[i+1]);
}
#endif
@@ -2070,7 +2070,7 @@ distribute_octree_parmetis (
if (new_numbering[j] == neighbors[k]) {
adjncy[counter] = j;
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
h5_debug ("adjncy[%d]: %d", counter, adjncy[counter]);
}
#endif
@@ -2139,7 +2139,7 @@ distribute_octree_parmetis (
TRY (h5_free (ubvec));
#if !defined(NDEBUG)
if (h5_log_level & (1<<5) ) {
if (__h5_debug_mask & (1<<5) ) {
for (i = 0; i < num_interior_oct; i++) {
h5_debug ("part[%d]: %llu", i, (unsigned long long)part[i]);
}
@@ -2498,7 +2498,7 @@ read_chunked_elements (
#if NDEBUG == 0
if (h5_log_level & (1<<6) ) {
if (__h5_debug_mask & (1<<6) ) {
sleep (m->f->myproc*2);
for (int i = 0; i < num_interior_elems;i++) {
h5_debug ("\n"
-2
View File
@@ -23,8 +23,6 @@
#include "private/h5t_io.h"
#include "private/h5t_tags.h"
#include "private/h5_init.h"
#include "h5core/h5_model.h"
#include "private/h5t_core.h"
#include "private/h5t_store.h"
+6 -3
View File
@@ -17,7 +17,6 @@
#include "private/h5t_store.h"
#include "private/h5t_core.h"
#include "private/h5t_io.h"
#include "private/h5_init.h"
#include "private/h5_file.h"
#include "private/h5_mpi.h"
@@ -687,12 +686,15 @@ rebuild_map_elem_g2l (
h5priv_sort_idxmap (map);
H5_RETURN (H5_SUCCESS);
}
#if defined(WITH_PARALLEL_H5GRID)
/*
Rebuild mapping of global element indices to their local indices.
*/
static h5_err_t
rebuild_map_elem_g2l_partial ( // we need that to update map for the refined elems before we have the
// refined elements from the other proces
rebuild_map_elem_g2l_partial (
// we need that to update map for the refined elems before we have the
// refined elements from the other proces
h5t_mesh_t* const m
) {
H5_PRIV_FUNC_ENTER (h5_err_t, "m=%p", m);
@@ -715,6 +717,7 @@ rebuild_map_elem_g2l_partial ( // we need that to update map for the refined ele
h5priv_sort_idxmap (map);
H5_RETURN (H5_SUCCESS);
}
#endif
h5_err_t
h5t_end_store_elems (
-2
View File
@@ -21,8 +21,6 @@
#include "private/h5t_model.h"
#include "private/h5t_tags.h"
#include "private/h5_init.h"
#include <assert.h>
static h5_err_t
+82 -65
View File
@@ -76,9 +76,9 @@ h5upriv_close_file (
}
h5_err_t
h5u_read_data (
h5u_read_dataset (
const h5_file_t fh, /*!< [in] Handle to open file */
const char* name, /*!< [in] Name to associate dataset with */
char* const name, /*!< [in] Name to associate dataset with */
void* data, /*!< [out] Array of data */
const h5_types_t type
) {
@@ -86,36 +86,30 @@ h5u_read_data (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', data=%p, type=%lld",
f, name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_is_readable (f);
TRY (h5priv_normalize_dataset_name (name));
hid_t hdf5_type;
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
struct h5u_fdata *u = f->u;
hid_t dataset_id;
hid_t space_id;
hid_t memspace_id;
hsize_t ndisk, nread, nmem;
if ( f->step_gid < 0 ) {
TRY (h5_set_step ((h5_file_t)f, f->step_idx));
if ( f->iteration_gid < 0 ) {
TRY (h5_set_iteration ((h5_file_t)f, f->iteration_idx));
}
char name2[H5_DATANAME_LEN];
TRY (h5priv_normalize_dataset_name (name, name2));
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name2));
hid_t dataset_id;
TRY (dataset_id = hdf5_open_dataset_by_name (f->iteration_gid, name));
/* default spaces, if not using a view selection */
memspace_id = H5S_ALL;
hid_t memspace_id = H5S_ALL;
hid_t space_id;
TRY (space_id = hdf5_get_dataset_space (dataset_id));
/* get the number of elements on disk for the datset */
hsize_t ndisk;
TRY (ndisk = hdf5_get_npoints_of_dataspace (space_id));
if (u->diskshape != H5S_ALL) {
TRY (nread = hdf5_get_selected_npoints_of_dataspace (u->diskshape));
hsize_t nread;
if (f->u->diskshape != H5S_ALL) {
TRY (nread = hdf5_get_selected_npoints_of_dataspace (f->u->diskshape));
/* make sure the disk space selected by the view doesn't
* exceed the size of the dataset */
@@ -131,7 +125,7 @@ h5u_read_data (
"Ignoring view: dataset[%s] has fewer "
"elements on disk (%lld) than are selected "
"(%lld).",
name2, (long long)ndisk, (long long)nread );
name, (long long)ndisk, (long long)nread );
nread = ndisk;
}
} else {
@@ -140,8 +134,9 @@ h5u_read_data (
nread = ndisk;
}
if (u->memshape != H5S_ALL) {
TRY (nmem = hdf5_get_npoints_of_dataspace (u->memshape));
if (f->u->memshape != H5S_ALL) {
hid_t nmem;
TRY (nmem = hdf5_get_npoints_of_dataspace (f->u->memshape));
/* make sure the memory space selected by the view has
* enough capacity for the read */
@@ -154,7 +149,7 @@ h5u_read_data (
"Ignoring view: dataset[%s] has more "
"elements selected (%lld) than are available "
"in memory (%lld).",
name2, (long long)nread, (long long)nmem );
name, (long long)nread, (long long)nmem );
memspace_id = H5S_ALL;
}
}
@@ -177,66 +172,88 @@ h5u_read_data (
}
h5_err_t
h5u_write_data (
h5u_write (
const h5_file_t fh, /*!< IN: Handle to open file */
const char *name, /*!< IN: Name to associate array with */
const void *data, /*!< IN: Array to commit to disk */
hid_t dset_id,
hid_t type,
const void* data
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, dset_id=%lld, type=%lld, data=%p",
f, (long long)dset_id, (long long int)type, data);
TRY (h5priv_start_throttle (f));
hid_t hdf5_type;
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
TRY (hdf5_write_dataset (
dset_id,
hdf5_type,
f->u->memshape,
f->u->diskshape,
f->props->xfer_prop,
data));
TRY (h5priv_end_throttle (f));
f->empty = 0;
if (f->props->flush) {
TRY (hdf5_flush (f->iteration_gid, H5F_SCOPE_LOCAL));
}
H5_RETURN (H5_SUCCESS);
}
hid_t
h5u_open_dataset (
const h5_file_t fh, /*!< IN: Handle to open file */
char* const name, /*!< IN: Name to associate array with */
const h5_types_t type /*!< IN: Type of data */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', data=%p, type=%lld",
f, name, data, (long long int)type);
CHECK_FILEHANDLE (f);
CHECK_WRITABLE_MODE (f);
CHECK_TIMEGROUP (f);
"f=%p, name='%s', type=%lld",
f, name, (long long int)type);
check_iteration_handle_is_valid (f);
TRY (h5priv_normalize_dataset_name (name));
hid_t hdf5_type;
TRY (hdf5_type = h5priv_map_enum_to_normalized_type (type));
struct h5u_fdata *u = f->u;
hid_t dset_id;
if ( f->iteration_gid < 0 ) {
TRY (h5_set_iteration ((h5_file_t)f, f->iteration_idx));
}
char name2[H5_DATANAME_LEN];
TRY (h5priv_normalize_dataset_name (name, name2));
if ( u->shape == H5S_ALL )
if (f->u->shape == H5S_ALL )
h5_warn("The view is unset or invalid.");
/* test for existing dataset */
hid_t dset_id;
H5E_BEGIN_TRY
dset_id = H5Dopen(f->step_gid, name2, H5P_DEFAULT);
dset_id = H5Dopen(f->iteration_gid, name, H5P_DEFAULT);
H5E_END_TRY
if (dset_id > 0) {
h5_warn("Dataset %s/%s already exists",
hdf5_get_objname(f->step_gid), name2);
hdf5_get_objname (f->iteration_gid), name);
} else {
TRY (dset_id = hdf5_create_dataset (
f->step_gid,
name2,
f->iteration_gid,
name,
hdf5_type,
u->shape,
f->u->shape,
H5P_DEFAULT));
}
H5_RETURN (dset_id);
}
TRY (h5priv_start_throttle (f));
h5_info ("Writing dataset %s/%s.",
hdf5_get_objname(f->step_gid), name2);
TRY (hdf5_write_dataset (
dset_id,
hdf5_type,
u->memshape,
u->diskshape,
f->props->xfer_prop,
data));
TRY (h5priv_end_throttle (f));
if (f->props->flags & H5_FLUSH_STEP)
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
TRY (hdf5_close_dataset (dset_id));
f->empty = 0;
TRY (hdf5_flush (f->step_gid, H5F_SCOPE_LOCAL));
h5_err_t
h5u_write_dataset (
const h5_file_t fh, /*!< IN: Handle to open file */
char* const name, /*!< IN: Name to associate array with */
const void* data, /*!< IN: Array to commit to disk */
const h5_types_t type /*!< IN: Type of data */
) {
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s', data=%p, type=%lld",
(void*)fh, name, data, (long long int)type);
hid_t dset_id;
TRY (dset_id = h5u_open_dataset (fh, name, type));
TRY (h5u_write (fh, dset_id, type, data));
TRY (hdf5_close_dataset(dset_id));
H5_RETURN (H5_SUCCESS);
}
+83 -115
View File
@@ -22,21 +22,20 @@
#include <string.h>
h5_ssize_t
h5u_get_num_points (
h5u_get_num_items (
const h5_file_t fh /*!< [in] Handle to open file */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5_ssize_t nparticles;
if (h5u_has_view ((h5_file_t)f)) {
/* if a view exists, use its size as the number of particles */
TRY (nparticles = h5u_get_num_points_in_view (fh));
TRY (nparticles = h5u_get_num_items_in_view (fh));
} else {
/* otherwise, report all particles on disk in the first dataset
for this timestep */
for this iteration */
TRY (nparticles = h5u_get_totalnum_particles_by_idx (fh, 0));
}
@@ -44,13 +43,12 @@ h5u_get_num_points (
}
h5_ssize_t
h5u_get_num_points_in_view (
h5u_get_num_items_in_view (
const h5_file_t fh /*!< [in] Handle to open file */
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5_ssize_t nparticles;
if (!h5u_has_view (fh)) {
@@ -73,16 +71,26 @@ h5u_get_totalnum_particles_by_name (
H5_CORE_API_ENTER (h5_ssize_t,
"f=%p, dataset_name=%s",
f, dataset_name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5_ssize_t nparticles;
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
f->step_gid, dataset_name));
f->iteration_gid, dataset_name));
h5_debug ("Found %lld particles in dataset %s.",
(long long)nparticles, dataset_name);
H5_RETURN (nparticles);
}
/*
Query number of items in dataset in current timestep. Dataset is
given by index.
returns:
H5_NOK if dataset does not exist
H5_ERROR on error
else number of items
*/
h5_ssize_t
h5u_get_totalnum_particles_by_idx (
const h5_file_t fh, ///< [in] Handle to open file
@@ -90,13 +98,12 @@ h5u_get_totalnum_particles_by_idx (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p, idx=%lld", f, (long long)idx);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
char dataset_name[H5_DATANAME_LEN];
dataset_name[0] = '\0';
h5_err_t h5err;
TRY (h5err = hdf5_get_name_of_dataset_by_idx (
f->step_gid,
f->iteration_gid,
idx,
dataset_name,
H5_DATANAME_LEN));
@@ -104,14 +111,14 @@ h5u_get_totalnum_particles_by_idx (
H5_LEAVE (H5_NOK);
h5_ssize_t nparticles;
TRY (nparticles = hdf5_get_npoints_of_dataset_by_name (
f->step_gid, dataset_name));
f->iteration_gid, dataset_name));
h5_debug ("Found %lld particles in dataset %s.",
(long long)nparticles, dataset_name);
H5_RETURN (nparticles);
}
h5_err_t
h5u_set_num_points (
h5u_set_num_items (
const h5_file_t fh, /*!< [in] Handle to open file */
const h5_size_t nparticles, /*!< [in] Number of particles */
const h5_size_t stride /*!< [in] Stride of particles in memory */
@@ -122,21 +129,14 @@ h5u_set_num_points (
f, (long long unsigned)nparticles,
(long long unsigned)stride);
CHECK_FILEHANDLE (f);
if (f->step_gid < 0) {
TRY (h5_set_step (fh, 0));
if (f->iteration_gid < 0) {
TRY (h5_set_iteration (fh, 0));
}
CHECK_TIMEGROUP (f);
struct h5u_fdata *u = f->u;
hsize_t start;
hsize_t dmax = H5S_UNLIMITED;
if (nparticles < 0)
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid number of particles: %lld!\n",
(long long)nparticles);
#ifndef PARALLEL_IO
#ifndef H5_HAVE_PARALLEL
/*
if we are not using parallel-IO, there is enough information
to know that we can short circuit this routine. However,
@@ -152,6 +152,8 @@ h5u_set_num_points (
TRY (hdf5_close_dataspace (u->shape));
u->shape = H5S_ALL;
TRY (hdf5_close_dataspace (u->memshape));
u->memshape = H5S_ALL;
u->nparticles = (hsize_t)nparticles;
@@ -174,12 +176,12 @@ h5u_set_num_points (
NULL));
}
#ifndef PARALLEL_IO
#ifndef H5_HAVE_PARALLEL
count = u->nparticles;
TRY( u->shape = hdf5_create_dataspace (1, &count, NULL));
u->viewstart = 0;
u->viewend = nparticles - 1; // view range is *inclusive*
#else /* PARALLEL_IO */
#else /* H5_HAVE_PARALLEL */
/*
The Gameplan here is to declare the overall size of the on-disk
data structure the same way we do for the serial case. But
@@ -212,7 +214,8 @@ h5u_set_num_points (
TRY( u->shape = hdf5_create_dataspace(1, &count, NULL) );
/* declare overall data size but then will select a subset */
TRY( u->diskshape = hdf5_create_dataspace(1, &count, NULL) );
TRY (hdf5_close_dataspace (u->diskshape));
TRY (u->diskshape = hdf5_create_dataspace(1, &count, NULL));
count = nparticles;
if (count > 0) {
@@ -231,12 +234,11 @@ h5u_set_num_points (
h5_err_t
h5u_has_view (
const const h5_file_t fh
const h5_file_t fh
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
H5_RETURN (f->u->viewindexed || f->u->viewstart >= 0);
}
@@ -246,8 +248,7 @@ h5u_reset_view (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
u->viewstart = -1;
@@ -276,10 +277,7 @@ h5u_set_view (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, start=%lld, end=%lld",
f, (long long)start, (long long)end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
hsize_t total = 0;
hsize_t dmax = H5S_UNLIMITED;
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
TRY (h5u_reset_view (fh));
@@ -287,72 +285,49 @@ h5u_set_view (
if (start == -1 && end == -1) // we are already done
H5_LEAVE (H5_SUCCESS);
hssize_t total = 0;
if (f->u->shape > 0) {
TRY (total = hdf5_get_npoints_of_dataspace (f->u->shape) );
} else {
TRY (total = (hsize_t)h5u_get_totalnum_particles_by_idx (fh, 0));
// if iteration does not contain a dataset, next function
// returns -1
TRY (total = h5u_get_totalnum_particles_by_idx (fh, 0));
}
h5_debug ("Total = %lld", (long long) total);
if ((long long)total <= 0) {
if (total <= 0) {
/*
No datasets have been created yet and no views are set.
We have to leave the view empty because we don't know how
many particles there should be!
:FIXME: Should 'total == 0' be considered valid or not?
:FIXME: why not gather total size?
iteration does not contain a dataset yet!
*/
if (start < 0) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Start of selection '%lld' out of range: "
"must be >= 0",
(long long)start);
}
if (end < start) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"End of selection '%lld' out of range: "
"must be >= %lld",
(long long)end,
(long long)start);
}
#if PARALLEL_IO
/*
:FIXME: Should 'total == 0' be considered valid or not?
*/
#if H5_HAVE_PARALLEL
TRY (
h5priv_mpi_allreduce_max (
&end, &total, 1, MPI_LONG_LONG, f->props->comm)
);
#else
total = end - start;
total = end;
#endif
total++;
TRY (h5u_reset_view(fh));
TRY (hdf5_close_dataspace (u->shape));
TRY (u->shape = hdf5_create_dataspace(1, &total, NULL) );
hsize_t htotal = (hsize_t)total;
TRY (u->shape = hdf5_create_dataspace(1, &htotal, NULL) );
} else {
if (end < 0) {
end = total+end;
}
if (start < 0 || start >= total) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Start of selection '%lld' out of range: "
"must be in [0..%lld]",
(long long)start, (long long)total-1);
} else if (end < 0 || end >= total) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"End of selection '%lld' out of range: "
"must be in [0..%lld]",
(long long)end, (long long)total-1);
} else if (end+1 < start) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid selection: start=%lld > end=%lld!\n",
(long long)start, (long long)end);
end = total + end;
}
}
if ((start < 0) ||
(start >= total) ||
(end >= total) ||
(end+1 < start)) {
H5_RETURN_ERROR (
H5_ERR_INVAL,
"Invalid view: start=%lld, end=%lld, total=%lld!",
(long long)start,
(long long)end,
(long long)total);
}
/* setting up the new view */
@@ -367,8 +342,9 @@ h5u_set_view (
"This view includes %lld particles.",
(long long)u->nparticles );
hsize_t htotal = (hsize_t)total;
/* declare overall data size but then will select a subset */
TRY (u->diskshape = hdf5_create_dataspace ( 1, &total, NULL ));
TRY (u->diskshape = hdf5_create_dataspace (1, &htotal, NULL));
hsize_t hstart = (hsize_t)start;
hsize_t hstride = 1;
@@ -381,6 +357,7 @@ h5u_set_view (
NULL));
/* declare local memory datasize */
hsize_t dmax = H5S_UNLIMITED;
TRY (u->memshape = hdf5_create_dataspace (1, &hcount, &dmax));
H5_RETURN (H5_SUCCESS);
}
@@ -395,8 +372,7 @@ h5u_set_view_length (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, start=%lld, length=%lld",
f, (long long)start, (long long)length);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
TRY (h5u_reset_view (fh));
@@ -466,10 +442,9 @@ h5u_set_view_indices (
"f=%p, indices=%p, nelems=%llu",
f, indices, (long long unsigned)nelems);
CHECK_FILEHANDLE (f);
if (f->step_gid < 0) {
TRY (h5_set_step (fh, 0));
if (f->iteration_gid < 0) {
TRY (h5_set_iteration (fh, 0));
}
CHECK_TIMEGROUP (f);
hsize_t total = 0;
hsize_t dmax = H5S_UNLIMITED;
struct h5u_fdata *u = f->u;
@@ -526,8 +501,7 @@ h5u_get_view (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, start=%p, end=%p",
f, start, end);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
struct h5u_fdata *u = f->u;
if ( u->viewindexed ) {
@@ -548,7 +522,7 @@ h5u_get_view (
viewend = u->viewend;
}
else {
TRY (viewend = h5u_get_num_points (fh));
TRY (viewend = h5u_get_num_items (fh));
}
if ( start ) *start = viewstart;
@@ -563,19 +537,18 @@ h5u_set_canonical_view (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_int64_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
h5u_fdata_t* u = f->u;
TRY( h5u_reset_view (fh) );
h5_int64_t start = 0;
h5_int64_t total = 0;
TRY (total = h5u_get_num_points (fh));
TRY (total = h5u_get_num_items (fh));
u->nparticles = total / f->nprocs;
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
h5_int64_t remainder = 0;
remainder = total % f->nprocs;
start = f->myproc * u->nparticles;
@@ -588,7 +561,7 @@ h5u_set_canonical_view (
start += f->myproc;
else
start += remainder;
#endif // PARALLEL_IO
#endif // H5_HAVE_PARALLEL
h5_int64_t length = u->nparticles;
TRY (h5u_set_view_length (fh, start, length));
@@ -601,9 +574,8 @@ h5u_get_num_datasets (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_ssize_t, "f=%p", f);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_get_num_datasets (f->step_gid));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_get_num_datasets (f->iteration_gid));
H5_RETURN (ret_value);
}
@@ -616,9 +588,8 @@ h5u_has_dataset (
H5_CORE_API_ENTER (h5_err_t,
"f=%p, name='%s'",
f, name);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
TRY (ret_value = hdf5_link_exists (f->step_gid, name));
check_iteration_handle_is_valid (f);
TRY (ret_value = hdf5_link_exists (f->iteration_gid, name));
H5_RETURN (ret_value);
}
@@ -699,10 +670,9 @@ h5u_get_dataset_info_by_idx (
dataset_name,
(long long unsigned)len_dataset_name,
dataset_type, dataset_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5priv_get_dataset_info_by_idx (
f->step_gid,
f->iteration_gid,
idx,
dataset_name, len_dataset_name,
dataset_type, dataset_nelem));
@@ -748,10 +718,9 @@ h5u_get_dataset_info_by_name (
f,
dataset_name,
dataset_type, dataset_nelem);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
TRY (h5priv_get_dataset_info_by_name (
f->step_gid,
f->iteration_gid,
dataset_name,
dataset_type, dataset_nelem));
H5_RETURN (H5_SUCCESS);
@@ -788,13 +757,12 @@ h5u_get_chunk (
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_int64_t, "f=%p, name='%s', size=%p", f,name,size);
CHECK_FILEHANDLE (f);
CHECK_TIMEGROUP (f);
check_iteration_handle_is_valid (f);
hid_t dataset_id;
hid_t plist_id;
hsize_t hsize;
TRY (dataset_id = hdf5_open_dataset_by_name (f->step_gid, name) );
TRY (dataset_id = hdf5_open_dataset_by_name (f->iteration_gid, name) );
TRY (plist_id = hdf5_get_dataset_create_plist (dataset_id) );
TRY (hdf5_get_chunk_property (plist_id, 1, &hsize) );
TRY (hdf5_close_property ( plist_id) );
+2 -2
View File
@@ -99,7 +99,7 @@ h5priv_write_attrib (
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem);
(long long unsigned)attrib_nelem);
hid_t space_id;
hid_t attrib_id;
hid_t hdf5_type;
@@ -147,7 +147,7 @@ h5priv_append_attrib (
attrib_name,
(long long int)attrib_type,
attrib_value,
attrib_nelem);
(long long unsigned)attrib_nelem);
h5_err_t exists;
TRY (exists = hdf5_attribute_exists (id, attrib_name));
if (exists) {
+4 -2
View File
@@ -29,11 +29,13 @@ h5priv_fcmp (
assert (sizeof (long long) == sizeof (h5_int64_t) );
// Make [ab]Int lexicographically ordered as a twos-complement int
h5_int64_t aInt = *(h5_int64_t*)&A;
void* p = (void*)&A;
h5_int64_t aInt = *(h5_int64_t*)p;
if (aInt < 0)
aInt = 0x8000000000000000LL - aInt;
h5_int64_t bInt = *(h5_int64_t*)&B;
p = (void*)&B;
h5_int64_t bInt = *(h5_int64_t*)p;
if (bInt < 0)
bInt = 0x8000000000000000LL - bInt;
+53 -22
View File
@@ -9,38 +9,50 @@
#define H5_VFD_MPIO_POSIX 0x00000010
#define H5_VFD_MPIO_INDEPENDENT 0x00000020
#define H5_VFD_MPIO_COLLECTIVE 0x00000040
#define H5_VFD_CORE 0x00000080
#define H5_VFD_CORE_IO 0x00000080
#define H5_FLUSH_FILE 0x00001000
#define H5_FLUSH_STEP 0x00002000
#define H5_FLUSH_ITERATION 0x00002000
#define H5_FLUSH_DATASET 0x00004000
#define H5_FS_LUSTRE 0x00010000
static inline h5_err_t
check_filehandle (
const h5_file_p f
) {
if (f == NULL || f->file < 0 || f->u == NULL || f->b == NULL) {
return h5_error (
H5_ERR_BADF,
"Called with bad filehandle.");
}
return H5_SUCCESS;
static inline int
is_valid_file_handle(h5_file_p f) {
return ((f != NULL) &&
(f->file > 0) &&
(f->u != NULL) &&
(f->b != NULL));
}
#define CHECK_FILEHANDLE(f) \
TRY (check_filehandle (f));
static inline int is_writable(h5_file_p f) {
static inline int
is_writable (h5_file_p f) {
return (f->props->flags & (H5_O_RDWR | H5_O_WRONLY | H5_O_APPENDONLY));
}
#define is_readable(f) (f->props->flags & (H5_O_RDWR | H5_O_RDONLY))
#define is_readonly(f) (f->props->flags & H5_O_RDONLY)
#define is_appendonly(f) (f->props->flags & H5_O_APPENDONLY)
static inline int
is_readable (h5_file_p f) {
return (f->props->flags & (H5_O_RDWR | H5_O_RDONLY));
}
static inline int
is_readonly (h5_file_p f) {
return (f->props->flags & H5_O_RDONLY);
}
static inline int
is_appendonly (h5_file_p f) {
return (f->props->flags & H5_O_APPENDONLY);
}
#define CHECK_FILEHANDLE(f) \
TRY (is_valid_file_handle(f) ? H5_SUCCESS : h5_error ( \
H5_ERR_BADF, \
"Called with bad filehandle."));
#define CHECK_WRITABLE_MODE(f) \
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
TRY (is_writable (f) ? H5_SUCCESS : h5_error ( \
H5_ERR_INVAL, \
"Attempting to write to read-only file handle"));
@@ -50,10 +62,29 @@ static inline int is_writable(h5_file_p f) {
"Attempting to read from write-only file handle"));
#define CHECK_TIMEGROUP(f) \
TRY ((f->step_gid > 0) ? H5_SUCCESS : h5_error ( \
TRY ((f->iteration_gid > 0) ? H5_SUCCESS : h5_error ( \
H5_ERR_INVAL, \
"Time step is invalid! Have you set the time step?"));
"Iteration is invalid! Have you set the time step?"));
#define check_file_handle_is_valid(f) \
CHECK_FILEHANDLE(f); \
#define check_file_is_writable(f) \
CHECK_FILEHANDLE(f); \
CHECK_WRITABLE_MODE(f);
#define check_iteration_handle_is_valid(f) \
CHECK_FILEHANDLE(f); \
CHECK_TIMEGROUP(f);
#define check_iteration_is_readable(f) \
CHECK_FILEHANDLE(f); \
CHECK_READABLE_MODE(f); \
CHECK_TIMEGROUP(f);
#define check_iteration_is_writable(f) \
CHECK_FILEHANDLE(f); \
CHECK_WRITABLE_MODE(f); \
CHECK_TIMEGROUP(f);
#endif
+13 -3
View File
@@ -23,7 +23,7 @@
h5_err_t
h5priv_link_exists_ (
const hid_t loc_id,
const char const* path[],
const char *const path[],
size_t size
) {
H5_PRIV_FUNC_ENTER (h5_err_t,
@@ -110,10 +110,18 @@ iter_op_get_obj_type (
name);
return H5O_TYPE_UNKNOWN;
}
#if H5_VERSION_GE(1,12,0)
herr = H5Oget_info(obj_id, &objinfo, H5O_INFO_ALL);
#else
herr = H5Oget_info(obj_id, &objinfo);
#endif
}
else { // H5L_TYPE_HARD
#if H5_VERSION_GE(1,12,0)
herr = H5Oget_info_by_name(g_id, name, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT);
#else
herr = H5Oget_info_by_name(g_id, name, &objinfo, H5P_DEFAULT);
#endif
}
if (herr < 0) {
@@ -245,7 +253,8 @@ hdf5_get_name_of_group_by_idx (
HDF5_WRAPPER_ENTER (h5_err_t,
"loc_id=%lld (%s), idx=%llu, name=%p, len=%llu",
(long long int)loc_id, hdf5_get_objname (loc_id),
idx, name, (unsigned long long)len);
(long long unsigned)idx,
name, (unsigned long long)len);
op_data_t op_data;
memset (&op_data, 0, sizeof (op_data));
op_data.type = H5O_TYPE_GROUP;
@@ -304,7 +313,8 @@ hdf5_get_name_of_dataset_by_idx (
HDF5_WRAPPER_ENTER (h5_err_t,
"loc_id=%lld (%s), idx=%llu, name=%p, len=%llu",
(long long int)loc_id, hdf5_get_objname (loc_id),
idx, name, (unsigned long long)len);
(long long unsigned)idx,
name, (unsigned long long)len);
op_data_t op_data;
memset (&op_data, 0, sizeof (op_data));
op_data.type = H5O_TYPE_DATASET;
+35 -24
View File
@@ -163,12 +163,12 @@ hdf5_create_group (
h5_err_t
h5priv_link_exists_ (
const hid_t loc_id,
const char const* path[],
const char *const path[],
size_t size
);
#define h5priv_link_exists(loc_id, ...) \
(h5priv_link_exists_ (loc_id, \
(const char const*[]){__VA_ARGS__}, \
(const char *const[]){__VA_ARGS__}, \
PP_NARG(__VA_ARGS__)))
@@ -195,7 +195,7 @@ hdf5_close_group (
static inline hid_t
h5priv_create_group (
const hid_t loc_id,
const char const* group_name
const char *const group_name
) {
H5_PRIV_FUNC_ENTER (hid_t,
"loc_id=%lld, (%s), group_name=%s",
@@ -214,7 +214,7 @@ h5priv_create_group (
static inline hid_t
h5priv_open_group (
const hid_t loc_id,
const char const* group_name
const char *const group_name
) {
H5_PRIV_FUNC_ENTER (hid_t,
"loc_id=%lld, (%s), group_name=%s",
@@ -718,7 +718,7 @@ hdf5_set_dataset_extent (
"dataset_id=%lld (%s), size=%llu",
(long long int)dataset_id,
hdf5_get_objname(dataset_id),
*size);
(long long unsigned int)*size);
if (H5Dset_extent(dataset_id, size) < 0) {
H5_RETURN_ERROR (
H5_ERR_HDF5,
@@ -809,17 +809,17 @@ get_class_type_name (
const hid_t class_id
) {
const char* const map[] = {
[H5T_INTEGER] "H5T_INTEGER",
[H5T_FLOAT] "H5T_FLOAT",
[H5T_TIME] "H5T_TIME",
[H5T_STRING] "H5T_STRING",
[H5T_BITFIELD] "H5T_BITFIELD",
[H5T_OPAQUE] "H5T_OPAQUE",
[H5T_COMPOUND] "H5T_COMPOUND",
[H5T_REFERENCE] "H5T_REFERENCE",
[H5T_ENUM] "H5T_ENUM",
[H5T_VLEN] "H5T_VLEN",
[H5T_ARRAY] "H5T_ARRAY"
[H5T_INTEGER] = "H5T_INTEGER",
[H5T_FLOAT] = "H5T_FLOAT",
[H5T_TIME] = "H5T_TIME",
[H5T_STRING] = "H5T_STRING",
[H5T_BITFIELD] = "H5T_BITFIELD",
[H5T_OPAQUE] = "H5T_OPAQUE",
[H5T_COMPOUND] = "H5T_COMPOUND",
[H5T_REFERENCE] = "H5T_REFERENCE",
[H5T_ENUM] = "H5T_ENUM",
[H5T_VLEN] = "H5T_VLEN",
[H5T_ARRAY] = "H5T_ARRAY"
};
if (class_id < 0 || class_id >= H5T_NCLASSES) {
return ("[unknown]");
@@ -873,7 +873,7 @@ static inline hid_t
hdf5_create_string_type(
const hsize_t len
) {
HDF5_WRAPPER_ENTER (hid_t, "len = %llu", len);
HDF5_WRAPPER_ENTER (hid_t, "len = %llu", (long long unsigned)len);
hid_t type_id = H5Tcopy (H5T_C_S1);
if (type_id < 0)
H5_RETURN_ERROR (
@@ -1003,7 +1003,7 @@ hdf5_set_chunk_property (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"plist=%lld, rank=%d, dims[0]=%llu ...",
(long long int)plist, rank, dims[0]);
(long long int)plist, rank, (long long unsigned)dims[0]);
if (H5Pset_chunk (plist, rank, dims) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
@@ -1048,7 +1048,7 @@ hdf5_set_layout_property (
H5_RETURN (H5_SUCCESS);
}
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
static inline h5_err_t
hdf5_set_fapl_mpio_property (
hid_t fapl_id,
@@ -1146,7 +1146,8 @@ hdf5_set_btree_ik_property (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"fapl_id=%lld, btree_ik=%llu",
(long long int)fcpl_id, btree_ik);
(long long int)fcpl_id,
(long long unsigned)btree_ik);
if (H5Pset_istore_k (fcpl_id, btree_ik) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
@@ -1164,13 +1165,16 @@ hdf5_set_alignment_property (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"plist=%lld, threshold=%llu, alignment=%llu",
(long long int)plist, threshold, alignment);
(long long int)plist,
(long long unsigned)threshold,
(long long unsigned)alignment);
if (H5Pset_alignment (plist, threshold, alignment) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
"Cannot set alignment property to %llu "
"and threshold %llu",
alignment, threshold);
(long long unsigned)alignment,
(long long unsigned)threshold);
H5_RETURN (H5_SUCCESS);
}
@@ -1181,12 +1185,13 @@ hdf5_set_meta_block_size (
) {
HDF5_WRAPPER_ENTER (h5_err_t,
"fapl_id=%lld, size=%llu",
(long long int)fapl_id, size);
(long long int)fapl_id,
(long long unsigned)size);
if (H5Pset_meta_block_size (fapl_id, size) < 0)
H5_RETURN_ERROR (
H5_ERR_HDF5,
"Cannot set meta block size property to %llu",
size);
(long long unsigned)size);
H5_RETURN (H5_SUCCESS);
}
@@ -1292,9 +1297,15 @@ hdf5_close_file (
for (ssize_t i = 0; i < max_objs; i++) {
hid_t object_id = obj_id_list [i];
h5_debug ("Open object: %lld", (long long)object_id);
#if H5_VERSION_GE(1,12,0)
H5O_info_t object_info;
if (H5Oget_info (object_id, &object_info, H5O_INFO_ALL) < 0)
continue;
#else
H5O_info_t object_info;
if (H5Oget_info (object_id, &object_info) < 0)
continue;
#endif
switch (object_info.type) {
case H5O_TYPE_GROUP:
case H5O_TYPE_DATASET:
+4 -13
View File
@@ -15,24 +15,15 @@
#define UNUSED_ARGUMENT(x) (void)x
// dummy MPI calls for serial code
#if !defined (PARALLEL_IO)
typedef int MPI_Comm;
#define MPI_Init(argc, argv)
#define MPI_Initialized () (1)
#define MPI_Comm_size(comm, nprocs) {(void)comm; *nprocs = 1; }
#define MPI_Comm_rank(comm, myproc) {(void)comm; *myproc = 0; }
#define MPI_Finalize()
#define MPI_COMM_WORLD (0)
#define MPI_COMM_SELF (1)
#endif
#ifdef __cplusplus
extern "C" {
#endif
h5_err_t
h5priv_initialize (void);
h5_initialize (void);
h5_err_t
h5_finalize (void);
extern int h5_initialized;
extern h5_dta_types_t h5_dta_types;
+1 -2
View File
@@ -58,8 +58,7 @@ h5priv_read_dataset (
h5_err_t
h5priv_normalize_dataset_name (
const char *name,
char *name2
char* const name
);
#endif
+10 -4
View File
@@ -23,8 +23,8 @@
#define __FUNC_ENTER(type, mask, fmt, ...) \
type ret_value = (type)H5_ERR; \
int __log__ = h5_log_level & mask; \
if (__log__ ) { \
int __log__ = __h5_debug_mask & mask; \
if (__log__) { \
h5_call_stack_push (__func__,e_##type); \
h5_debug ("(" fmt ")", __VA_ARGS__); \
}
@@ -33,7 +33,7 @@
#define H5_CORE_API_ENTER(type, fmt, ...) \
if (!h5_initialized) { \
h5priv_initialize(); \
h5_initialize(); \
} \
__FUNC_ENTER(type, H5_DEBUG_CORE_API, fmt, __VA_ARGS__)
@@ -43,9 +43,15 @@
#define H5_PRIV_FUNC_ENTER(type, fmt, ...) \
__FUNC_ENTER(type, H5_DEBUG_PRIV_FUNC, fmt, __VA_ARGS__ )
#ifdef NDEBUG
#define H5_INLINE_FUNC_ENTER(type) \
type ret_value = (type)H5_ERR;
#else
#define H5_INLINE_FUNC_ENTER(type) \
type ret_value = (type)H5_ERR; int __log__ = 0;
#endif
#define HDF5_WRAPPER_ENTER(type, fmt, ...) \
__FUNC_ENTER(type, H5_DEBUG_HDF5, fmt, __VA_ARGS__ )
+1 -1
View File
@@ -62,7 +62,7 @@ grow_strlist (
ssize_t
h5priv_insert_strlist (
h5_strlist_t** list,
const char const* item,
const char *const item,
size_t idx
) {
H5_PRIV_API_ENTER (ssize_t,
+1 -1
View File
@@ -160,7 +160,7 @@ h5_err_t
h5priv_free_strlist (h5_strlist_t**);
ssize_t
h5priv_insert_strlist (h5_strlist_t**, const char const*, size_t);
h5priv_insert_strlist (h5_strlist_t**, const char *const, size_t);
ssize_t
h5priv_find_strlist (h5_strlist_t*, const char* const item);
+8 -7
View File
@@ -15,9 +15,9 @@
* file incompatibilities with previous versions. */
#define H5_DATANAME_LEN H5_MAX_NAME_LEN
#define H5_STEPNAME_LEN H5_MAX_NAME_LEN
#define H5_STEPNAME "Step"
#define H5_STEPWIDTH 1
#define H5_ITERATION_NAME_LEN H5_MAX_NAME_LEN
#define H5_ITERATION_NAME "Step"
#define H5_ITERATION_NUM_WIDTH 1
#define H5BLOCK_GROUPNAME_BLOCK "Block"
#define H5_BLOCKNAME_X "0"
#define H5_BLOCKNAME_Y "1"
@@ -31,7 +31,7 @@
#include "private/h5_mpi.h"
#include "private/h5_hdf5.h"
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
static inline h5_err_t
h5priv_start_throttle (
const h5_file_p f
@@ -98,7 +98,7 @@ h5priv_end_throttle (
}
H5_RETURN (H5_SUCCESS);
}
#else // PARALLEL_IO
#else // H5_HAVE_PARALLEL
static inline h5_err_t
h5priv_start_throttle (const h5_file_p f) {
UNUSED_ARGUMENT (f);
@@ -111,11 +111,11 @@ h5priv_end_throttle (const h5_file_p f) {
return H5_SUCCESS;
}
#endif // PARALLEL_IO
#endif // H5_HAVE_PARALLEL
h5_err_t
h5priv_close_step (
h5priv_close_iteration (
const h5_file_p f
);
@@ -123,6 +123,7 @@ h5priv_close_step (
Map given enumeration type to corresponding HDF5 type. We use this HDF5
type for reading and writing datasets and attributes.
*/
static inline hid_t
h5priv_map_enum_to_normalized_type (
h5_types_t type
+1 -1
View File
@@ -10,7 +10,7 @@
#ifndef __PRIVATE_H5_MPI_H
#define __PRIVATE_H5_MPI_H
#ifdef PARALLEL_IO
#ifdef H5_HAVE_PARALLEL
#include "h5core/h5_types.h"
#include "h5core/h5_err.h"
+10 -7
View File
@@ -35,12 +35,15 @@ struct h5_prop_file { // file property
h5_int64_t align; // HDF5 alignment
h5_int64_t increment; // increment for core vfd
h5_int64_t throttle;
#ifdef H5_HAVE_PARALLEL
MPI_Comm comm;
#endif
hid_t xfer_prop; // dataset transfer properties
hid_t access_prop; // file access properties
hid_t create_prop; // file create properties
char* prefix_step_name; // Prefix of step name
int width_step_idx; // pad step index with 0 up to this
char* prefix_iteration_name; // Prefix of step name
int width_iteration_idx; // pad iteration index with 0 up to this
int flush; // flush iteration after writing dataset
};
typedef struct h5_prop_file h5_prop_file_t;
typedef h5_prop_file_t* h5_prop_file_p;
@@ -64,12 +67,12 @@ struct h5_file {
/* HDF5 */
hid_t root_gid; // HDF5 group id of root
hid_t step_gid; // HDF5 group id of current step
hid_t iteration_gid; // HDF5 group id of current iteration
/* step internal data */
char* step_name; // full current step name
h5_int64_t step_idx; // current step index
int is_new_step; // :FIXME: ?
/* iteration internal data */
char* iteration_name; // full current iteration name
h5_int64_t iteration_idx; // current iteration index
int is_new_iteration;// :FIXME: ?
struct h5u_fdata *u; // pointer to unstructured data
struct h5b_fdata *b; // pointer to block data
+1 -1
View File
@@ -11,7 +11,7 @@ struct h5b_partition {
};
struct h5b_fdata {
h5_id_t step_idx;
h5_id_t iteration_idx;
h5_size_t i_max;
h5_size_t j_max;
h5_size_t k_max;
-1
View File
@@ -12,7 +12,6 @@
#include "private/h5_file.h"
#include "private/h5_types.h"
#include "private/h5_init.h"
#include "private/h5t_types.h"
#include "private/h5t_model.h"
#include "private/h5t_access.h"
-1
View File
@@ -11,7 +11,6 @@
#include "h5core/h5_syscall.h"
#include "private/h5_file.h"
#include "private/h5_init.h"
#include "private/h5t_types.h"
#include "private/h5t_model.h"
#include "private/h5t_access.h"
-2
View File
@@ -136,7 +136,6 @@ h5tpriv_traverse_tv (
unsigned int* i
) {
assert (i != NULL);
if (*i < 0) i = 0;
if (*i >= m->num_loc_vertices[m->num_loaded_levels-1]) {
return NULL;
}
@@ -166,7 +165,6 @@ h5tpriv_traverse_td (
unsigned int* i
) {
assert (i != NULL);
if (*i < 0) i = 0;
h5t_td_entry_t* entry = h5priv_htraverse (&m->adjacencies.td_hash, i);
h5_loc_idlist_t* result = NULL;
if (entry) {
+1 -1
View File
@@ -219,7 +219,7 @@ update_internal_structs (
// create index sets
#if (!defined(NDEBUG) && (h5_log_level & (1<<5)))
#if (!defined(NDEBUG) && (__h5_debug_mask & (1<<5)))
if (!m->is_chunked) {
h5t_adjacencies_t* adj = &m->adjacencies;
h5_loc_idx_t idx = 0;
+2 -3
View File
@@ -21,7 +21,6 @@
#include "private/h5t_store.h"
#include "private/h5_file.h"
#include "private/h5_init.h"
#include "private/h5t_core.h"
static struct h5t_methods tet_funcs = {
@@ -192,9 +191,9 @@ h5t_add_chunked_tetrahedral_mesh (
const h5_weight_t num_weights,
h5t_mesh_t** mesh
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh);
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", (void*)fh, name, mesh);
#ifdef WITH_PARALLEL_H5GRID
h5_file_p f = (h5_file_p)fh;
CHECK_WRITABLE_MODE (f);
h5_err_t exists;
TRY (exists = h5priv_link_exists (
+2 -3
View File
@@ -20,7 +20,6 @@
#include "private/h5t_retrieve.h"
#include "private/h5t_store.h"
#include "private/h5_init.h"
#include "private/h5t_core.h"
static struct h5t_methods tri_funcs = {
@@ -210,9 +209,9 @@ h5t_add_chunked_triangle_mesh(
const h5_weight_t num_weights,
h5t_mesh_t** mesh
) {
h5_file_p f = (h5_file_p)fh;
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", f, name, mesh);
H5_CORE_API_ENTER (h5_err_t, "f=%p, name=%s, mesh=%p", (void*)fh, name, mesh);
#ifdef WITH_PARALLEL_H5GRID
h5_file_p f = (h5_file_p)fh;
int size = -1;
TRY (h5priv_mpi_comm_size (f->props->comm, &size));
if (size != 1) {

Some files were not shown because too many files have changed in this diff Show More