I’ve implemented what you suggested.
The sequential file and dataset creation works as expected. The filter is not called at this stage.
I reopen the file collectively, and the the dataset like this:
H5Pset_fapl_mpio(fileAccPropList.getId() , comm, info);
H5Pset_all_coll_metadata_ops(fileAccPropList.getId() , true);
H5::H5File h5file("test.h5", H5F_ACC_RDWR, H5::FileCreatPropList::DEFAULT, fileAccPropList);
H5Pset_dxpl_mpio(xfer_plist.getId() , H5FD_MPIO_COLLECTIVE);
H5::DataSet dataset = h5file.openDataSet(dataset_name);
Unfortunately, the openDataSet calls the filter to compress data. I don’t know how to avoid this call.
A possible work-around: test for a zero-filled buffer and write a “magic number” instead of calling an expensive compression algorithm. This way, the filter is called twice, but relatively fast the first time.