changed reading hint
[gromacs/adressmacs.git] / include / transpose_mpi.h
blob39562a1011bf371f7c8e9df1c6e11b2f76e0f5cd
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Green Red Orange Magenta Azure Cyan Skyblue
29 static char *SRCID_transpose_mpi_h = "$Id$";
31 #ifndef TRANSPOSE_MPI_H
32 #define TRANSPOSE_MPI_H
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
38 #include <mpi.h> /* need access to the MPI type constants */
39 #include "fftw.h"
41 /*********************** Transpose Element Type ************************/
43 /* Here, we define the data type of the individual elements in the
44 transposed array. */
46 typedef fftw_real TRANSPOSE_EL_TYPE;
48 /* We need to set the MPI type constant corresponding to the type
49 TRANSPOSE_EL_TYPE. (MPI needs to know the data type in case it
50 has to make translations on heterogeneous networks.) Possible
51 type constants are MPI_DOUBLE, MPI_FLOAT, MPI_INT, MPI_LONG, ...
52 see your MPI manual for more. */
53 #ifdef DOUBLE
54 #define MPI_TRANSPOSE_EL_TYPE_CONSTANT MPI_DOUBLE
55 #else
56 #define MPI_TRANSPOSE_EL_TYPE_CONSTANT MPI_FLOAT
57 #endif
59 /***********************************************************************/
61 typedef struct {
62 int block_num, dest_pe, send_size, recv_size;
63 } transpose_mpi_block_dest;
65 typedef struct {
66 MPI_Comm comm;
67 int n_pes, my_pe;
69 int nx,ny,local_nx,local_ny;
71 transpose_mpi_block_dest *block_dest;
72 int num_blocks, block_size;
73 int block_size_padded;
75 int *perm_block_dest;
76 int num_perm_blocks, perm_block_size;
78 char *move;
79 int move_size;
80 } transpose_mpi_plan_struct;
82 typedef transpose_mpi_plan_struct *transpose_mpi_plan;
84 extern void transpose_mpi_get_local_size(int n, int my_pe, int n_pes,
85 int *local_n, int *local_start);
86 extern int transpose_mpi_get_local_storage_size(int nx, int ny,
87 int my_pe, int n_pes);
89 extern transpose_mpi_plan transpose_mpi_create_plan(int nx, int ny,
90 MPI_Comm comm);
91 extern void transpose_mpi_destroy_plan(transpose_mpi_plan p);
93 extern void transpose_mpi(transpose_mpi_plan p,
94 TRANSPOSE_EL_TYPE *local_data, int el_size);
96 #ifdef __cplusplus
97 } /* extern "C" */
98 #endif /* __cplusplus */
100 #endif /* TRANSPOSE_MPI_H */