DistDir
exchange.h
Go to the documentation of this file.
1 /*
2  * @file exchange.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 EXCHANGE_H
35 #define EXCHANGE_H
36 
37 #include "src/core/algorithm/map.h"
38 #include "src/setup/setting.h"
41 #ifdef CUDA
43 #endif
44 
50 struct t_exchange {
52  int count;
56  void *buffer;
59 };
60 typedef struct t_exchange t_exchange;
61 
62 typedef void (*backend_func_wait) (t_mpi_exchange*);
63 
69 struct t_wait {
74 };
75 typedef struct t_wait t_wait;
76 
78  t_mpi_exchange*, t_wait*, void*, void *, int *, int*);
79 
85 struct t_exchanger {
100 };
101 typedef struct t_exchanger t_exchanger;
102 
115  MPI_Datatype type ,
116  distdir_hardware hw);
117 
130 void exchanger_go(t_exchanger *exchanger ,
131  void *src_data ,
132  void *dst_data );
133 
150  void *src_data ,
151  void *dst_data ,
152  int *transform_src,
153  int *transform_dst);
154 
164 void delete_exchanger(t_exchanger * exchanger);
165 
166 #endif
void(* backend_func_wait)(t_mpi_exchange *)
Definition: exchange.h:62
void(* backend_func_go)(t_exchange *, t_exchange *, t_map *, t_kernels *, t_mpi_exchange *, t_wait *, void *, void *, int *, int *)
Definition: exchange.h:77
void exchanger_go_with_transform(t_exchanger *exchanger, void *src_data, void *dst_data, int *transform_src, int *transform_dst)
Arbitrary exchange given a map with transformation of memory layout.
void delete_exchanger(t_exchanger *exchanger)
Clean memory of a t_exchanger structure.
t_exchanger * new_exchanger(t_map *map, MPI_Datatype type, distdir_hardware hw)
Create a new t_exchanger structure.
void exchanger_go(t_exchanger *exchanger, void *src_data, void *dst_data)
Arbitrary exchange given a map.
distdir_hardware
Enum for supported hardware.
Definition: setting.h:42
Definition: exchange.h:50
void * buffer
buffer to store the messages
Definition: exchange.h:56
int buffer_size
total size of the exchange messages
Definition: exchange.h:54
int * buffer_idxlist
pointer to buffer_idxlist
Definition: exchange.h:58
int count
number of exchanges
Definition: exchange.h:52
Definition: exchange.h:85
t_kernels * vtable
pointer to pack and unpack functions
Definition: exchange.h:91
t_mpi_exchange * mpi_exchange
pointer to mpi_exchange struct
Definition: exchange.h:99
backend_func_go go
pointer to pack and unpack functions
Definition: exchange.h:93
t_map * map
pointer to map object
Definition: exchange.h:97
t_exchange * exch_send
pointer to t_exchange structure to store send information
Definition: exchange.h:87
t_exchange * exch_recv
pointer to t_exchange structure to store receive information
Definition: exchange.h:89
t_wait * vtable_wait
pointer to wait functions
Definition: exchange.h:95
Definition: backend_hw.h:48
Definition: map.h:79
The structure contains information about MPI backend.
Definition: backend_mpi.h:52
The structure contains pointers to waiting functions.
Definition: exchange.h:69
backend_func_wait pre_wait
pointer to backend_func_wait function to wait before the exchange
Definition: exchange.h:71
backend_func_wait post_wait
pointer to backend_func_wait function to wait after the exchange
Definition: exchange.h:73