FFTW on 64-bit platforms

Problems running VASP: crashes, internal errors, "wrong" results.


Moderators: Global Moderator, Moderator

Post Reply
Message
Author
job
Jr. Member
Jr. Member
Posts: 55
Joined: Tue Aug 16, 2005 7:44 am

FFTW on 64-bit platforms

#1 Post by job » Fri Jan 27, 2006 10:37 am

I recently tried using fftw instead of the built-in fft libraries, and this caused some crashes on Linux/amd64. Turns out that the plan variables need to be big enough for a pointer. One could compile with some "-i8" switch, but the MPI libraries we use want 32-bit integers. So the following patch provides a solution to that problem:

Code: Select all

% diff fftw3d.F.orig fftw3d.F
90c90,92
<        integer grid(3), isign, plan
---
>        integer, parameter :: pk = selected_int_kind(18)
>        integer grid(3), isign
>        integer(pk) :: plan
118c120,122
<        integer grid(3),plan
---
>        integer, parameter :: pk = selected_int_kind(18)
>        integer grid(3)
>        integer(pk) :: plan


and for the mpi version:

Code: Select all

% diff fftmpiw.F.orig fftmpiw.F
56c56,58
<       INTEGER :: planx, plany, planz
---
>       ! Integer kind for plans should be large enough for a pointer.
>       integer, parameter :: pk = selected_int_kind(18)
>       INTEGER(pk) :: planx, plany, planz
Last edited by job on Fri Jan 27, 2006 10:37 am, edited 1 time in total.

ericsun

FFTW on 64-bit platforms

#2 Post by ericsun » Thu Feb 23, 2006 1:23 am

Hi,

This works for both AMD64 and EM64T.

But, I found a slow-down of performance (5-9%) after calling FFTW,
compared with jF's FFT. This is not the case on my P4 machines without
EM64T. Is this usual?
Last edited by ericsun on Thu Feb 23, 2006 1:23 am, edited 1 time in total.

job
Jr. Member
Jr. Member
Posts: 55
Joined: Tue Aug 16, 2005 7:44 am

FFTW on 64-bit platforms

#3 Post by job » Tue Feb 28, 2006 3:34 pm

I found that compiling fftw 3 with gcc produced about 15 % faster results on the ffttest benchmark included with VASP than when using pathCC. You can still use another Fortran compiler by compiling the fftw Fortran interface with it (I use pathf90). My understanding is that this performance difference is because the sse2 optimizations in fftw are only enabled when compiling it with gcc.

Truth to be told, at least on our Opteron systems here, the difference between jF FFT and FFTW (compiled with gcc as mentioned above) is rather small when running actual calculations. For bench.Hg I measured a 2 % advantage for fftw (i.e. noise).
Last edited by job on Tue Feb 28, 2006 3:34 pm, edited 1 time in total.

ccfisch
Newbie
Newbie
Posts: 2
Joined: Wed Oct 20, 2004 4:57 am
License Nr.: 5, upgraded to paw
Location: Cambridge, MA

FFTW on 64-bit platforms

#4 Post by ccfisch » Thu Apr 10, 2008 4:28 am

hi Job,

Thanks for the post ! It would have definitely taken me some time to track this one down (I had only isolated the seg faults to the use of fftw).

To add another perspective on the FFTW discussion, I'm building vasp with gfortran on an x86_64 arch and the difference between FFTW and jF FFT is quite substantial (I suppose due to gfortran). For example, timings of the EDDAV routine are reduced by a factor of 4 with multiple test runs.
Last edited by ccfisch on Thu Apr 10, 2008 4:28 am, edited 1 time in total.

job
Jr. Member
Jr. Member
Posts: 55
Joined: Tue Aug 16, 2005 7:44 am

FFTW on 64-bit platforms

#5 Post by job » Mon May 05, 2008 7:52 am

It seems that the current vasp version (4.6.34) incorporates this fix. Although they have used the quick-and-dirty (potentially unportable) INTEGER(8) rather than selected_int_kind like my patch does.
Last edited by job on Mon May 05, 2008 7:52 am, edited 1 time in total.

Post Reply