h5py/h5py — pull request #320 by andrewcollette (2013-06-10 19:07:10+00:00)
Title: Add support for Parallel HDF5 and versioning

This pull request adds two new, interlocking features:

1. Support for building against Parallel HDF5, and using the MPI-IO driver
2. Versioning support, to enable/disable features via Cython according to the currently installed build of HDF5.

Cython is required to change the HDF5 version or enable MPI support; if not available, the current feature set (HDF5 1.8.4 serial) will be available. `mpi4py` is additionally required when building in MPI mode.

Version autodetection uses ctypes to load the HDF5 library and check the version via `H5get_libversion`. If autodetection fails, 1.8.4 is assumed. Version can be manually specified when building via `--hdf5-version=X.Y.Z`.

To build in MPI mode:

```
python setup.py build --mpi
```

To open a file in MPI mode:

```
f = h5py.File("name.hdf5", driver="mpio")
```

Function lines in `api_functions.txt` also now permit two optional statements, `MPI`, to signal they are available only in Parallel mode, and a version number in the form `X.Y.Z`. For example, to denote a function requiring Parallel HDF5, and introduced in HDF5 1.8.9:

```
MPI 1.8.9 herr_t H5Dfrob_dataset(hid_t id, char* frob)
```

These translate to Cython "IF" blocks, which provide the Cython-time support for version switching. End users don't have to run `api_gen.py`; only Cython, and then only if they want the new features.

Not tested on Windows or Mac OS X; for Windows, MPI is not supported by the HDF Group.