2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2005
5 * David van der Spoel, Erik Lindahl, University of Groningen.
6 * Copyright (c) 2012, by the GROMACS development team, led by
7 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
8 * others, as listed in the AUTHORS file in the top-level source
9 * directory and at http://www.gromacs.org.
11 * GROMACS is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 2.1
14 * of the License, or (at your option) any later version.
16 * GROMACS is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with GROMACS; if not, see
23 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 * If you want to redistribute modifications to GROMACS, please
27 * consider that scientific software is very special. Version
28 * control is crucial - bugs must be traceable. We will be happy to
29 * consider code for inclusion in the official distribution, but
30 * derived work must not be called official GROMACS. Details are found
31 * in the README & COPYING files - if they are missing, get the
32 * official version at http://www.gromacs.org.
34 * To help us fund GROMACS development, we humbly ask that you cite
35 * the research papers on the package. Check out http://www.gromacs.org.
38 #ifndef _gmx_parallel_3dfft_h_
39 #define _gmx_parallel_3dfft_h_
42 #include "types/simple.h"
43 #include "types/commrec.h"
44 #include "gmxcomplex.h"
47 typedef struct gmx_parallel_3dfft
*
52 /*! \brief Initialize parallel MPI-based 3D-FFT.
54 * This routine performs real-to-complex and complex-to-real parallel 3D FFTs,
55 * but not complex-to-complex.
57 * The routine is optimized for small-to-medium size FFTs used for PME and
58 * PPPM algorithms, and do allocate extra workspace whenever it might improve
61 * \param pfft_setup Pointer to parallel 3dfft setup structure, previously
62 * allocated or with automatic storage.
63 * \param ngridx Global number of grid cells in the x direction. Must be
64 * divisible by the number of nodes.
65 * \param ngridy Global number of grid cells in the y direction. Must be
66 * divisible by the number of nodes.
67 * \param ngridz Global number of grid cells in the z direction.
68 * \param node2slab Node id to slab index array, can be NULL.
69 * \param slab2grid_x Slab index to grid_x array (nnodes+1), can be NULL.
70 * \param comm MPI communicator, must have been initialized.
71 * \param bReproducible Try to avoid FFT timing optimizations and other stuff
72 * that could make results differ for two runs with
73 * identical input (reproducibility for debugging).
74 * \param nthreads Run in parallel using n threads
76 * \return 0 or a standard error code.
79 gmx_parallel_3dfft_init (gmx_parallel_3dfft_t
* pfft_setup
,
82 t_complex
** complex_data
,
84 int * slab2index_major
,
85 int * slab2index_minor
,
86 gmx_bool bReproducible
,
93 /*! \brief Get direct space grid index limits
96 gmx_parallel_3dfft_real_limits(gmx_parallel_3dfft_t pfft_setup
,
102 /*! \brief Get reciprocal space grid index limits
105 gmx_parallel_3dfft_complex_limits(gmx_parallel_3dfft_t pfft_setup
,
113 gmx_parallel_3dfft_execute(gmx_parallel_3dfft_t pfft_setup
,
114 enum gmx_fft_direction dir
,
118 gmx_wallcycle_t wcycle
);
121 /*! \brief Release all data in parallel fft setup
123 * All temporary storage and FFT plans are released. The structure itself
124 * is not released, but the contents is invalid after this call.
126 * \param pfft_setup Parallel 3dfft setup.
127 * \param in_data Input data.
128 * \param out_data Output data.
129 * \param thread Thread index of the calling thread, i.e. index to the part
130 * of the data operated on last by the calling thread. This
131 * is needed to start the FFT without an OpenMP barrier.
132 * \param wcycle Wall cycle counters.
134 * \return 0 or a standard error code.
137 gmx_parallel_3dfft_destroy(gmx_parallel_3dfft_t pfft_setup
);
142 #endif /* _gmx_parallel_3dfft_h_ */