forked from microsoft/mscclpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsm_channel.cc
26 lines (20 loc) · 894 Bytes
/
sm_channel.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include <mscclpp/sm_channel.hpp>
#include "api.h"
#include "debug.h"
namespace mscclpp {
MSCCLPP_API_CPP SmChannel::SmChannel(std::shared_ptr<SmDevice2DeviceSemaphore> semaphore, RegisteredMemory dst,
void* src, void* getPacketBuffer)
: semaphore_(semaphore), dst_(dst), src_(src), getPacketBuffer_(getPacketBuffer) {
if (!dst.transports().has(Transport::CudaIpc)) {
throw Error("SmChannel: dst must be registered with CudaIpc", ErrorCode::InvalidUsage);
}
}
MSCCLPP_API_CPP SmChannel::DeviceHandle SmChannel::deviceHandle() const {
return DeviceHandle{.semaphore_ = semaphore_->deviceHandle(),
.src_ = src_,
.dst_ = dst_.data(),
.getPacketBuffer_ = getPacketBuffer_};
}
} // namespace mscclpp