Skip to content

Commit

Permalink
[CustomDevice] Fix errors during event release (PaddlePaddle#58059)
Browse files Browse the repository at this point in the history
* [CustomDevice] Fix errors during event release

* fix custom_tracer
  • Loading branch information
ronny1996 authored and jiahy0825 committed Oct 26, 2023
1 parent 59c6d1d commit 3f6915c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions paddle/fluid/platform/profiler/custom_device/custom_tracer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ namespace platform {

CustomTracer::CustomTracer(const std::string& dev_type) : dev_type_(dev_type) {
#ifdef PADDLE_WITH_CUSTOM_DEVICE
auto selected_devices = phi::DeviceManager::GetSelectedDeviceList(dev_type_);
if (selected_devices.size()) {
phi::DeviceManager::SetDevice(dev_type_, selected_devices[0]);
}
phi::DeviceManager::ProfilerInitialize(dev_type_, &collector_, &context_);
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/backends/device_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -697,8 +697,8 @@ DeviceManager& DeviceManager::Instance() {
}

void DeviceManager::Release() {
stream::Stream::ReleaseAll();
event::Event::ReleaseAll();
stream::Stream::ReleaseAll();
Instance().device_map_.clear();
Instance().device_impl_map_.clear();
}
Expand Down

0 comments on commit 3f6915c

Please sign in to comment.