Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
7d29490f
Commit
7d29490f
authored
May 25, 2018
by
Fenglei
Committed by
Robert Kimball
May 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix invalid context when run mxnet and nbench (#1047)
parent
5dcd835f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
gpu_cuda_context_manager.cpp
src/ngraph/runtime/gpu/gpu_cuda_context_manager.cpp
+1
-2
gpu_cuda_context_manager.hpp
src/ngraph/runtime/gpu/gpu_cuda_context_manager.hpp
+3
-3
gpu_external_function.cpp
src/ngraph/runtime/gpu/gpu_external_function.cpp
+1
-1
No files found.
src/ngraph/runtime/gpu/gpu_cuda_context_manager.cpp
View file @
7d29490f
...
...
@@ -21,7 +21,7 @@
using
namespace
ngraph
;
runtime
::
gpu
::
CudaContextManager
&
runtime
::
gpu
::
CudaContextManager
::
i
nstance
()
runtime
::
gpu
::
CudaContextManager
&
runtime
::
gpu
::
CudaContextManager
::
I
nstance
()
{
static
CudaContextManager
manager
;
return
manager
;
...
...
@@ -32,7 +32,6 @@ runtime::gpu::CudaContextManager::CudaContextManager()
CUDA_SAFE_CALL
(
cuInit
(
0
));
CUDA_SAFE_CALL
(
cuDeviceGet
(
&
m_device
,
0
));
CUDA_SAFE_CALL
(
cuDevicePrimaryCtxRetain
(
&
m_context
,
m_device
));
m_context_ptr
=
std
::
make_shared
<
CUcontext
>
(
m_context
);
}
runtime
::
gpu
::
CudaContextManager
::~
CudaContextManager
()
...
...
src/ngraph/runtime/gpu/gpu_cuda_context_manager.hpp
View file @
7d29490f
...
...
@@ -30,19 +30,19 @@ namespace ngraph
class
CudaContextManager
{
public
:
static
CudaContextManager
&
i
nstance
();
static
CudaContextManager
&
I
nstance
();
CudaContextManager
(
CudaContextManager
const
&
)
=
delete
;
CudaContextManager
(
CudaContextManager
&&
)
=
delete
;
CudaContextManager
&
operator
=
(
CudaContextManager
const
&
)
=
delete
;
CudaContextManager
&
operator
=
(
CudaContextManager
&&
)
=
delete
;
std
::
shared_ptr
<
CUcontext
>
get_context
()
{
return
m_context_ptr
;
}
CUcontext
GetContext
()
{
return
m_context
;
}
void
SetContextCurrent
()
{
cuCtxSetCurrent
(
m_context
);
}
protected
:
CudaContextManager
();
~
CudaContextManager
();
CUdevice
m_device
;
CUcontext
m_context
;
std
::
shared_ptr
<
CUcontext
>
m_context_ptr
;
};
}
}
...
...
src/ngraph/runtime/gpu/gpu_external_function.cpp
View file @
7d29490f
...
...
@@ -259,7 +259,7 @@ runtime::gpu::GPU_ExternalFunction::GPU_ExternalFunction(
// Create context use driver API and make it current, the runtime call will pickup the context
// http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html
// #interoperability-between-runtime-and-driver-apis
ngraph
::
runtime
::
gpu
::
CudaContextManager
::
instance
();
ngraph
::
runtime
::
gpu
::
CudaContextManager
::
Instance
().
SetContextCurrent
();
m_ctx
->
compiled_kernel_pool
=
new
CudaFunctionPool
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment