mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-04 05:31:27 +00:00
Renaming channels (#436)
Renamed `ProxyChannel` to `PortChannel` and `SmChannel` to `MemoryChannel`
This commit is contained in:
@@ -9,8 +9,8 @@ This tutorial section provides a step-by-step guide to help you get started with
|
||||
:hidden:
|
||||
|
||||
initialization
|
||||
proxy-channel
|
||||
sm-channel
|
||||
port-channel
|
||||
memory-channel
|
||||
packet-api
|
||||
customized-proxy-service
|
||||
python-api
|
||||
|
||||
@@ -13,7 +13,7 @@ We will setup a mesh topology with eight GPUs. Each GPU will be connected to its
|
||||
```cpp
|
||||
#include <mscclpp/core.hpp>
|
||||
#include <mscclpp/gpu_utils.hpp>
|
||||
#include <mscclpp/proxy_channel.hpp>
|
||||
#include <mscclpp/port_channel.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -21,7 +21,7 @@ We will setup a mesh topology with eight GPUs. Each GPU will be connected to its
|
||||
|
||||
template <class T>
|
||||
using DeviceHandle = mscclpp::DeviceHandle<T>;
|
||||
__constant__ DeviceHandle<mscclpp::ProxyChannel> constProxyChans[8];
|
||||
__constant__ DeviceHandle<mscclpp::PortChannel> constPortChans[8];
|
||||
|
||||
void setupMeshTopology(int rank, int worldsize, void* data, size_t dataSize) {
|
||||
std::string ip_port = "10.0.0.4:50000";
|
||||
@@ -55,17 +55,17 @@ void setupMeshTopology(int rank, int worldsize, void* data, size_t dataSize) {
|
||||
|
||||
comm.setup();
|
||||
|
||||
std::vector<DeviceHandle<mscclpp::ProxyChannel>> proxyChannels;
|
||||
std::vector<DeviceHandle<mscclpp::PortChannel>> portChannels;
|
||||
for (size_t i = 0; i < semaphoreIds.size(); ++i) {
|
||||
proxyChannels.push_back(mscclpp::deviceHandle(mscclpp::ProxyChannel(
|
||||
proxyService.proxyChannel(semaphoreIds[i]), proxyService.addMemory(remoteMemories[i].get()),
|
||||
portChannels.push_back(mscclpp::deviceHandle(mscclpp::PortChannel(
|
||||
proxyService.portChannel(semaphoreIds[i]), proxyService.addMemory(remoteMemories[i].get()),
|
||||
proxyService.addMemory(localMemories[i]))));
|
||||
}
|
||||
|
||||
if (proxyChannels.size() > sizeof(constProxyChans) / sizeof(DeviceHandle<mscclpp::ProxyChannel>)) {
|
||||
if (portChannels.size() > sizeof(constPortChans) / sizeof(DeviceHandle<mscclpp::PortChannel>)) {
|
||||
std::runtime_error("unexpected error");
|
||||
}
|
||||
CUDACHECK(cudaMemcpyToSymbol(constProxyChans, proxyChannels.data(),
|
||||
sizeof(DeviceHandle<mscclpp::ProxyChannel>) * proxyChannels.size()));
|
||||
CUDACHECK(cudaMemcpyToSymbol(constPortChans, portChannels.data(),
|
||||
sizeof(DeviceHandle<mscclpp::PortChannel>) * portChannels.size()));
|
||||
}
|
||||
```
|
||||
|
||||
3
docs/getting-started/tutorials/memory-channel.md
Normal file
3
docs/getting-started/tutorials/memory-channel.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Using MemoryChannel for Intra-Node Communication
|
||||
|
||||
TBU
|
||||
3
docs/getting-started/tutorials/port-channel.md
Normal file
3
docs/getting-started/tutorials/port-channel.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Offload commnunication to CPU with PortChannel
|
||||
|
||||
TBU
|
||||
@@ -1,3 +0,0 @@
|
||||
# Offload commnunication to CPU with ProxyChannel
|
||||
|
||||
TBU
|
||||
@@ -35,7 +35,7 @@ if __name__ == "__main__":
|
||||
nelems = 1024
|
||||
memory = GpuBuffer(nelem, dtype=cp.int32)
|
||||
proxy_service = ProxyService()
|
||||
simple_channels = group.make_proxy_channels(proxy_service, memory, connections)
|
||||
simple_channels = group.make_port_channels(proxy_service, memory, connections)
|
||||
proxy_service.start_proxy()
|
||||
mscclpp_group.barrier()
|
||||
launch_kernel(mscclpp_group.my_rank, mscclpp_group.nranks, simple_channels, memory)
|
||||
@@ -48,7 +48,7 @@ We provide some Python utils to help you launch kernel via python. Here is a exa
|
||||
```python
|
||||
from mscclpp.utils import KernelBuilder, pack
|
||||
|
||||
def launch_kernel(my_rank: int, nranks: int, simple_channels: List[ProxyChannel], memory: cp.ndarray):
|
||||
def launch_kernel(my_rank: int, nranks: int, simple_channels: List[PortChannel], memory: cp.ndarray):
|
||||
file_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
kernel = KernelBuilder(file="test.cu", kernel_name="test", file_dir=file_dir).get_compiled_kernel()
|
||||
params = b""
|
||||
@@ -74,11 +74,11 @@ def launch_kernel(my_rank: int, nranks: int, simple_channels: List[ProxyChannel]
|
||||
The test kernel is defined in `test.cu` as follows:
|
||||
```cuda
|
||||
#include <mscclpp/packet_device.hpp>
|
||||
#include <mscclpp/proxy_channel_device.hpp>
|
||||
#include <mscclpp/port_channel_device.hpp>
|
||||
|
||||
// be careful about using channels[my_rank] as it is inavlie and it is there just for simplicity of indexing
|
||||
extern "C" __global__ void __launch_bounds__(1024, 1)
|
||||
proxy_channel(mscclpp::ProxyChannelDeviceHandle* channels, int my_rank, int nranks,
|
||||
port_channel(mscclpp::PortChannelDeviceHandle* channels, int my_rank, int nranks,
|
||||
int num_elements) {
|
||||
int tid = threadIdx.x;
|
||||
int nthreads = blockDim.x;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# Using SmChannel for Intra-Node Communication
|
||||
|
||||
TBU
|
||||
Reference in New Issue
Block a user