mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-13 01:36:10 +00:00
- Add nlohmann::ordered_json metrics field to TestResult struct - Add nlohmann/json.hpp include to test/framework.hpp - Link test_framework with nlohmann_json::nlohmann_json - Replace PerfTestResult with TestResult in test/perf/framework.cc - Move perf utility functions to utils namespace for consistency - Remove duplicate PerfTestResult struct definition This consolidates the two similar structs into one, reducing code duplication while maintaining all necessary fields for both unit tests (passed/failure_message) and performance tests (metrics). Verified build succeeds with Docker: docker run --rm -v $(pwd):/workspace -w /workspace \ ghcr.io/microsoft/mscclpp/mscclpp:base-dev-cuda12.4 bash -c \ "cd /workspace/build && make -j4 fifo_test" Co-authored-by: chhwang <8018170+chhwang@users.noreply.github.com>
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT license.
|
|
|
|
#include <mscclpp/core.hpp>
|
|
|
|
#include "../framework.hpp"
|
|
|
|
class LocalCommunicatorTest : public ::mscclpp::test::TestCase {
|
|
protected:
|
|
void SetUp() override {
|
|
bootstrap = std::make_shared<mscclpp::TcpBootstrap>(0, 1);
|
|
bootstrap->initialize(bootstrap->createUniqueId());
|
|
comm = std::make_shared<mscclpp::Communicator>(bootstrap);
|
|
}
|
|
|
|
std::shared_ptr<mscclpp::TcpBootstrap> bootstrap;
|
|
std::shared_ptr<mscclpp::Communicator> comm;
|
|
};
|
|
|
|
TEST_F(LocalCommunicatorTest, RegisterMemory) {
|
|
int dummy[42];
|
|
auto memory = comm->registerMemory(&dummy, sizeof(dummy), mscclpp::NoTransports);
|
|
EXPECT_EQ(memory.data(), &dummy);
|
|
EXPECT_EQ(memory.size(), sizeof(dummy));
|
|
EXPECT_EQ(memory.transports(), mscclpp::NoTransports);
|
|
}
|
|
|
|
TEST_F(LocalCommunicatorTest, SendMemoryToSelf) {
|
|
int dummy[42];
|
|
auto memory = comm->registerMemory(&dummy, sizeof(dummy), mscclpp::NoTransports);
|
|
comm->sendMemory(memory, 0);
|
|
auto memoryFuture = comm->recvMemory(0);
|
|
auto sameMemory = memoryFuture.get();
|
|
EXPECT_EQ(sameMemory.data(), memory.data());
|
|
EXPECT_EQ(sameMemory.size(), memory.size());
|
|
EXPECT_EQ(sameMemory.transports(), memory.transports());
|
|
}
|