Fix the problem that the process does not release.

This commit is contained in:
liuchuting 2022-11-29 19:49:52 +08:00
parent 5538b1ea1f
commit 6acad042d8
3 changed files with 11 additions and 1 deletions

View File

@ -278,6 +278,12 @@ std::shared_ptr<GPUProfiler> GPUProfiler::GetInstance() {
return std::dynamic_pointer_cast<GPUProfiler>(instance);
}
GPUProfiler::~GPUProfiler() {
if (subscriber_ != nullptr) {
CHECK_CUPTI_RET_WITH_ERROR(CuptiFinalize(), "CuptiFinalize");
}
}
void GPUProfiler::StepProfilingEnable(const bool enable_flag) {
MS_LOG(INFO) << "GPU Profiler enable flag:" << enable_flag;
CHECK_CUPTI_RET_WITH_ERROR(CuptiActivityFlushAll(0), "CuptiActivityFlushAll");

View File

@ -114,7 +114,7 @@ class GPU_EXPORT GPUProfiler : public Profiler {
static std::shared_ptr<GPUProfiler> GetInstance();
GPUProfiler() = default;
~GPUProfiler() { StopCUPTI(); }
~GPUProfiler();
GPUProfiler(const GPUProfiler &) = delete;
GPUProfiler &operator=(const GPUProfiler &) = delete;

View File

@ -468,6 +468,10 @@ class Profiler:
options = kwargs.get("env_enable")
self._filt_optype_names = ''
self._has_started = True
self._data_process_enable = True
self._stop_time = 0
self._is_heterogeneous = False
self._timeline_size_limit_byte = 500 * 1024 * 1024 # 500MB
self._start_time = options.get("start_time")
self._output_path = options.get('output_path')
self._profile_memory = options.get('profile_memory')