AdH Kraken
0.0.0
Next generation Adaptive Hydraulics
Loading...
Searching...
No Matches
smpi.h
1
#ifndef H_SMPI_
2
#define H_SMPI_
3
33
typedef
struct
{
34
int
size;
/* the size of the buffer - in bytes */
35
int
nitem;
/* the number of items in the buffer */
36
int
type;
/* the type of buffer */
37
int
sd;
/* the processor the message is being send to */
38
int
pos;
/* current position in the buffer */
39
void
*buffer;
/* the buffer */
40
}
MESSG_BUFFER
;
/* message buffer */
41
42
//************************************************************//
43
//************************************************************//
44
45
typedef
struct
{
46
int
size;
/* the size of the key */
47
int
*key;
/* the key */
48
}
MESSG_KEY
;
/* message key */
49
50
//************************************************************//
51
//************************************************************//
52
53
typedef
struct
{
54
int
rnode;
/* the relative node number - local node number on owning processor */
55
int
sd;
/* the owning processor */
56
int
global_num;
/* global node number */
57
}
GLOBAL_NODE
;
/* the global node number */
58
59
/***********************************************************/
60
/* struct methods ---------------------------------------- */
61
62
/* Message Passing Data */
63
typedef
struct
{
64
int
npes;
/* number of processors */
65
int
myid;
/* local processor identification # */
66
#ifdef _MESSG
67
double
msg_starttime;
/* the start time of the model */
68
time_t msg_timestart;
/* the start time of the model */
69
MESSG_BUFFER
*send_msg;
/* the send message buffers */
70
MESSG_BUFFER
*recv_msg;
/* the receive message buffers */
71
MESSG_BUFFER
*send_edge_msg;
/* send buffer for the edge messages in adaption */
72
MESSG_BUFFER
*recv_edge_msg;
/* receive buffer for the edge messages in adaption */
73
MESSG_KEY
*send_key;
/* the key to load the send message */
74
MESSG_KEY
*send_key_surf;
/* the key to load the send message */
75
int
*recv_init;
/* the beginning position to unload the message */
76
int
*recv_init_surf;
/* the beginning position to unload the message */
77
int
*nsend;
/* the number of items to send */
78
int
*nrecv;
/* the number of items to receive */
79
int
*nsend_surf;
/* the number of items to send */
80
int
*nrecv_surf;
/* the number of items to receive */
81
int
*nsend_edge;
/* the number of edges to send to the given pe */
82
int
*nrecv_edge;
/* the number of edges to receive from the given pe */
83
EDGE_LIST_ITEM
***send_edge_key;
/* the key for the edges being sent to the given pe
84
NOTE: the key is actually a pointer into the hash table
85
for the given edge */
86
EDGE_LIST_ITEM
***recv_edge_key;
/* the key for the edges being received from the given pe
87
NOTE: the key is actually a pointer into the hash table
88
for the given edge */
89
int
nmsg_counter;
/* the number of outstanding messages */
90
int
nmsg_status;
/* the number of status structures allocated */
91
int
nmsg_request;
/* the number of request structures allocated */
92
int
max_nmsg_status;
/* the number of status structures allocated */
93
int
max_nmsg_request;
/* the number of request structures allocated */
94
95
MPI_Comm ADH_COMM;
/* Alias for actual communicator used */
96
97
//Mark adding this, may need to go into its own structure
98
//all neighborhood communicators
99
MPI_Comm ADH_NEIGH;
100
MESSG_BUFFER
buffer_send_neigh;
101
MESSG_BUFFER
buffer_recv_neigh;
102
int
indegree;
//number of PEs in neighborhood we will recieve from
103
int
*sources;
//array [indegree] of the PEs that are sources (NEEDS TO BE ORDERED!!!)
104
int
*source_weights;
// array [indegree] of the PEs that are the number of data to recieve from each PE
105
int
*source_displs;
// array [indegree] of the indices to read in the buffer from each PE
106
int
recv_ind;
//since contiguous just need first adress
107
int
nrecv_neigh;
108
//the source_indices are just nodes my_nnodes:nnodes for nodal variables
109
110
int
outdegree;
//number of PEs in neighborhood we will send to
111
int
*dest;
// array [outdegree] of the PEs that are destinations (local node ghosted on other PE)
112
int
*dest_weights;
// array[outdegree] of the number of indices per neighbor PE it is sending to
113
// will double as the sendcounts argument
114
int
nsend_neigh;
115
int
*dest_displs;
// array of [outdegree] that we will send to each Neighboring PE
116
// info is redundant with dest_weights but needed for MPI Calls
117
int
*dest_indices;
// array of (sum dest_weights) OR (dest_displs[outdegree-1]) that will be
118
// used to extract data from a data source and pack into buffer
119
120
121
MPI_Status *msg_status;
/* return flag for MPI receives */
122
MPI_Request *msg_request;
/* request handle for asynchronous communication */
123
124
int
*partition_info;
/* partition number for each node */
125
int
*surface_partition_info;
/* 3d surface partition info */
126
int
partition_flag;
/* flags if the grid has been previously partitioned */
127
#endif
128
}
SMPI
;
129
130
#endif
131
132
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
133
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
134
void
smpi_init(
SMPI
*smpi
135
#ifdef _MESSG
136
, MPI_Comm input_comm
137
#endif
138
);
139
void
smpi_free(
SMPI
*smpi);
140
void
smpi_defaults(
SMPI
*smpi);
141
void
smpi_realloc(
SMPI
*smpi
142
#ifdef _MESSG
143
, MPI_Comm input_comm
144
#endif
145
);
146
147
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
148
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
EDGE_LIST_ITEM
Definition:
slist_items.h:52
GLOBAL_NODE
Definition:
smpi.h:53
MESSG_BUFFER
Definition:
smpi.h:33
MESSG_KEY
Definition:
smpi.h:45
SMPI
Definition:
smpi.h:63
structs
smpi
smpi.h
Generated on Thu Apr 3 2025 22:45:55 for AdH Kraken by
1.9.5