[petsc-users] Bug in VecLoad_HDF5_DA when using single precision

Håkon Strandenes haakon at hakostra.net
Fri Feb 27 09:00:52 CST 2015


Hi,

Recently I decided to try using PETSc with single precision, and that 
resulted in a segmentation fault in my application. Digging a bit into 
this I quickly found a bug in VecLoad_HDF5_DA.c, line 858, where the 
HDF5 type 'H5T_NATIVE_DOUBLE' is hard-coded into H5Dread(), independent 
on the precision PETSc is built with. This obviously leads to a 
segmentation fault, since H5Dread() tries to fill twice as much data 
into the memory as there is allocated space for.

I think this should be handled as in VecView_MPI_HDF5_DA, where there 
are some #if defined(...) that sets a variable to pass on to the HDF5 
functions depending on the floating point type PETSc is compiled with. 
That did at least solve my segmentation fault problems.

Have a nice weekend.

Regards,
Håkon


More information about the petsc-users mailing list