mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-11 17:00:22 +00:00
Remove alloc.h and beef up cuda_utils.hpp (#82)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)]);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user