dou112 commited on
Commit
068c697
·
1 Parent(s): 91954a7

cann: fix crash when llama-bench is running on multiple cann devices (llama/9627)

Browse files
Files changed (1) hide show
  1. ggml/src/ggml-cann/common.h +1 -0
ggml/src/ggml-cann/common.h CHANGED
@@ -227,6 +227,7 @@ struct ggml_backend_cann_context {
227
  * @brief Destructor for cleaning up resources.
228
  */
229
  ~ggml_backend_cann_context() {
 
230
  if (copy_event != nullptr) {
231
  ACL_CHECK(aclrtDestroyEvent(copy_event));
232
  }
 
227
  * @brief Destructor for cleaning up resources.
228
  */
229
  ~ggml_backend_cann_context() {
230
+ ggml_cann_set_device(device);
231
  if (copy_event != nullptr) {
232
  ACL_CHECK(aclrtDestroyEvent(copy_event));
233
  }