[CP2K:4012] Segfault on ia32/MPI in H2O-hfx-1 testcase

Michael Banck mba... at debian.org
Thu Sep 6 21:09:20 UTC 2012


On Thu, Sep 06, 2012 at 09:47:44PM +0100, Iain Bethune wrote:
> > Has this been investigated and rejected in the past and/or would this be
> > a reasonable and welcome thing to send patches for?
> CP2K's FFTW3 interface does re-use plans on new arrays, which is
> likely the cause of this error.  

Right, as I wrote, I guess this is in order to get reasonable

> At the time I wrote the code we did not do an ISO_C_BINDING call to
> fftw_malloc for the following reasons:
> 1) Several important HPC compilers still did not support ISO_C_BINDING 
> 2) On x86_64 platforms with gcc all arrays are aligned to 16-byte
> boundaries anyway
> 3) For the small number of 32-bit platforms still in use we considered
> it not worth the effort since the FFTW_ARRAYS_ALIGNED flag can be set 

I mostly agree, things are fine on 64bit and that's what mostly matters
in practise.  It would be nice being able to easily tell at compile time
that the FFTW_UNALIGNED flag should be passed to FFTW3, though.

This would be a good candidate for some autoconf check if CP2K used
autotools ;)

> What I would suggest is that you add -malign-double to FCFLAGS in your
> arch file, which should force the compiler to align the arrays
> correctly in every case, and thus solve the problem without any
> further code changes.

I tried that, but it resulted in more breakage (it messes up Fortran
formats e.g., see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31696) and
resulted in a segfault in "__cp_log_handling_MOD_cp_int_to_string at
cp_log_handling.f90:882" while running "cp2k --xml".  As I understand
it, using -malign-double does not change glibc's malloc behaviour in any
way, but only the stack alignment.



More information about the CP2K-user mailing list