From e8571cca514ab0f787ca866effc5fe626a6999b8 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 13 Aug 2020 11:00:59 +0800 Subject: [PATCH] fix(mgb/cuda): fix cuda host alloc set device GitOrigin-RevId: f4756e8981bad8ae8ff595cbf98f3e50caaf18e9 --- src/core/impl/comp_node/cuda/comp_node.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/impl/comp_node/cuda/comp_node.cpp b/src/core/impl/comp_node/cuda/comp_node.cpp index b12e8167..31aa33f7 100644 --- a/src/core/impl/comp_node/cuda/comp_node.cpp +++ b/src/core/impl/comp_node/cuda/comp_node.cpp @@ -423,9 +423,8 @@ void CudaCompNodeImpl::free_device(void *ptr) { } void* CudaCompNodeImpl::alloc_host(size_t size) { - // no need for activate() here because under - // unified addressing, host memory can be accessed - // and freed on any device + // need activate because it create cuda cuda context in current device + activate(); return sd->host_alloc->alloc(size); }