Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
am_mpi.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Argonne National Laboratory, Stanford University, NVIDIA Corporation
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef AM_MPI_H_INCLUDED
19#define AM_MPI_H_INCLUDED
20
21#include <cstring>
22#include <cstdlib>
23#include <mpi.h>
24#include <cstdio>
25#include <cassert>
26#include "realm/atomics.h"
27#include "realm/activemsg.h"
28
29#define AM_BUF_COUNT 128
30
31// size of posted receives (i.e. header+payload limit that can be sent
32// eagerly)
33#define AM_BUF_SIZE 4096
34
35#define CHECK_MPI(cmd) \
36 do { \
37 int ret = (cmd); \
38 if(ret != MPI_SUCCESS) { \
39 fprintf(stderr, "MPI: %s = %d\n", #cmd, ret); \
40 exit(1); \
41 } \
42 } while(0)
43
44namespace Realm {
45 namespace MPI {
46
48
49 struct AM_msg {
50 int type;
51 int msgid;
54 uintptr_t comp_ptr;
55 char stuff[1];
56 };
57
58 int AM_Init(int *p_node_this, int *p_node_size);
60 void AM_init_long_messages(MPI_Win win, void *am_base,
61 Realm::IncomingMessageManager *message_manager);
62 void AMPoll();
64 void AMSend(int tgt, int msgid, int header_size, int payload_size, const char *header,
65 const char *payload, int payload_lines, int payload_line_stride,
66 int has_dest, MPI_Aint dest, void *remote_comp);
67
68 // must be defined by caller of AMSend
70
71 } /* namespace MPI */
72} /* namespace Realm */
73
74#endif /* AM_MPI_H_INCLUDED */
Definition activemsg.h:345
Definition atomics.h:31
atomic< size_t > messages_rcvd
Definition am_mpi.h:47
atomic< size_t > messages_sent
void AMComplete(void *remote_comp)
int AM_Init(int *p_node_this, int *p_node_size)
void AM_init_long_messages(MPI_Win win, void *am_base, Realm::IncomingMessageManager *message_manager)
void AMPoll()
void AM_Finalize()
void AMPoll_cancel()
void AMSend(int tgt, int msgid, int header_size, int payload_size, const char *header, const char *payload, int payload_lines, int payload_line_stride, int has_dest, MPI_Aint dest, void *remote_comp)
Definition activemsg.h:38
Definition am_mpi.h:49
int payload_size
Definition am_mpi.h:53
uintptr_t comp_ptr
Definition am_mpi.h:54
int msgid
Definition am_mpi.h:51
int type
Definition am_mpi.h:50
int header_size
Definition am_mpi.h:52
char stuff[1]
Definition am_mpi.h:55
unsigned short msgid
Definition ucp_internal.h:2
RemoteComp * remote_comp
Definition ucp_internal.h:3