提交 37bae5bf 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!5130 fix multiple epoch data issue for gpu profiler

Merge pull request !5130 from 治愈系潇洒哥/master
......@@ -60,8 +60,8 @@ namespace gpu {
std::shared_ptr<GPUProfiler> GPUProfiler::profiler_inst_ = nullptr;
int32_t GetThreadID() {
int32_t thread_id = 0;
thread_id = static_cast<int32_t>(pthread_self());
uint32_t thread_id = 0;
thread_id = static_cast<uint32_t>(pthread_self());
return thread_id;
}
......@@ -475,6 +475,7 @@ void GPUProfiler::Stop() {
StopCUPTI();
OpsParser();
SaveProfileData();
ClearInst();
}
void GPUProfiler::SaveProfileData() {
......@@ -486,9 +487,19 @@ void GPUProfiler::SaveProfileData() {
dataSaver.ParseEvent(events_);
dataSaver.WriteFile(profile_data_path_);
}
}
void GPUProfiler::ClearInst() {
op_info_map_.clear();
op_name_map_.clear();
events_.clear();
activities_enable_.clear();
enable_flag_ = false;
sync_enable_flag_ = true;
cupti_callback_events_count_ = 0l;
cupti_callback_events_drop_count_ = 0l;
cupti_activity_events_count_ = 0l;
cupti_activity_events_drop_count_ = 0l;
}
void CUPTIAPI ActivityAllocBuffer(uint8_t **buffer, size_t *size, size_t *maxNumRecords) {
......
......@@ -75,7 +75,7 @@ struct Event {
uint32_t device_id;
uint32_t correlation_id;
uint32_t thread_id;
int64_t context_id;
uint32_t context_id;
uint32_t stream_id;
CUpti_CallbackId cb_id;
union {
......@@ -131,7 +131,7 @@ class GPUProfiler {
GPUProfiler() = default;
void OpsParser();
void EventLog(const Event &event);
void ClearInst();
void HandleActivityRecord(CUpti_Activity *record);
void AddEvent(Event &&event);
void SetRunTimeData(const std::string &op_name, void *stream);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册