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
19697c29
Commit
19697c29
authored
Feb 03, 2018
by
Tristan Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add create gpu buffer helper function
parent
59ec0797
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
gpu_external_function.cpp
src/ngraph/runtime/gpu/gpu_external_function.cpp
+2
-1
gpu_util.cpp
src/ngraph/runtime/gpu/gpu_util.cpp
+7
-0
gpu_util.hpp
src/ngraph/runtime/gpu/gpu_util.hpp
+1
-0
No files found.
src/ngraph/runtime/gpu/gpu_external_function.cpp
View file @
19697c29
...
@@ -553,7 +553,8 @@ void runtime::gpu::GPU_ExternalFunction::compile()
...
@@ -553,7 +553,8 @@ void runtime::gpu::GPU_ExternalFunction::compile()
size_t
temp_pool_size
=
current_function
->
get_temporary_pool_size
();
size_t
temp_pool_size
=
current_function
->
get_temporary_pool_size
();
writer
<<
"// Allocate the memory pool
\n
"
;
writer
<<
"// Allocate the memory pool
\n
"
;
// TODO memory pool malloc.
// TODO memory pool malloc.
writer
<<
"void** pool_base_ptr;
\n
"
;
writer
<<
"void** pool_base_ptr = runtime::gpu::create_gpu_buffer("
<<
temp_pool_size
<<
");
\n
"
;
// Add temporaries to the variable name map
// Add temporaries to the variable name map
for
(
shared_ptr
<
Node
>
node
:
current_function
->
get_ordered_ops
())
for
(
shared_ptr
<
Node
>
node
:
current_function
->
get_ordered_ops
())
...
...
src/ngraph/runtime/gpu/gpu_util.cpp
View file @
19697c29
...
@@ -45,6 +45,13 @@ void runtime::gpu::check_cuda_errors(CUresult err)
...
@@ -45,6 +45,13 @@ void runtime::gpu::check_cuda_errors(CUresult err)
assert
(
err
==
CUDA_SUCCESS
);
assert
(
err
==
CUDA_SUCCESS
);
}
}
void
**
runtime
::
gpu
::
create_gpu_buffer
(
size_t
buffer_size
)
{
void
**
allocated_buffer_pool
;
cudaMalloc
(
&
allocated_buffer_pool
,
buffer_size
);
return
allocated_buffer_pool
;
}
void
runtime
::
gpu
::
cuda_memcpyDtD
(
void
*
d
,
void
*
s
,
size_t
element_count
,
size_t
element_size
)
void
runtime
::
gpu
::
cuda_memcpyDtD
(
void
*
d
,
void
*
s
,
size_t
element_count
,
size_t
element_size
)
{
{
size_t
size_in_bytes
=
element_size
*
element_count
;
size_t
size_in_bytes
=
element_size
*
element_count
;
...
...
src/ngraph/runtime/gpu/gpu_util.hpp
View file @
19697c29
...
@@ -22,6 +22,7 @@ namespace ngraph
...
@@ -22,6 +22,7 @@ namespace ngraph
{
{
void
print_gpu_f32_tensor
(
void
*
p
,
size_t
element_count
,
size_t
element_size
);
void
print_gpu_f32_tensor
(
void
*
p
,
size_t
element_count
,
size_t
element_size
);
void
check_cuda_errors
(
CUresult
err
);
void
check_cuda_errors
(
CUresult
err
);
void
**
create_gpu_buffer
(
size_t
buffer_size
);
void
cuda_memcpyDtD
(
void
*
d
,
void
*
s
,
size_t
element_count
,
size_t
element_size
);
void
cuda_memcpyDtD
(
void
*
d
,
void
*
s
,
size_t
element_count
,
size_t
element_size
);
void
cuda_memcpyHtD
(
void
*
d
,
void
*
s
,
size_t
buffer_size
);
void
cuda_memcpyHtD
(
void
*
d
,
void
*
s
,
size_t
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