From 3b3566909df3cb2299d94087321aeca92afc5d39 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Wed, 23 May 2018 15:54:14 +0200 Subject: [PATCH] hdf5: first stab at hdf5-1.10 support This CL is a first step towards supporting new features and APIs of HDF5 v1.10. Right now, anecdotal evidence shows that HDF5 v1.8 is still massively deployed so support for 1.10 has to be opt-in, by way of an optional build tag aptly named "hdf5_v1.10" Updates gonum/hdf5#16. --- .travis.yml | 9 ++++++--- README.md | 8 ++++++-- h5f_v1.10.go | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 h5f_v1.10.go diff --git a/.travis.yml b/.travis.yml index 3ddd06a..298a557 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,9 @@ addons: env: global: - GODEBUG=cgocheck=0 + - TAGS="hdf5_v1.8" + ## FIXME: add hdf5_v1.10 when trusty->bionic + ## - TAGS="hdf5_v1.8 hdf5_v1.10" notifications: email: @@ -31,7 +34,7 @@ notifications: on_failure: always script: - - go get -d -t -v ./... - - go install -v ./... - - go test -v ./... + - go get -d -t -v -tags="$TAGS" ./... + - go install -v -tags="$TAGS" ./... + - go test -v -tags="$TAGS" ./... diff --git a/README.md b/README.md index ff7150b..acbe2e9 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,15 @@ Naive ``cgo`` bindings for the ``C-API`` of ``hdf5``. - Writing/reading an ``hdf5`` with compound data: [cmd/test-go-cpxcmpd/main.go](https://github.com/gonum/hdf5/blob/master/cmd/test-go-cpxcmpd/main.go) -## Note +## Notes - *Only* version *1.8.x* of ``HDF5`` is supported. - In order to use ``HDF5`` functions in more than one goroutine simultaneously, you must build the HDF5 library with threading support. Many binary distributions (RHEL/centos/Fedora packages, etc.) do not have this enabled. Therefore, you must build HDF5 yourself on these systems. - +- By default, `gonum/hdf5` is assuming to be compiled against `hdf5-v1.8.x`. + If you want to take advantage of the new features of `hdf5-v1.10.x`, please build it with the `hdf5_v1.10` build tag: + ``` + $> go install -tags="hdf5_v1.10" ./... + ``` ## Known problems diff --git a/h5f_v1.10.go b/h5f_v1.10.go new file mode 100644 index 0000000..f03262b --- /dev/null +++ b/h5f_v1.10.go @@ -0,0 +1,15 @@ +// Copyright ©2018 The gonum Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//+build hdf5_v1.10 + +package hdf5 + +// #include "hdf5.h" +import "C" + +// StartSWMRWrite enables SWMR writing mode for this file. +func (f *File) StartSWMRWrite() error { + return h5err(C.H5Fstart_swmr_write(f.id)) +}