DistDir
map.h
Go to the documentation of this file.
1 /*
2  * @file map.h
3  *
4  * @copyright Copyright (C) 2024 Enrico Degregori <enrico.degregori@gmail.com>
5  *
6  * @author Enrico Degregori <enrico.degregori@gmail.com>
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10 
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13 
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17 
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef MAP_H
35 #define MAP_H
36 
37 #include "mpi.h"
38 
40 
48  int exch_rank;
49 };
51 
57 struct t_map_exch {
59  int count;
70 };
71 typedef struct t_map_exch t_map_exch;
72 
79 struct t_map {
81  MPI_Comm comm;
86 };
87 typedef struct t_map t_map;
88 
103 t_map * new_map(t_idxlist *src_idxlist ,
104  t_idxlist *dst_idxlist ,
105  int stride ,
106  MPI_Comm comm );
107 
121  int nlevels);
122 
132 void delete_map(t_map *map);
133 
134 #endif
void delete_map(t_map *map)
Clean memory of a t_map structure.
t_map * extend_map_3d(t_map *map2d, int nlevels)
Create a new t_map structure for 3D decomposition.
t_map * new_map(t_idxlist *src_idxlist, t_idxlist *dst_idxlist, int stride, MPI_Comm comm)
Create a new t_map structure.
The structure contains information about an index list.
Definition: idxlist.h:42
The structure contains information about each exchange.
Definition: map.h:46
int exch_rank
rank to send/recv data to/from
Definition: map.h:48
The structure contains information about all the exchanges in one direction.
Definition: map.h:57
int count
number of exchanges
Definition: map.h:59
int * buffer_idxlist
idxlist to create the exchange buffer
Definition: map.h:65
int * buffer_idxlist_gpu
idxlist to create the exchange buffer
Definition: map.h:67
int * buffer_offset
offset for each exchange
Definition: map.h:69
t_map_exch_per_rank ** exch
array of pointers to t_map_exch_per_rank structure
Definition: map.h:61
int buffer_size
size of the exchange message
Definition: map.h:63
Definition: map.h:79
t_map_exch * exch_recv
pointer to t_map_exch structure to store receive information
Definition: map.h:85
MPI_Comm comm
MPI communicator containing all the processes involved in the exchange.
Definition: map.h:81
t_map_exch * exch_send
pointer to t_map_exch structure to store send information
Definition: map.h:83