3 * This source code is part of
7 * GROningen MAchine for Chemical Simulations
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
33 * GROwing Monsters And Cloning Shrimps
50 #include "gmx_parallel_3dfft.h"
56 int main(int argc,char *argv[])
58 int mmm[] = { 8, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36, 40,
59 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 100 };
60 int nnn[] = { 24, 32, 48, 60, 72, 84, 96 };
61 #define NNN asize(nnn)
64 int i,j,n,nit,ntot,n3,rsize;
69 static gmx_bool bReproducible = FALSE;
71 static int nitfac = 1;
73 { "-reproducible", FALSE, etBOOL, {&bReproducible},
74 "Request binary reproducible results" },
75 { "-np", FALSE, etINT, {&nnode},
77 { "-itfac", FALSE, etINT, {&nitfac},
78 "Multiply number of iterations by this" }
80 static t_filenm fnm[] = {
81 { efLOG, "-g", "fft", ffWRITE },
82 { efXVG, "-o", "fft", ffWRITE }
84 #define NFILE asize(fnm)
86 cr = init_par(&argc,&argv);
88 CopyRight(stdout,argv[0]);
89 parse_common_args(&argc,argv,
90 PCA_CAN_SET_DEFFNM | (MASTER(cr) ? 0 : PCA_QUIET),
91 NFILE,fnm,asize(pa),pa,0,NULL,0,NULL);
92 gmx_log_open(ftp2fn(efLOG,NFILE,fnm),cr,1,0,&fplog);
98 for(i=0; (i<NNN); i++) {
112 fprintf(stderr,"\r3D FFT (%s precision) %3d^3, niter %3d ",
113 (rsize == 8) ? "Double" : "Single",n,nit);
115 g = mk_fftgrid(n,n,n,NULL,NULL,cr,bReproducible);
121 for(j=0; (j<nit); j++) {
122 gmxfft3D(g,GMX_FFT_REAL_TO_COMPLEX,cr);
123 gmxfft3D(g,GMX_FFT_COMPLEX_TO_REAL,cr);
126 rt[i] = time(NULL)-start;
135 fprintf(stderr,"\n");
136 fp=xvgropen(ftp2fn(efXVG,NFILE,fnm),
137 "FFT timings","n^3","t (s)");
138 for(i=0; (i<NNN); i++) {
139 n3 = 2*niter[i]*nnn[i]*nnn[i]*nnn[i];
140 fprintf(fp,"%10d %10g\n",nnn[i],rt[i]/(2*niter[i]));