Realm
A distributed, event-based tasking library
Loading...
Searching...
No Matches
channel_disk.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Los Alamos 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 LOWLEVEL_CHANNEL_DISK
19#define LOWLEVEL_CHANNEL_DISK
20
22
23namespace Realm {
24
25 class FileRequest : public Request {
26 public:
27 int fd;
28 void *mem_base; // could be source or dest
29 off_t file_off;
30 };
31 class DiskRequest : public Request {
32 public:
33 int fd;
34 void *mem_base; // could be source or dest
35 off_t disk_off;
36 };
37
38 class FileChannel;
39
40 class FileXferDes : public XferDes {
41 public:
42 FileXferDes(uintptr_t _dma_op, Channel *_channel, NodeID _launch_node,
43 XferDesID _guid, const std::vector<XferDesPortInfo> &inputs_info,
44 const std::vector<XferDesPortInfo> &outputs_info, int _priority);
45
46 ~FileXferDes() { free(file_reqs); }
47
48 long get_requests(Request **requests, long nr);
51 void flush();
52
54
55 private:
56 FileRequest *file_reqs;
57 FileMemory::OpenFileInfo *file_info;
58 };
59
60 class DiskChannel;
61
62 class DiskXferDes : public XferDes {
63 public:
64 DiskXferDes(uintptr_t _dma_op, Channel *_channel, NodeID _launch_node,
65 XferDesID _guid, const std::vector<XferDesPortInfo> &inputs_info,
66 const std::vector<XferDesPortInfo> &outputs_info, int _priority);
67
68 ~DiskXferDes() { free(disk_reqs); }
69
70 long get_requests(Request **requests, long nr);
73 void flush();
74
76
77 private:
78 int fd;
79 DiskRequest *disk_reqs;
80 // const char *buf_base;
81 };
82
83 class FileChannel : public SingleXDQChannel<FileChannel, FileXferDes> {
84 public:
87
88 // TODO: farm I/O work off to dedicated threads if needed
89 static const bool is_ordered = true;
90
91 virtual XferDes *create_xfer_des(uintptr_t dma_op, NodeID launch_node, XferDesID guid,
92 const std::vector<XferDesPortInfo> &inputs_info,
93 const std::vector<XferDesPortInfo> &outputs_info,
94 int priority, XferDesRedopInfo redop_info,
95 const void *fill_data, size_t fill_size,
96 size_t fill_total);
97
98 long submit(Request **requests, long nr);
99 };
100
101 class DiskChannel : public SingleXDQChannel<DiskChannel, DiskXferDes> {
102 public:
105
106 // TODO: farm I/O work off to dedicated threads if needed
107 static const bool is_ordered = true;
108
109 virtual XferDes *create_xfer_des(uintptr_t dma_op, NodeID launch_node, XferDesID guid,
110 const std::vector<XferDesPortInfo> &inputs_info,
111 const std::vector<XferDesPortInfo> &outputs_info,
112 int priority, XferDesRedopInfo redop_info,
113 const void *fill_data, size_t fill_size,
114 size_t fill_total);
115
116 long submit(Request **requests, long nr);
117 };
118
119}; // namespace Realm
120
121#endif /*LOWLEVEL_CHANNEL_DISK*/
Definition bgwork.h:36
Definition channel.h:713
Definition channel_disk.h:101
long submit(Request **requests, long nr)
virtual XferDes * create_xfer_des(uintptr_t dma_op, NodeID launch_node, XferDesID guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int priority, XferDesRedopInfo redop_info, const void *fill_data, size_t fill_size, size_t fill_total)
static const bool is_ordered
Definition channel_disk.h:107
DiskChannel(BackgroundWorkManager *bgwork)
Definition channel_disk.h:31
void * mem_base
Definition channel_disk.h:34
off_t disk_off
Definition channel_disk.h:35
int fd
Definition channel_disk.h:33
Definition channel_disk.h:62
~DiskXferDes()
Definition channel_disk.h:68
bool progress_xd(DiskChannel *channel, TimeLimit work_until)
void notify_request_write_done(Request *req)
void notify_request_read_done(Request *req)
long get_requests(Request **requests, long nr)
DiskXferDes(uintptr_t _dma_op, Channel *_channel, NodeID _launch_node, XferDesID _guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int _priority)
Definition channel_disk.h:83
virtual XferDes * create_xfer_des(uintptr_t dma_op, NodeID launch_node, XferDesID guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int priority, XferDesRedopInfo redop_info, const void *fill_data, size_t fill_size, size_t fill_total)
long submit(Request **requests, long nr)
static const bool is_ordered
Definition channel_disk.h:89
FileChannel(BackgroundWorkManager *bgwork)
Definition mem_impl.h:528
Definition channel_disk.h:25
int fd
Definition channel_disk.h:27
void * mem_base
Definition channel_disk.h:28
off_t file_off
Definition channel_disk.h:29
Definition channel_disk.h:40
long get_requests(Request **requests, long nr)
FileXferDes(uintptr_t _dma_op, Channel *_channel, NodeID _launch_node, XferDesID _guid, const std::vector< XferDesPortInfo > &inputs_info, const std::vector< XferDesPortInfo > &outputs_info, int _priority)
void notify_request_read_done(Request *req)
void notify_request_write_done(Request *req)
~FileXferDes()
Definition channel_disk.h:46
bool progress_xd(FileChannel *channel, TimeLimit work_until)
Definition channel.h:103
Definition channel.h:1014
Definition timers.h:129
Definition channel.h:286
Channel * channel
Definition channel.h:343
Definition activemsg.h:38
int NodeID
Definition nodeset.h:40
unsigned long long XferDesID
Definition channel.h:57
Definition channel.h:210