diff --git a/core/src/Cuda/Kokkos_Cuda_Parallel.hpp b/core/src/Cuda/Kokkos_Cuda_Parallel.hpp index 2ae1cc0dddf..3b0f9ad531b 100644 --- a/core/src/Cuda/Kokkos_Cuda_Parallel.hpp +++ b/core/src/Cuda/Kokkos_Cuda_Parallel.hpp @@ -525,6 +525,7 @@ class ParallelFor< FunctorType inline void execute() const { + if(m_rp.m_num_tiles==0) return; const array_index_type maxblocks = static_cast(Kokkos::Impl::CudaTraits::UpperBoundGridCount); if ( RP::rank == 2 ) { diff --git a/core/unit_test/TestMDRange.hpp b/core/unit_test/TestMDRange.hpp index 88b3a9b0c6e..a382a207002 100644 --- a/core/unit_test/TestMDRange.hpp +++ b/core/unit_test/TestMDRange.hpp @@ -956,7 +956,12 @@ struct TestMDRange_3D { } , Kokkos::Min(min) ); - ASSERT_EQ( min, 8.0 ); + if((N0-1)*(N1-1)*(N2-1)>0) + ASSERT_EQ( min, 8.0 ); + else { + double min_identity = Kokkos::reduction_identity::min(); + ASSERT_EQ( min, min_identity ); + } } #endif #endif diff --git a/core/unit_test/TestMDRange_d.hpp b/core/unit_test/TestMDRange_d.hpp index 1a477a228fb..e25213a2893 100644 --- a/core/unit_test/TestMDRange_d.hpp +++ b/core/unit_test/TestMDRange_d.hpp @@ -46,8 +46,10 @@ namespace Test { TEST_F( TEST_CATEGORY , mdrange_3d) { + TestMDRange_3D< TEST_EXECSPACE >::test_for3( 1, 10, 100 ); TestMDRange_3D< TEST_EXECSPACE >::test_for3( 100, 10, 100 ); #if !defined( KOKKOS_ENABLE_ROCM ) // MDRange Reduced explicitly handled in its own cpp file + TestMDRange_3D< TEST_EXECSPACE >::test_reduce3( 1, 10, 100 ); TestMDRange_3D< TEST_EXECSPACE >::test_reduce3( 100, 10, 100 ); #endif } diff --git a/core/unit_test/TestViewCopy.hpp b/core/unit_test/TestViewCopy.hpp index 7eab9daa11e..4771593228c 100644 --- a/core/unit_test/TestViewCopy.hpp +++ b/core/unit_test/TestViewCopy.hpp @@ -56,17 +56,13 @@ struct TestViewCopy { using InExecSpace = ExecSpace; - static void test_view_copy() + static void test_view_copy(const int dim0, const int dim1, const int dim2) { #if defined( KOKKOS_ENABLE_CUDA ) || defined( KOKKOS_ENABLE_ROCM ) // ExecSpace = CudaUVM, CudaHostPinned // This test will fail at runtime with an illegal memory access if something goes wrong // Test 1: deep_copy from host_mirror_space to ExecSpace and ExecSpace back to host_mirror_space { - const int dim0 = 4; - const int dim1 = 2; - const int dim2 = 3; - typedef Kokkos::View Rank4ViewType; Rank4ViewType view_4; view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2); @@ -88,10 +84,6 @@ struct TestViewCopy { // Test 2: deep_copy from Cuda to ExecSpace and ExecSpace back to Cuda { - const int dim0 = 4; - const int dim1 = 2; - const int dim2 = 3; - typedef Kokkos::View Rank4ViewType; Rank4ViewType view_4; view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2); @@ -118,10 +110,6 @@ struct TestViewCopy { // Test 3: deep_copy from host_space to ExecSpace and ExecSpace back to host_space { - const int dim0 = 4; - const int dim1 = 2; - const int dim2 = 3; - typedef Kokkos::View Rank4ViewType; Rank4ViewType view_4; view_4 = Rank4ViewType("view_4", dim0, dim1, dim2, dim2); @@ -149,7 +137,8 @@ struct TestViewCopy { TEST_F( TEST_CATEGORY , view_copy_tests ) { //Only include this file to be compiled with CudaUVM and CudaHostPinned - TestViewCopy< TEST_EXECSPACE >::test_view_copy(); + TestViewCopy< TEST_EXECSPACE >::test_view_copy(4,2,3); + TestViewCopy< TEST_EXECSPACE >::test_view_copy(4,2,0); } } // namespace Test