md fix gpu profiling device id issue
This commit is contained in:
parent
1e486b6f34
commit
9da6205827
|
@ -129,7 +129,9 @@ void ConfigManager::set_op_connector_size(int32_t connector_size) { op_connector
|
|||
|
||||
uint32_t ConfigManager::seed() const { return seed_; }
|
||||
|
||||
void ConfigManager::set_rank_id(int32_t rank_id) { rank_id_ = rank_id; }
|
||||
void ConfigManager::set_rank_id(int32_t rank_id) {
|
||||
if (rank_id_ == kCfgDefaultRankId) rank_id_ = rank_id;
|
||||
}
|
||||
|
||||
void ConfigManager::set_numa_enable(bool numa_enable) { numa_enable_ = numa_enable; }
|
||||
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
#include <fstream>
|
||||
#include "utils/ms_utils.h"
|
||||
#include "minddata/dataset/util/path.h"
|
||||
#ifdef ENABLE_GPUQUE
|
||||
#include "minddata/dataset/core/config_manager.h"
|
||||
#include "minddata/dataset/core/global_context.h"
|
||||
#endif
|
||||
#include "minddata/dataset/engine/perf/monitor.h"
|
||||
#include "minddata/dataset/engine/perf/device_queue_tracing.h"
|
||||
#include "minddata/dataset/engine/perf/connector_size.h"
|
||||
|
@ -59,11 +63,26 @@ Status ProfilingManager::Initialize() {
|
|||
#endif
|
||||
dir_path_ = real_path;
|
||||
|
||||
#ifdef ENABLE_GPUQUE
|
||||
std::shared_ptr<ConfigManager> cfg = GlobalContext::config_manager();
|
||||
int32_t rank_id = cfg->rank_id();
|
||||
// If DEVICE_ID is not set, default value is 0
|
||||
if (rank_id < 0) {
|
||||
device_id_ = common::GetEnv("DEVICE_ID");
|
||||
// If DEVICE_ID is not set, default value is 0
|
||||
if (device_id_.empty()) {
|
||||
device_id_ = "0";
|
||||
}
|
||||
} else {
|
||||
device_id_ = std::to_string(rank_id);
|
||||
}
|
||||
#else
|
||||
device_id_ = common::GetEnv("DEVICE_ID");
|
||||
// If DEVICE_ID is not set, default value is 0
|
||||
if (device_id_.empty()) {
|
||||
device_id_ = "0";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Register all profiling node.
|
||||
// device_queue node is used for graph mode
|
||||
|
|
Loading…
Reference in New Issue