mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-12 01:10:22 +00:00
Manage runtime environments (#452)
* Add `Env` class that manages all runtime environments. * Changed `NPKIT_DUMP_DIR` to `MSCCLPP_NPKIT_DUMP_DIR`.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <mscclpp/env.hpp>
|
||||
#include <mscclpp/executor.hpp>
|
||||
#include <mscclpp/npkit/npkit.hpp>
|
||||
#include <mscclpp/utils.hpp>
|
||||
@@ -109,7 +110,7 @@ int main(int argc, char* argv[]) {
|
||||
const std::string executionPlanPath = argv[2];
|
||||
const int niters = std::stoi(argv[3]);
|
||||
const int ngraphIters = std::stoi(argv[4]);
|
||||
const char* npkitDumpDir = getenv("NPKIT_DUMP_DIR");
|
||||
const char* npkitDumpDir = mscclpp::env()->npkitDumpDir.c_str();
|
||||
mscclpp::PacketType packetType = mscclpp::PacketType::LL16;
|
||||
if (argc == 6) {
|
||||
packetType = parsePacketType(argv[5]);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mpi.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <mscclpp/env.hpp>
|
||||
#include <mscclpp/npkit/npkit.hpp>
|
||||
|
||||
#include "mp_unit_tests.hpp"
|
||||
@@ -31,14 +32,14 @@ void ExecutorTest::SetUp() {
|
||||
bootstrap->initialize(id);
|
||||
std::shared_ptr<mscclpp::Communicator> communicator = std::make_shared<mscclpp::Communicator>(bootstrap);
|
||||
executor = std::make_shared<mscclpp::Executor>(communicator);
|
||||
npkitDumpDir = getenv("NPKIT_DUMP_DIR");
|
||||
if (npkitDumpDir != nullptr) {
|
||||
npkitDumpDir = mscclpp::env()->npkitDumpDir;
|
||||
if (npkitDumpDir != "") {
|
||||
NpKit::Init(gEnv->rank);
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutorTest::TearDown() {
|
||||
if (npkitDumpDir != nullptr) {
|
||||
if (npkitDumpDir != "") {
|
||||
NpKit::Dump(npkitDumpDir);
|
||||
NpKit::Shutdown();
|
||||
}
|
||||
|
||||
@@ -170,6 +170,6 @@ class ExecutorTest : public MultiProcessTest {
|
||||
void TearDown() override;
|
||||
|
||||
std::shared_ptr<mscclpp::Executor> executor;
|
||||
const char* npkitDumpDir;
|
||||
std::string npkitDumpDir;
|
||||
};
|
||||
#endif // MSCCLPP_MP_UNIT_TESTS_HPP_
|
||||
|
||||
Reference in New Issue
Block a user