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