diff --git a/arcane/src/arcane/materials/IncrementalComponentModifier.cc b/arcane/src/arcane/materials/IncrementalComponentModifier.cc index f1cd17d336..323698e2ec 100644 --- a/arcane/src/arcane/materials/IncrementalComponentModifier.cc +++ b/arcane/src/arcane/materials/IncrementalComponentModifier.cc @@ -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); diff --git a/arcane/src/arcane/utils/DualUniqueArray.h b/arcane/src/arcane/utils/DualUniqueArray.h index 1f48203f17..097f42d293 100644 --- a/arcane/src/arcane/utils/DualUniqueArray.h +++ b/arcane/src/arcane/utils/DualUniqueArray.h @@ -221,16 +221,24 @@ class DualUniqueArray Int64 size() const { return m_array.size(); } SmallSpan view(bool is_device) { + sync(is_device); if (is_device) { - _checkUpdateDeviceView(); SmallSpan 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;