ORNL-CEES / DataTransferKit

A library for multiphysics solution transfer. ARCHIVED
https://datatransferkit.readthedocs.io/en/dtk-3.0/
BSD 3-Clause "New" or "Revised" License
47 stars 26 forks source link

NearestNeighborOperator indexing error #572

Closed mattbement closed 4 years ago

mattbement commented 4 years ago

Was trying to use the nearest neighbor operator and was hitting 'Constructor for Kokkos View 'indices' has mismatched number of arguments. Number of arguments = 0 but dynamic rank = 1'. Talked with Damien, and this was caused by use of deprecated Kokkos code. Diff below is a partial fix, but there's also a problem with line 165 in DTK_DetailsNearestNeighborOperatorImpl.hpp that needs more investigation.


diff --git a/packages/Meshfree/src/DTK_DetailsNearestNeighborOperatorImpl.hpp b/packages/Meshfree/src/DTK_DetailsNearestNeighborOperatorImpl.hpp
index dc04f4a5..2bbb7731 100644
--- a/packages/Meshfree/src/DTK_DetailsNearestNeighborOperatorImpl.hpp
+++ b/packages/Meshfree/src/DTK_DetailsNearestNeighborOperatorImpl.hpp
@@ -156,7 +156,7 @@ struct NearestNeighborOperatorImpl
             Kokkos::create_mirror( DeviceType(), indices );
         Kokkos::deep_copy( buffer_indices, indices );

-        typename View::non_const_type buffer_values( values.label() );
+        typename View::non_const_type buffer_values( values.label(),0 );

         pullSourceValues( comm, values, buffer_indices, buffer_ranks,
                           buffer_values );
diff --git a/packages/Meshfree/src/DTK_NearestNeighborOperator_def.hpp b/packages/Meshfree/src/DTK_NearestNeighborOperator_def.hpp
index 42d6311d..3e9a07a9 100644
--- a/packages/Meshfree/src/DTK_NearestNeighborOperator_def.hpp
+++ b/packages/Meshfree/src/DTK_NearestNeighborOperator_def.hpp
@@ -24,8 +24,8 @@ NearestNeighborOperator<DeviceType>::NearestNeighborOperator(
     MPI_Comm comm, Kokkos::View<Coordinate const **, DeviceType> source_points,
     Kokkos::View<Coordinate const **, DeviceType> target_points )
     : _comm( comm )
-    , _indices( "indices" )
-    , _ranks( "ranks" )
+    , _indices( "indices",0)
+    , _ranks( "ranks",0)
     , _size( source_points.extent_int( 0 ) )
 {
     // NOTE: instead of checking the pre-condition that there is at least one
@@ -45,9 +45,9 @@ NearestNeighborOperator<DeviceType>::NearestNeighborOperator(
         DeviceType>::makeNearestNeighborQueries( target_points );

     // Perform the actual search.
-    Kokkos::View<int *, DeviceType> indices( "indices" );
-    Kokkos::View<int *, DeviceType> offset( "offset" );
-    Kokkos::View<int *, DeviceType> ranks( "ranks" );
+    Kokkos::View<int *, DeviceType> indices( "indices",0 );
+    Kokkos::View<int *, DeviceType> offset( "offset",0 );
+    Kokkos::View<int *, DeviceType> ranks( "ranks",0 );
     search_tree.query( nearest_queries, indices, offset, ranks );

     // Check post-condition that we did find a nearest neighbor to all target
Rombur commented 4 years ago

Yeah we have PR (https://github.com/ORNL-CEES/DataTransferKit/pull/570) that fixes all of that but we need to fix something in ArborX first

masterleinad commented 4 years ago

I think the problems here a rather fixed by https://github.com/ORNL-CEES/DataTransferKit/pull/568.

Rombur commented 4 years ago

Closing since this is fixed in master. Let us know if you have other problems.