Skip to content

Commit

Permalink
Merge pull request #1688 from arcaneframework/dev/gg-add-explicit-syn…
Browse files Browse the repository at this point in the history
…c-for-dualuniquearray

Add explicit synchronization between host and device for DualUniqueArray
  • Loading branch information
grospelliergilles authored Oct 14, 2024
2 parents d21318e + 5cda509 commit 55382c9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions arcane/src/arcane/materials/IncrementalComponentModifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ apply(MaterialModifierOperation* operation)
{
m_work_info.m_is_materials_modified.fillHost(false);
m_work_info.m_is_environments_modified.fillHost(false);
m_work_info.m_is_materials_modified.sync(is_device);
m_work_info.m_is_environments_modified.sync(is_device);

{
auto mat_modifier = m_work_info.m_is_materials_modified.modifier(is_device);
Expand Down
12 changes: 10 additions & 2 deletions arcane/src/arcane/utils/DualUniqueArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,24 @@ class DualUniqueArray
Int64 size() const { return m_array.size(); }
SmallSpan<const DataType> view(bool is_device)
{
sync(is_device);
if (is_device) {
_checkUpdateDeviceView();
SmallSpan<const DataType> v = *(m_device_array.get());
return v;
}
else {
_checkUpdateHostView();
return hostSmallSpan();
}
}
void sync(bool is_device)
{
if (is_device) {
_checkUpdateDeviceView();
}
else {
_checkUpdateHostView();
}
}
void endUpdateHost()
{
m_is_valid_array = true;
Expand Down

0 comments on commit 55382c9

Please sign in to comment.