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
555d5929
Commit
555d5929
authored
Feb 26, 2018
by
Fenglei Tian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code style
parent
2ef72022
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
15 deletions
+15
-15
gpu_call_frame.cpp
src/ngraph/runtime/gpu/gpu_call_frame.cpp
+1
-1
gpu_cuda_context_manager.hpp
src/ngraph/runtime/gpu/gpu_cuda_context_manager.hpp
+2
-2
gpu_cuda_function_builder.hpp
src/ngraph/runtime/gpu/gpu_cuda_function_builder.hpp
+1
-1
gpu_cuda_function_pool.hpp
src/ngraph/runtime/gpu/gpu_cuda_function_pool.hpp
+3
-3
gpu_cuda_kernel_builder.hpp
src/ngraph/runtime/gpu/gpu_cuda_kernel_builder.hpp
+3
-3
gpu_cuda_kernel_emitters.cpp
src/ngraph/runtime/gpu/gpu_cuda_kernel_emitters.cpp
+5
-5
No files found.
src/ngraph/runtime/gpu/gpu_call_frame.cpp
View file @
555d5929
...
...
@@ -34,7 +34,7 @@ runtime::gpu::GPU_CallFrame::GPU_CallFrame(std::shared_ptr<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
::
I
nstance
();
ngraph
::
runtime
::
gpu
::
CudaContextManager
::
i
nstance
();
cublasStatus_t
cublasStatus
=
cublasCreate
(
&
m_cublas_handle
);
if
(
cublasStatus
!=
CUBLAS_STATUS_SUCCESS
)
{
...
...
src/ngraph/runtime/gpu/gpu_cuda_context_manager.hpp
View file @
555d5929
...
...
@@ -30,7 +30,7 @@ namespace ngraph
class
CudaContextManager
{
public
:
static
CudaContextManager
&
I
nstance
()
static
CudaContextManager
&
i
nstance
()
{
static
CudaContextManager
manager
;
return
manager
;
...
...
@@ -41,7 +41,7 @@ namespace ngraph
CudaContextManager
&
operator
=
(
CudaContextManager
const
&
)
=
delete
;
CudaContextManager
&
operator
=
(
CudaContextManager
&&
)
=
delete
;
std
::
shared_ptr
<
CUcontext
>
GetC
ontext
()
{
return
m_context_ptr
;
}
std
::
shared_ptr
<
CUcontext
>
get_c
ontext
()
{
return
m_context_ptr
;
}
protected
:
CudaContextManager
()
{
...
...
src/ngraph/runtime/gpu/gpu_cuda_function_builder.hpp
View file @
555d5929
...
...
@@ -30,7 +30,7 @@ namespace ngraph
class
CudaFunctionBuilder
{
public
:
static
std
::
shared_ptr
<
CUfunction
>
G
et
(
const
std
::
string
&
name
,
static
std
::
shared_ptr
<
CUfunction
>
g
et
(
const
std
::
string
&
name
,
const
std
::
string
&
kernel
,
int
number_of_options
,
const
char
**
options
)
...
...
src/ngraph/runtime/gpu/gpu_cuda_function_pool.hpp
View file @
555d5929
...
...
@@ -30,7 +30,7 @@ namespace ngraph
class
CudaFunctionPool
{
public
:
static
CudaFunctionPool
&
I
nstance
()
static
CudaFunctionPool
&
i
nstance
()
{
static
CudaFunctionPool
pool
;
return
pool
;
...
...
@@ -41,12 +41,12 @@ namespace ngraph
CudaFunctionPool
&
operator
=
(
CudaFunctionPool
const
&
)
=
delete
;
CudaFunctionPool
&
operator
=
(
CudaFunctionPool
&&
)
=
delete
;
void
S
et
(
std
::
string
&
name
,
std
::
shared_ptr
<
CUfunction
>
function
)
void
s
et
(
std
::
string
&
name
,
std
::
shared_ptr
<
CUfunction
>
function
)
{
m_function_map
.
insert
({
name
,
function
});
}
std
::
shared_ptr
<
CUfunction
>
G
et
(
std
::
string
&
name
)
std
::
shared_ptr
<
CUfunction
>
g
et
(
std
::
string
&
name
)
{
auto
it
=
m_function_map
.
find
(
name
);
if
(
it
!=
m_function_map
.
end
())
...
...
src/ngraph/runtime/gpu/gpu_cuda_kernel_builder.hpp
View file @
555d5929
...
...
@@ -27,7 +27,7 @@ namespace ngraph
class
CudaKernelBuilder
{
public
:
static
void
G
et_1_element_op
(
const
std
::
string
&
name
,
static
void
g
et_1_element_op
(
const
std
::
string
&
name
,
const
std
::
string
&
data_type
,
const
std
::
string
&
op
,
std
::
string
&
kernel
)
...
...
@@ -45,7 +45,7 @@ out[tid] =)" + op + "(in[tid]);\n" +
return
;
}
static
void
G
et_2_element_op
(
const
std
::
string
&
name
,
static
void
g
et_2_element_op
(
const
std
::
string
&
name
,
const
std
::
string
&
data_type
,
const
std
::
string
&
op
,
std
::
string
&
kernel
)
...
...
@@ -64,7 +64,7 @@ out[tid] = in1[tid] )" + op + "in2[tid]\n" +
return
;
}
static
void
G
et_n_element_op
(
const
std
::
string
&
name
,
static
void
g
et_n_element_op
(
const
std
::
string
&
name
,
const
std
::
string
&
data_type
,
const
std
::
vector
<
std
::
string
>&
ops
,
std
::
string
&
kernel
)
...
...
src/ngraph/runtime/gpu/gpu_cuda_kernel_emitters.cpp
View file @
555d5929
...
...
@@ -36,14 +36,14 @@ namespace ngraph
{
std
::
string
name
=
"abs"
;
// Create an instance of nvrtcProgram with the code string.
if
(
CudaFunctionPool
::
Instance
().
G
et
(
name
)
==
nullptr
)
if
(
CudaFunctionPool
::
Instance
().
g
et
(
name
)
==
nullptr
)
{
const
char
*
opts
[]
=
{
"--gpu-architecture=compute_35"
,
"--relocatable-device-code=true"
};
std
::
string
kernel
;
CudaKernelBuilder
::
G
et_1_element_op
(
name
,
"float"
,
"fabsf"
,
kernel
);
CudaFunctionPool
::
Instance
().
S
et
(
name
,
CudaFunctionBuilder
::
G
et
(
"cuda_"
+
name
,
kernel
,
2
,
opts
));
CudaKernelBuilder
::
g
et_1_element_op
(
name
,
"float"
,
"fabsf"
,
kernel
);
CudaFunctionPool
::
Instance
().
s
et
(
name
,
CudaFunctionBuilder
::
g
et
(
"cuda_"
+
name
,
kernel
,
2
,
opts
));
}
//convert runtime ptr to driver api ptr
...
...
@@ -53,7 +53,7 @@ namespace ngraph
void
*
args_list
[]
=
{
&
d_ptr_in
,
&
d_ptr_out
,
&
count
};
CUDA_SAFE_CALL
(
cuLaunchKernel
(
*
CudaFunctionPool
::
Instance
().
G
et
(
name
).
get
(),
cuLaunchKernel
(
*
CudaFunctionPool
::
Instance
().
g
et
(
name
).
get
(),
count
,
1
,
1
,
// grid dim
...
...
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