diff --git a/MParT/Utilities/ArrayConversions.h b/MParT/Utilities/ArrayConversions.h index 1032016f..ed9aa73b 100644 --- a/MParT/Utilities/ArrayConversions.h +++ b/MParT/Utilities/ArrayConversions.h @@ -226,19 +226,27 @@ namespace mpart{ @param[in] inview A kokkos array in device memory. @return A kokkos array in host memory. Note that the layout (row-major or col-major) might be different than the default on the Host. The layout will match the device's default layout. */ - template - typename Kokkos::View::HostMirror ToHost(Kokkos::View const& inview){ - typename Kokkos::View::HostMirror outview = Kokkos::create_mirror_view(inview); + // template + // typename Kokkos::View::HostMirror ToHost(Kokkos::View const& inview){ + // typename Kokkos::View::HostMirror outview = Kokkos::create_mirror_view(inview); + // Kokkos::deep_copy (outview, inview); + // return outview; + // } + + template + typename ViewType::HostMirror ToHost(ViewType const& inview){ + typename ViewType::HostMirror outview = Kokkos::create_mirror_view(inview); Kokkos::deep_copy (outview, inview); return outview; } - template - StridedMatrix ToHost(StridedMatrix const& inview){ - typename StridedMatrix::HostMirror outview = Kokkos::create_mirror_view(inview); - Kokkos::deep_copy (outview, inview); - return outview; - } + + // template + // StridedMatrix ToHost(StridedMatrix const& inview){ + // typename StridedMatrix::HostMirror outview = Kokkos::create_mirror_view(inview); + // Kokkos::deep_copy (outview, inview); + // return outview; + // } /** @brief Copies a range of elements from a Kokkos array in device to host memory @@ -272,13 +280,13 @@ namespace mpart{ @tparam ScalarType The type and dimension of the Kokkos::View (e.g., double*, double**, or int*) @tparam SliceTypes A variadic parameter pack containing options for constructing a Kokkos::subview of the device view. */ - template - Kokkos::View ToHost(Kokkos::View const& inview, SliceTypes... sliceParams){ - auto subview = Kokkos::subview(inview, sliceParams...); // Construct the subview - typename Kokkos::View::HostMirror outview = Kokkos::create_mirror_view(subview); - Kokkos::deep_copy (outview, subview); - return outview; - } + // template + // Kokkos::View ToHost(Kokkos::View const& inview, SliceTypes... sliceParams){ + // auto subview = Kokkos::subview(inview, sliceParams...); // Construct the subview + // typename Kokkos::View::HostMirror outview = Kokkos::create_mirror_view(subview); + // Kokkos::deep_copy (outview, subview); + // return outview; + // } #if defined(MPART_ENABLE_GPU) diff --git a/tests/Test_LinearAlgebra.cpp b/tests/Test_LinearAlgebra.cpp index 3067dfa9..527c2294 100644 --- a/tests/Test_LinearAlgebra.cpp +++ b/tests/Test_LinearAlgebra.cpp @@ -399,7 +399,7 @@ TEST_CASE( "Testing LU Factorization on Device", "LinearAlgebra_LUDevice" ) { } } SECTION("Compute Determinant") { - PartialPivLU Alu_d(constA_d); + PartialPivLU Alu_d(constA_d); CHECK(Alu_d.determinant() == Approx(eigA.determinant()).epsilon(1e-14).margin(1e-14)); } } @@ -424,12 +424,12 @@ TEST_CASE( "Testing Cholesky Factorization", "LinearAlgebra_Cholesky" ) { Eigen::MatrixXd eigY = eigA.llt().matrixL().solve(eigB); SECTION("Compute Cholesky") { - Cholesky Achol_d(constA_d); + Cholesky Achol_d(constA_d); } SECTION("Solve Cholesky inplace") { Kokkos::View C_d("C", 3, 2); Kokkos::deep_copy(C_d, B_d); - Cholesky Achol_d(constA_d); + Cholesky Achol_d(constA_d); Achol_d.solveInPlace(C_d); auto C_h = ToHost(C_d); for(unsigned int j=0; j C_d("C", 3, 2); Kokkos::deep_copy(C_d, B_d); - Cholesky Achol_d(constA_d); + Cholesky Achol_d(constA_d); Achol_d.solveInPlaceL(C_d); auto C_h = ToHost(C_d); for(unsigned int j=0; j Achol_d(constA_d); + Cholesky Achol_d(constA_d); auto C_d = Achol_d.solve(B_d); auto C_h = ToHost(C_d); for(unsigned int j=0; j Achol_d(constA_d); + Cholesky Achol_d(constA_d); CHECK(Achol_d.determinant() == Approx(eigA.determinant()).epsilon(1e-14).margin(1e-14)); } }