Remove alloc.h and beef up cuda_utils.hpp (#82)

This commit is contained in:
Olli Saarikivi
2023-05-24 01:34:18 -07:00
committed by GitHub
parent 216373eab2
commit 457c422791
16 changed files with 129 additions and 260 deletions

View File

@@ -2,6 +2,7 @@
#include <mscclpp/fifo.hpp>
#include <mscclpp/proxy.hpp>
#include <mscclpp/epoch.hpp>
#include <mscclpp/checks.hpp>
#include <utils.h>
#ifdef MSCCLPP_USE_MPI_FOR_TESTS
@@ -392,9 +393,9 @@ int main(int argc, char* argv[])
printf("Stopping MSCCL++ proxy threads\n");
proxyService.stop();
CUDACHECK(cudaFree(data_d));
CUDACHECK(cudaFree(deviceHandles1));
CUDACHECK(cudaFree(deviceHandles2));
MSCCLPP_CUDATHROW(cudaFree(data_d));
MSCCLPP_CUDATHROW(cudaFree(deviceHandles1));
MSCCLPP_CUDATHROW(cudaFree(deviceHandles2));
#ifdef MSCCLPP_USE_MPI_FOR_TESTS
MPI_Finalize();

View File

@@ -34,7 +34,7 @@ int main(int argc, const char* argv[])
CUDACHECK(cudaSetDevice(cudaDevId));
int nelem = 1;
auto data = mscclpp::makeUniqueCuda<int>(nelem);
auto data = mscclpp::allocUniqueCuda<int>(nelem);
std::shared_ptr<mscclpp::Bootstrap> bootstrap(new mscclpp::Bootstrap(isSend, 2));
bootstrap->initialize(ipPortPair);

View File

@@ -200,7 +200,7 @@ class AllGatherTestEngine : public BaseTestEngine {
};
void AllGatherTestEngine::allocateBuffer() {
sendBuff_ = mscclpp::makeSharedCuda<int>(args_.maxBytes / sizeof(int));
sendBuff_ = mscclpp::allocSharedCuda<int>(args_.maxBytes / sizeof(int));
expectedBuff_ = std::shared_ptr<int[]>(new int[args_.maxBytes / sizeof(int)]);
}

View File

@@ -119,8 +119,8 @@ class SendRecvTestEngine : public BaseTestEngine {
};
void SendRecvTestEngine::allocateBuffer() {
std::shared_ptr<int> sendBuff = mscclpp::makeSharedCuda<int>(args_.maxBytes / sizeof(int));
std::shared_ptr<int> recvBuff = mscclpp::makeSharedCuda<int>(args_.maxBytes / sizeof(int));
std::shared_ptr<int> sendBuff = mscclpp::allocSharedCuda<int>(args_.maxBytes / sizeof(int));
std::shared_ptr<int> recvBuff = mscclpp::allocSharedCuda<int>(args_.maxBytes / sizeof(int));
devicePtrs_.push_back(sendBuff);
devicePtrs_.push_back(recvBuff);

View File

@@ -2,11 +2,11 @@
#include <mscclpp/cuda_utils.hpp>
TEST(CudaMemoryTest, Shared) {
auto p1 = mscclpp::makeSharedCuda<uint32_t>();
auto p2 = mscclpp::makeSharedCuda<int64_t>(5);
auto p1 = mscclpp::allocSharedCuda<uint32_t>();
auto p2 = mscclpp::allocSharedCuda<int64_t>(5);
}
TEST(CudaMemoryTest, Unique) {
auto p1 = mscclpp::makeUniqueCuda<uint32_t>();
auto p2 = mscclpp::makeUniqueCuda<int64_t>(5);
auto p1 = mscclpp::allocUniqueCuda<uint32_t>();
auto p2 = mscclpp::allocUniqueCuda<int64_t>(5);
}