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
24054d8e
Commit
24054d8e
authored
Feb 14, 2018
by
fenglei.tian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clang-format-3.9
parent
938329f0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
57 deletions
+46
-57
gpu_call_frame.cpp
src/ngraph/runtime/gpu/gpu_call_frame.cpp
+0
-0
gpu_call_frame.hpp
src/ngraph/runtime/gpu/gpu_call_frame.hpp
+1
-1
gpu_emitter.cpp
src/ngraph/runtime/gpu/gpu_emitter.cpp
+35
-48
gpu_external_function.cpp
src/ngraph/runtime/gpu/gpu_external_function.cpp
+9
-7
gpu_tensor_view.cpp
src/ngraph/runtime/gpu/gpu_tensor_view.cpp
+1
-1
No files found.
src/ngraph/runtime/gpu/gpu_call_frame.cpp
View file @
24054d8e
src/ngraph/runtime/gpu/gpu_call_frame.hpp
View file @
24054d8e
...
...
@@ -21,8 +21,8 @@
#include <vector>
#include <cuda_runtime.h>
#include "cublas_v2.h"
#include <cudnn.h>
#include "cublas_v2.h"
#include "ngraph/function.hpp"
#include "ngraph/runtime/call_frame.hpp"
...
...
src/ngraph/runtime/gpu/gpu_emitter.cpp
View file @
24054d8e
...
...
@@ -17,16 +17,16 @@
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cublas_v2.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cudnn_v7.h>
#include <iostream>
#include <nvrtc.h>
#include <string>
#include <typeindex>
#include <unordered_map>
#include <vector>
#include <nvrtc.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cublas_v2.h>
#include <cudnn_v7.h>
#include "ngraph/node.hpp"
#include "ngraph/ops/broadcast.hpp"
...
...
@@ -51,29 +51,30 @@
using
namespace
std
;
using
namespace
ngraph
;
#define NVRTC_SAFE_CALL(x) \
do { \
do \
{ \
nvrtcResult result = x; \
if (result != NVRTC_SUCCESS) { \
std::cerr << "\nerror: " #x " failed with error " \
<< nvrtcGetErrorString(result) << '\n'; \
if (result != NVRTC_SUCCESS) \
{ \
std::cerr << "\nerror: " #x " failed with error " << nvrtcGetErrorString(result) \
<< '\n'; \
exit(1); \
} \
} while
(0)
} while
(0)
#define CUDA_SAFE_CALL(x) \
do { \
do \
{ \
CUresult result = x; \
if (result != CUDA_SUCCESS) { \
const char *msg; \
if (result != CUDA_SUCCESS) \
{ \
const char* msg; \
cuGetErrorName(result, &msg); \
std::cerr << "\nerror: " #x " failed with error " \
<< msg << '\n'; \
std::cerr << "\nerror: " #x " failed with error " << msg << '\n'; \
exit(1); \
} \
} while(0)
} while (0)
void
runtime
::
gpu
::
GPU_Emitter
::
EmitNop
(
codegen
::
CodeWriter
&
writer
,
const
ngraph
::
Node
*
n
,
...
...
@@ -122,14 +123,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer
<<
"cudnnOpTensor(cudnn_handle,"
<<
"opTensorDesc,"
<<
"&alpha1,"
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"&alpha2,"
<<
"descriptor,"
<<
args
[
1
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
1
].
get_name
()
<<
","
<<
"&beta,"
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
...
...
@@ -247,12 +245,11 @@ void runtime::gpu::GPU_Emitter::EmitDot(codegen::CodeWriter& writer,
// clang-format on
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
else
{
}
else
{
// General ND Call?
}
}
}
void
runtime
::
gpu
::
GPU_Emitter
::
EmitDivide
(
codegen
::
CodeWriter
&
writer
,
...
...
@@ -344,14 +341,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer
<<
"cudnnOpTensor(cudnn_handle,"
<<
"opTensorDesc,"
<<
"&alpha1,"
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"&alpha2,"
<<
"descriptor,"
<<
args
[
1
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
1
].
get_name
()
<<
","
<<
"&beta,"
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
...
...
@@ -388,17 +382,13 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer
<<
"cudnnOpTensor(cudnn_handle,"
<<
"opTensorDesc,"
<<
"&alpha1,"
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"&alpha2,"
<<
"descriptor,"
<<
args
[
1
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
1
].
get_name
()
<<
","
<<
"&beta,"
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
void
runtime
::
gpu
::
GPU_Emitter
::
EmitNegative
(
...
...
@@ -434,14 +424,11 @@ cudnnSetOpTensorDescriptor(opTensorDesc,
writer
<<
"cudnnOpTensor(cudnn_handle,"
<<
"opTensorDesc,"
<<
"&alpha1,"
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"&alpha2,"
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"descriptor,"
<<
args
[
0
].
get_name
()
<<
","
<<
"&beta,"
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
<<
"descriptor,"
<<
out
[
0
].
get_name
()
<<
");
\n
"
;
writer
.
indent
--
;
writer
<<
"}
\n
"
;
}
...
...
src/ngraph/runtime/gpu/gpu_external_function.cpp
View file @
24054d8e
...
...
@@ -23,10 +23,10 @@
#include <typeinfo>
#include <unordered_map>
#include <cuda_runtime.h>
#include <cudnn_v7.h>
#include "cublas_v2.h"
#include "cuda.h"
#include <cuda_runtime.h>
#include <cudnn_v7.h>
#include "cublas_v2.h"
#include "cuda.h"
#include "ngraph/codegen/code_writer.hpp"
#include "ngraph/codegen/compiler.hpp"
...
...
@@ -359,8 +359,9 @@ void runtime::gpu::GPU_ExternalFunction::compile()
writer
<<
"// Declare all functions
\n
"
;
for
(
shared_ptr
<
Function
>
f
:
pass_manager
.
get_state
().
get_functions
())
{
writer
<<
"extern
\"
C
\"
void "
<<
f
->
get_name
()
<<
"(void** inputs, void** outputs, cublasHandle_t& cublas_handle, cudnnHandle_t& cudnn_handle);
\n
"
;
writer
<<
"extern
\"
C
\"
void "
<<
f
->
get_name
()
<<
"(void** inputs, void** outputs, "
"cublasHandle_t& cublas_handle, "
"cudnnHandle_t& cudnn_handle);
\n
"
;
}
writer
<<
"
\n
"
;
...
...
@@ -478,7 +479,8 @@ void runtime::gpu::GPU_ExternalFunction::compile()
}
writer
<<
"extern
\"
C
\"
void "
<<
current_function
->
get_name
();
writer
<<
"(void** inputs, void** outputs, cublasHandle_t& cublas_handle, cudnnHandle_t& cudnn_handle)
\n
"
;
writer
<<
"(void** inputs, void** outputs, cublasHandle_t& cublas_handle, cudnnHandle_t& "
"cudnn_handle)
\n
"
;
writer
<<
"{
\n
"
;
writer
.
indent
++
;
...
...
src/ngraph/runtime/gpu/gpu_tensor_view.cpp
View file @
24054d8e
...
...
@@ -41,7 +41,7 @@ runtime::gpu::GPU_TensorView::GPU_TensorView(const ngraph::element::Type& elemen
m_buffer_size
=
m_descriptor
->
get_tensor_view_layout
()
->
get_size
()
*
element_type
.
size
();
if
(
m_buffer_size
>
0
)
{
cudaMalloc
((
void
**
)
&
m_allocated_buffer_pool
,
m_buffer_size
);
cudaMalloc
((
void
**
)
&
m_allocated_buffer_pool
,
m_buffer_size
);
}
}
...
...
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