2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team,
6 * check out http://www.gromacs.org for more information.
7 * Copyright (c) 2012,2013, by the GROMACS development team, led by
8 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9 * others, as listed in the AUTHORS file in the top-level source
10 * directory and at http://www.gromacs.org.
12 * GROMACS is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public License
14 * as published by the Free Software Foundation; either version 2.1
15 * of the License, or (at your option) any later version.
17 * GROMACS is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with GROMACS; if not, see
24 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * If you want to redistribute modifications to GROMACS, please
28 * consider that scientific software is very special. Version
29 * control is crucial - bugs must be traceable. We will be happy to
30 * consider code for inclusion in the official distribution, but
31 * derived work must not be called official GROMACS. Details are found
32 * in the README & COPYING files - if they are missing, get the
33 * official version at http://www.gromacs.org.
35 * To help us fund GROMACS development, we humbly ask that you cite
36 * the research papers on the package. Check out http://www.gromacs.org.
53 #include "gmx_parallel_3dfft.h"
59 int main(int argc,char *argv[])
61 int mmm[] = { 8, 10, 12, 15, 16, 18, 20, 24, 25, 27, 30, 32, 36, 40,
62 45, 48, 50, 54, 60, 64, 72, 75, 80, 81, 90, 100 };
63 int nnn[] = { 24, 32, 48, 60, 72, 84, 96 };
64 #define NNN asize(nnn)
67 int i,j,n,nit,ntot,n3,rsize;
72 static gmx_bool bReproducible = FALSE;
74 static int nitfac = 1;
76 { "-reproducible", FALSE, etBOOL, {&bReproducible},
77 "Request binary reproducible results" },
78 { "-np", FALSE, etINT, {&nnode},
80 { "-itfac", FALSE, etINT, {&nitfac},
81 "Multiply number of iterations by this" }
83 static t_filenm fnm[] = {
84 { efLOG, "-g", "fft", ffWRITE },
85 { efXVG, "-o", "fft", ffWRITE }
87 #define NFILE asize(fnm)
89 cr = init_par(&argc,&argv);
91 CopyRight(stdout,argv[0]);
92 parse_common_args(&argc,argv,
93 PCA_CAN_SET_DEFFNM | (MASTER(cr) ? 0 : PCA_QUIET),
94 NFILE,fnm,asize(pa),pa,0,NULL,0,NULL);
95 gmx_log_open(ftp2fn(efLOG,NFILE,fnm),cr,1,0,&fplog);
100 rsize = sizeof(real);
101 for(i=0; (i<NNN); i++) {
115 fprintf(stderr,"\r3D FFT (%s precision) %3d^3, niter %3d ",
116 (rsize == 8) ? "Double" : "Single",n,nit);
118 g = mk_fftgrid(n,n,n,NULL,NULL,cr,bReproducible);
124 for(j=0; (j<nit); j++) {
125 gmxfft3D(g,GMX_FFT_REAL_TO_COMPLEX,cr);
126 gmxfft3D(g,GMX_FFT_COMPLEX_TO_REAL,cr);
129 rt[i] = time(NULL)-start;
138 fprintf(stderr,"\n");
139 fp=xvgropen(ftp2fn(efXVG,NFILE,fnm),
140 "FFT timings","n^3","t (s)");
141 for(i=0; (i<NNN); i++) {
142 n3 = 2*niter[i]*nnn[i]*nnn[i]*nnn[i];
143 fprintf(fp,"%10d %10g\n",nnn[i],rt[i]/(2*niter[i]));