done_fftgrid: freeing aligned memory, was: Re: [gmx-developers] Current status FFTW-3D
Roland Schulz
schulzr at ornl.gov
Thu Sep 6 05:30:19 CEST 2007
Hi,
I found why timefft crashes. done_fftgrid frees memory which is
allocated in mk_fftgrid by gmx_alloc_aligned which can't be freed,
because of the movement of the pointer. mdrun probably doesn't crash,
only because it doesn't execute mk_fftgrid and done_fftgrid in a loop.
What is the reason for the self written gmx_allow_aligned function,
instead of using the posix routine memalign?
Roland
Roland Schulz schrieb:
> I would like to test first the FFT with the timefft test program. I did some
> changes so that it compiles (see below) - the test program was not up to date
> to the rest of the CVS. But now the test program crashes most probably
> because of a memory error. Since it is more difficult to debug someone else
> code, has someone an idea, what the problem is?
>
>
> On Friday 31 August 2007 11:10, Erik Lindahl wrote:
>
>> On Aug 31, 2007, at 4:04 PM, Roland Schulz wrote:
>>
>
>
>> It is indeed only the first dimension that is real-to-complex, but
>> since the resulting data then only contains half as many points we
>> will cut the execution time in the remaining dimensions by 50% too.
>>
> you're right
>
> [license discussion]
> ok I see
>
> Roland
>
>
> RCS file: /home/gmx/cvs/gmx/src/mdlib/timefft.c,v
> retrieving revision 1.9
> diff -u -r1.9 timefft.c
> --- timefft.c 19 Apr 2006 09:05:15 -0000 1.9
> +++ timefft.c 31 Aug 2007 19:35:40 -0000
> @@ -46,6 +46,8 @@
> #include "mdrun.h"
> #include "main.h"
> #include "statutil.h"
> +#include "fftgrid.h"
> +#include "fftw3.h"
>
> #ifdef GMX_MPI
> #include "gmx_parallel_3dfft.h"
> @@ -88,7 +90,7 @@
> parse_common_args(&argc,argv,
> PCA_CAN_SET_DEFFNM | (MASTER(cr) ? 0 : PCA_QUIET),
> NFILE,fnm,asize(pa),pa,0,NULL,0,NULL);
> - open_log(ftp2fn(efLOG,NFILE,fnm),cr);
> + open_log(ftp2fn(efLOG,NFILE,fnm),cr,FALSE);
>
> snew(niter,NNN);
> snew(ct,NNN);
> @@ -110,16 +112,16 @@
> if (MASTER(cr))
> fprintf(stderr,"\r3D FFT (%s precision) %3d^3, niter %3d ",
> (rsize == 8) ? "Double" : "Single",n,nit);
> -
> - g = mk_fftgrid(stdlog,(nnode > 1),n,n,n,bOptFFT);
> +
> + g = mk_fftgrid(n,n,n,NULL,cr);
>
> if (PAR(cr))
> start = time(NULL);
> else
> start_time();
> for(j=0; (j<nit); j++) {
> - gmxfft3D(g,FFTW_FORWARD,cr);
> - gmxfft3D(g,FFTW_BACKWARD,cr);
> + gmxfft3D(g,GMX_FFT_REAL_TO_COMPLEX,cr);
> + gmxfft3D(g,GMX_FFT_COMPLEX_TO_REAL,cr);
> }
> if (PAR(cr))
> rt[i] = time(NULL)-start;
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.
>
More information about the gromacs.org_gmx-developers
mailing list