Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Sudhanshu Sane
VTK-m
Commits
a9d092ef
Commit
a9d092ef
authored
Dec 31, 2018
by
Robert Maynard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize TransferInfo / VirtualObjectTransfer for shared memory systems
parent
ee6917a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
vtkm/cont/StorageVirtual.hxx
vtkm/cont/StorageVirtual.hxx
+30
-1
No files found.
vtkm/cont/StorageVirtual.hxx
View file @
a9d092ef
...
...
@@ -24,6 +24,8 @@
#include <vtkm/cont/TryExecute.h>
#include <vtkm/cont/internal/TransferInfo.h>
#include <vtkm/cont/internal/VirtualObjectTransferShareWithControl.h>
namespace
vtkm
{
namespace
cont
...
...
@@ -34,12 +36,39 @@ template <typename DerivedPortal>
struct
TransferToDevice
{
template
<
typename
DeviceAdapterTag
,
typename
Payload
,
typename
...
Args
>
bool
operator
()(
DeviceAdapterTag
devId
,
Payload
&&
payload
,
Args
&&
...
args
)
const
inline
bool
operator
()(
DeviceAdapterTag
devId
,
Payload
&&
payload
,
Args
&&
...
args
)
const
{
using
TransferType
=
cont
::
internal
::
VirtualObjectTransfer
<
DerivedPortal
,
DeviceAdapterTag
>
;
using
shared_memory_transfer
=
std
::
is_base_of
<
vtkm
::
cont
::
internal
::
VirtualObjectTransferShareWithControl
<
DerivedPortal
>
,
TransferType
>
;
return
this
->
Transfer
(
devId
,
shared_memory_transfer
{},
std
::
forward
<
Payload
>
(
payload
),
std
::
forward
<
Args
>
(
args
)...);
}
template
<
typename
DeviceAdapterTag
,
typename
Payload
,
typename
...
Args
>
inline
bool
Transfer
(
DeviceAdapterTag
devId
,
std
::
true_type
,
Payload
&&
payload
,
Args
&&
...
args
)
const
{
//shared memory transfer so we just need
auto
smp_ptr
=
new
DerivedPortal
(
std
::
forward
<
Args
>
(
args
)...);
auto
host
=
std
::
unique_ptr
<
DerivedPortal
>
(
smp_ptr
);
payload
.
updateDevice
(
devId
,
std
::
move
(
host
),
smp_ptr
,
nullptr
);
return
true
;
}
template
<
typename
DeviceAdapterTag
,
typename
Payload
,
typename
...
Args
>
inline
bool
Transfer
(
DeviceAdapterTag
devId
,
std
::
false_type
,
Payload
&&
payload
,
Args
&&
...
args
)
const
{
//separate memory transfer
//construct all new transfer payload
using
TransferType
=
cont
::
internal
::
VirtualObjectTransfer
<
DerivedPortal
,
DeviceAdapterTag
>
;
auto
host
=
std
::
unique_ptr
<
DerivedPortal
>
(
new
DerivedPortal
(
std
::
forward
<
Args
>
(
args
)...));
auto
transfer
=
std
::
make_shared
<
TransferType
>
(
host
.
get
());
auto
device
=
transfer
->
PrepareForExecution
(
true
);
...
...
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