Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
IP
elsa
Commits
e23556cc
Commit
e23556cc
authored
Mar 16, 2020
by
Jens Petit
Browse files
DataHandlerGPU: Avoid host-device transfers in Siddons and Josephs (
#21
)
parent
b84ee79d
Changes
2
Hide whitespace changes
Inline
Side-by-side
elsa/projectors_cuda/JosephsMethodCUDA.cpp
View file @
e23556cc
...
...
@@ -434,7 +434,15 @@ namespace elsa
{
cudaMemcpy3DParms
cpyParams
=
{};
cpyParams
.
extent
=
extent
;
cpyParams
.
kind
=
direction
;
cudaPointerAttributes
ptrAttributes
;
// if host data is a cuda pointer it must be managed unified memory -> internal copy
if
(
cudaPointerGetAttributes
(
&
ptrAttributes
,
hostData
)
==
cudaSuccess
)
{
Logger
::
get
(
"JosephsMethodCUDA"
)
->
debug
(
"Use internal GPU copy"
);
cpyParams
.
kind
=
cudaMemcpyDeviceToDevice
;
}
else
{
cpyParams
.
kind
=
direction
;
}
cudaPitchedPtr
tmp
=
make_cudaPitchedPtr
(
hostData
,
extent
.
width
,
extent
.
width
,
extent
.
height
);
...
...
@@ -493,7 +501,15 @@ namespace elsa
cpyParams
.
srcPtr
.
ysize
=
domainDimsui
[
1
];
cpyParams
.
dstArray
=
volume
;
cpyParams
.
extent
=
volumeExtent
;
cpyParams
.
kind
=
cudaMemcpyHostToDevice
;
// if host data is a cuda pointer it must be managed unified memory -> internal copy
cudaPointerAttributes
ptrAttributes
;
if
(
cudaPointerGetAttributes
(
&
ptrAttributes
,
(
void
*
)
&
hostData
[
0
])
==
cudaSuccess
)
{
Logger
::
get
(
"JosephsMethodCUDA"
)
->
debug
(
"Internal GPU copy of texture"
);
cpyParams
.
kind
=
cudaMemcpyDeviceToDevice
;
}
else
{
cpyParams
.
kind
=
cudaMemcpyHostToDevice
;
}
if
(
cudaMemcpy3DAsync
(
&
cpyParams
)
!=
cudaSuccess
)
throw
std
::
logic_error
(
...
...
elsa/projectors_cuda/SiddonsMethodCUDA.cpp
View file @
e23556cc
...
...
@@ -273,7 +273,15 @@ namespace elsa
{
cudaMemcpy3DParms
cpyParams
=
{};
cpyParams
.
extent
=
extent
;
cpyParams
.
kind
=
direction
;
cudaPointerAttributes
ptrAttributes
;
// if host data is a cuda pointer it must be managed unified memory -> internal copy
if
(
cudaPointerGetAttributes
(
&
ptrAttributes
,
hostData
)
==
cudaSuccess
)
{
Logger
::
get
(
"SiddonsMethodCUDA"
)
->
debug
(
"Use internal GPU copy"
);
cpyParams
.
kind
=
cudaMemcpyDeviceToDevice
;
}
else
{
cpyParams
.
kind
=
direction
;
}
cudaPitchedPtr
tmp
=
make_cudaPitchedPtr
(
hostData
,
extent
.
width
,
extent
.
width
,
extent
.
height
);
...
...
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