fix distributed ncclCommInitRank

This commit is contained in:
lucasdelimanogueira 2024-05-31 19:40:58 -03:00
parent ef9a74b257
commit 4b683a20e9
6 changed files with 5 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View file

@ -13,7 +13,7 @@ __host__ void cpu_to_cuda(Tensor* tensor, int device_id) {
cudaGetDeviceCount(&deviceCount);
if (device_id >= deviceCount) {
fprintf(stderr, "Could not send tensor to device %d, only %d devices available\n", device_id, deviceCount);
exit(1);
exit(1);
}
cudaSetDevice(device_id);

View file

@ -30,6 +30,8 @@ void init_process_group(int env_rank, int env_world_size) {
// send nccl unique id to all processes
MPI_CHECK(MPI_Bcast((void *)&nccl_id, sizeof(nccl_id), MPI_BYTE, 0, MPI_COMM_WORLD));
cudaSetDevice(rank);
// init NCCL communication group
NCCL_CHECK(ncclCommInitRank(&nccl_comm, world_size, nccl_id, rank));

View file

@ -83,7 +83,8 @@ extern "C" {
}
else {
printf("Could not send tensor to device %d", device_id);
fprintf(stderr, "Could not send tensor to device %d", device_id);
exit(1);
}
}

Binary file not shown.