Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
gasnet1_module.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 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// GASNet-1 network module implementation for Realm
19
20// NOTE: this should work with GASNet-EX's backward-compatibility interfaces,
21// but it is not recommended - there are known performance regressions compared
22// to using an actual GASNet-1 implementation
23
24#ifndef GASNET1_MODULE_H
25#define GASNET1_MODULE_H
26
27#include "realm/network.h"
28
29namespace Realm {
30
32 protected:
34
35 public:
36 // all subclasses should define this (static) method - its responsibilities
37 // are:
38 // 1) determine if the network module should even be loaded
39 // 2) fix the command line if the spawning system hijacked it
40 static NetworkModule *create_network_module(RuntimeImpl *runtime, int *argc,
41 const char ***argv);
42
43 // Enumerates all the peers that the current node could potentially share memory with
44 virtual void get_shared_peers(NodeSet &shared_peers);
45
46 // actual parsing of the command line should wait until here if at all
47 // possible
48 virtual void parse_command_line(RuntimeImpl *runtime,
49 std::vector<std::string> &cmdline);
50
51 // "attaches" to the network, if that is meaningful - attempts to
52 // bind/register/(pick your network-specific verb) the requested memory
53 // segments with the network
54 virtual void attach(RuntimeImpl *runtime, std::vector<NetworkSegment *> &segments);
55
56 virtual void create_memories(RuntimeImpl *runtime);
57
58 // detaches from the network
59 virtual void detach(RuntimeImpl *runtime, std::vector<NetworkSegment *> &segments);
60
61 // collective communication within this network
62 virtual void barrier(void);
63 virtual void broadcast(NodeID root, const void *val_in, void *val_out, size_t bytes);
64 virtual void gather(NodeID root, const void *val_in, void *vals_out, size_t bytes);
65 virtual void allgatherv(const char *val_in, size_t bytes, std::vector<char> &vals_out,
66 std::vector<size_t> &lengths);
67
69 virtual bool custom_quiescence_check(IncomingMessageManager *message_manager,
71 virtual void quiescence_allreduce_sum(const uint64_t *local_counts,
72 uint64_t *total_counts, size_t count);
73
74 // used to create a remote proxy for a memory
75 virtual MemoryImpl *create_remote_memory(RuntimeImpl *runtime, Memory m, size_t size,
76 Memory::Kind kind,
77 const ByteArray &rdma_info);
78 virtual IBMemory *create_remote_ib_memory(RuntimeImpl *runtime, Memory m, size_t size,
79 Memory::Kind kind,
80 const ByteArray &rdma_info);
81
82 virtual ActiveMessageImpl *
83 create_active_message_impl(NodeID target, unsigned short msgid, size_t header_size,
84 size_t max_payload_size, const void *src_payload_addr,
85 size_t src_payload_lines, size_t src_payload_line_stride,
86 void *storage_base, size_t storage_size);
87
89 NodeID target, unsigned short msgid, size_t header_size, size_t max_payload_size,
90 const LocalAddress &src_payload_addr, size_t src_payload_lines,
91 size_t src_payload_line_stride, const RemoteAddress &dest_payload_addr,
92 void *storage_base, size_t storage_size);
93
95 NodeID target, unsigned short msgid, size_t header_size, size_t max_payload_size,
96 const RemoteAddress &dest_payload_addr, void *storage_base, size_t storage_size);
97
99 const NodeSet &targets, unsigned short msgid, size_t header_size,
100 size_t max_payload_size, const void *src_payload_addr, size_t src_payload_lines,
101 size_t src_payload_line_stride, void *storage_base, size_t storage_size);
102
103 virtual size_t recommended_max_payload(NodeID target, bool with_congestion,
104 size_t header_size);
105 virtual size_t recommended_max_payload(const NodeSet &targets, bool with_congestion,
106 size_t header_size);
107 virtual size_t recommended_max_payload(NodeID target,
108 const RemoteAddress &dest_payload_addr,
109 bool with_congestion, size_t header_size);
110 virtual size_t recommended_max_payload(NodeID target, const void *data,
111 size_t bytes_per_line, size_t lines,
112 size_t line_stride, bool with_congestion,
113 size_t header_size);
114 virtual size_t recommended_max_payload(const NodeSet &targets, const void *data,
115 size_t bytes_per_line, size_t lines,
116 size_t line_stride, bool with_congestion,
117 size_t header_size);
118 virtual size_t recommended_max_payload(NodeID target,
119 const LocalAddress &src_payload_addr,
120 size_t bytes_per_line, size_t lines,
121 size_t line_stride,
122 const RemoteAddress &dest_payload_addr,
123 bool with_congestion, size_t header_size);
124
125 virtual size_t max_payload_size(size_t header_size, const void *src_payload_addr);
126
127 protected:
131 };
132
133}; // namespace Realm
134
135#endif
Definition activemsg.h:221
Definition bytearray.h:53
Definition gasnet1_module.h:31
virtual size_t recommended_max_payload(NodeID target, const void *data, size_t bytes_per_line, size_t lines, size_t line_stride, bool with_congestion, size_t header_size)
virtual void detach(RuntimeImpl *runtime, std::vector< NetworkSegment * > &segments)
virtual IBMemory * create_remote_ib_memory(RuntimeImpl *runtime, Memory m, size_t size, Memory::Kind kind, const ByteArray &rdma_info)
bool active_msg_worker_bgwork
Definition gasnet1_module.h:128
virtual size_t max_payload_size(size_t header_size, const void *src_payload_addr)
virtual void gather(NodeID root, const void *val_in, void *vals_out, size_t bytes)
virtual size_t recommended_max_payload(NodeID target, bool with_congestion, size_t header_size)
virtual bool custom_quiescence_check(IncomingMessageManager *message_manager, Network::QuiescenceStatus &status)
virtual void create_memories(RuntimeImpl *runtime)
virtual void broadcast(NodeID root, const void *val_in, void *val_out, size_t bytes)
virtual void attach(RuntimeImpl *runtime, std::vector< NetworkSegment * > &segments)
static NetworkModule * create_network_module(RuntimeImpl *runtime, int *argc, const char ***argv)
virtual ActiveMessageImpl * create_active_message_impl(NodeID target, unsigned short msgid, size_t header_size, size_t max_payload_size, const void *src_payload_addr, size_t src_payload_lines, size_t src_payload_line_stride, void *storage_base, size_t storage_size)
int active_msg_worker_threads
Definition gasnet1_module.h:129
virtual ActiveMessageImpl * create_active_message_impl(const NodeSet &targets, unsigned short msgid, size_t header_size, size_t max_payload_size, const void *src_payload_addr, size_t src_payload_lines, size_t src_payload_line_stride, void *storage_base, size_t storage_size)
size_t amsg_stack_size
Definition gasnet1_module.h:130
virtual void barrier(void)
virtual void parse_command_line(RuntimeImpl *runtime, std::vector< std::string > &cmdline)
virtual size_t recommended_max_payload(const NodeSet &targets, bool with_congestion, size_t header_size)
virtual MemoryImpl * create_remote_memory(RuntimeImpl *runtime, Memory m, size_t size, Memory::Kind kind, const ByteArray &rdma_info)
virtual void sample_quiescence_state(QuiescenceState &state)
virtual void get_shared_peers(NodeSet &shared_peers)
virtual void allgatherv(const char *val_in, size_t bytes, std::vector< char > &vals_out, std::vector< size_t > &lengths)
virtual void quiescence_allreduce_sum(const uint64_t *local_counts, uint64_t *total_counts, size_t count)
virtual size_t recommended_max_payload(const NodeSet &targets, const void *data, size_t bytes_per_line, size_t lines, size_t line_stride, bool with_congestion, size_t header_size)
virtual ActiveMessageImpl * create_active_message_impl(NodeID target, unsigned short msgid, size_t header_size, size_t max_payload_size, const LocalAddress &src_payload_addr, size_t src_payload_lines, size_t src_payload_line_stride, const RemoteAddress &dest_payload_addr, void *storage_base, size_t storage_size)
size_t gasnet_mem_size
Definition gasnet1_module.h:130
virtual size_t recommended_max_payload(NodeID target, const RemoteAddress &dest_payload_addr, bool with_congestion, size_t header_size)
virtual ActiveMessageImpl * create_active_message_impl(NodeID target, unsigned short msgid, size_t header_size, size_t max_payload_size, const RemoteAddress &dest_payload_addr, void *storage_base, size_t storage_size)
virtual size_t recommended_max_payload(NodeID target, const LocalAddress &src_payload_addr, size_t bytes_per_line, size_t lines, size_t line_stride, const RemoteAddress &dest_payload_addr, bool with_congestion, size_t header_size)
Definition ib_memory.h:30
Definition activemsg.h:361
Definition mem_impl.h:50
Definition memory.h:33
Kind
Definition memory.h:59
Definition network.h:183
Definition nodeset.h:117
Definition runtime_impl.h:267
QuiescenceStatus
Definition network.h:93
Definition activemsg.h:42
int NodeID
Definition nodeset.h:40
Definition network.h:58
Definition network.h:46
unsigned short msgid
Definition ucp_internal.h:2