forked from mindspore-Ecosystem/mindspore
fix multiple epoch data issue
This commit is contained in:
parent
776d003412
commit
42111a8033
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue