Skip to content

Memory-related issue with Array::fill #1833

@kennyweiss

Description

@kennyweiss

A user encountered a segfault with Array::fill() in a user code w/ a CUDA config (on LC's rzvector).
The code works as expected in other configs, so this seems like a memory-related issue w/ CUDA.

They found the following workaround:

diff --git a/src/tribol/search/InterfacePairFinder.cpp b/src/tribol/search/InterfacePairFinder.cpp
index 469457c..272832e 100644
--- a/src/tribol/search/InterfacePairFinder.cpp
+++ b/src/tribol/search/InterfacePairFinder.cpp
@@ -121,7 +121,8 @@ class CartesianProduct : public SearchBase {
     auto& contactPairs = m_coupling_scheme->getInterfacePairs();
     contactPairs.resize( countArray_host[0] );
-    countArray.fill( 0 );
+    int zero = 0;
+    axom::copy(countArray.data(), &zero, sizeof(int));

https://github.com/llnl/Tribol/blob/12031d198ecf1cdccbf1faaac9b0c20c06735225/src/tribol/search/InterfacePairFinder.cpp#L125-L128

We should investigate and fix this.

Metadata

Metadata

Assignees

Labels

ReviewedUser RequestIssues related to user requestsbugSomething isn't workingcudaIssues related to CUDAmemory

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions