diff --git a/examples/kokkos_for.cpp b/examples/kokkos_for.cpp index 0026211a..35185191 100644 --- a/examples/kokkos_for.cpp +++ b/examples/kokkos_for.cpp @@ -38,10 +38,10 @@ using namespace mtr; // matar namespace // main -int main() +int main(int argc, char* argv[]) { - Kokkos::initialize(); - { + MATAR_KOKKOS_INIT + { // kokkos scope printf("starting test of loop macros \n"); // Kokkos::View arr("ARR", 10); @@ -348,9 +348,114 @@ int main() printf(" %d %d %d \n", i, j, k); }); - printf("done\n"); + // Hierarchical + + printf("\n\n\nHierarchical\n"); + size_t hiersize = 4; + auto hierTest1D = CArrayKokkos(hiersize); + auto hierTest2D = CArrayKokkos(hiersize, hiersize); + auto hierTest3D = CArrayKokkos(hiersize, hiersize, hiersize); + FOR_ALL(i_i, 0, hiersize, j_j, 0, hiersize, k_k, 0, hiersize, { + hierTest3D(i_i, j_j, k_k) = 0.0; + }); + FOR_FIRST(i_i, 0, hiersize, { + // Kokkos::parallel_for( \ + //Kokkos::TeamPolicy<>( 32, Kokkos::AUTO, 32 ), \ + //KOKKOS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { + //const int i_i = TEAM_ID; + FOR_SECOND(j_j, i_i, hiersize, { + // Kokkos::parallel_for( \ + //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { + // hierTest2D(i_i,j_j) = i_i * (j_j+1); + // int jstart = j_j*32; + // int jend = (j_j+1)*32; + FOR_THIRD(k_k, i_i, j_j, { + printf("%d,%d,%d\n", i_i, j_j, k_k); + // hierTest3D(i_i,j_j,k_k) = i_i*j_j*k_k; + }); + }); + }); + Kokkos::fence(); + for (int ppp = 0; ppp < hiersize; ppp++) { + // printf("%f\n", hierTest3D(0,0,ppp)); + // printf("%f\n", hierTest2D(3,ppp)); + // printf("%f\n", hierTest3D(3,3,ppp)); } - Kokkos::finalize(); + //printf("\n\n"); + + // Hierarchical reductions + + FOR_ALL(i_i, 0, hiersize, j_j, 0, hiersize, k_k, 0, hiersize, { + hierTest3D(i_i, j_j, k_k) = i_i*hiersize*hiersize+j_j*hiersize+k_k; + }); + + printf("\n\n\nHierarchical Reduce\n"); + //2D nesting + FOR_FIRST(i_i,0,hiersize, { + // Kokkos::parallel_for( \ + //Kokkos::TeamPolicy<>( 32, Kokkos::AUTO, 32 ), \ + //KOKKOS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { + //const int i_i = TEAM_ID; + double result = 0; + double lsum; + FOR_REDUCE_SUM_SECOND(j_j, i_i, hiersize, lsum, { + lsum += hierTest3D(i_i,j_j,0); + // Kokkos::parallel_for( \ + //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { + // hierTest2D(i_i,j_j) = i_i * (j_j+1); + // int jstart = j_j*32; + // int jend = (j_j+1)*32; + }, result); + hierTest1D(i_i)= result; + //printf("value at %d is %f\n", i_i, hierTest1D(i_i)); + }); + Kokkos::fence(); + for (int ppp = 0; ppp < hiersize; ppp++) { + //printf("%f\n", hierTest1D(ppp)); + // printf("%f\n", hierTest2D(3,ppp)); + // printf("%f\n", hierTest3D(3,3,ppp)); + } + printf("\n\n"); + + printf("\n\n\nHierarchical Vectorized Reduce\n"); + //3D vector nesting + FOR_FIRST(i_i,0,hiersize, { + // Kokkos::parallel_for( \ + //Kokkos::TeamPolicy<>( 32, Kokkos::AUTO, 32 ), \ + //KOKKOS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { + //const int i_i = TEAM_ID; + double result = 0; + double lsum; + FOR_SECOND(j_j, i_i, hiersize, { + // Kokkos::parallel_for( \ + //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { + // hierTest2D(i_i,j_j) = i_i * (j_j+1); + // int jstart = j_j*32; + // int jend = (j_j+1)*32; + FOR_REDUCE_SUM_THIRD(k_k, i_i, j_j, lsum, { + lsum += hierTest3D(i_i,j_j,k_k); + // Kokkos::parallel_for( \ + //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { + // hierTest2D(i_i,j_j) = i_i * (j_j+1); + // int jstart = j_j*32; + // int jend = (j_j+1)*32; + }, result); + hierTest2D(i_i,j_j)= result; + //printf("value at %d , %d is %f\n", i_i, j_j, hierTest2D(i_i,j_j)); + }); + }); + Kokkos::fence(); + for (int ppp = 0; ppp < hiersize; ppp++) { + //printf("%f\n", hierTest1D(ppp)); + // printf("%f\n", hierTest2D(3,ppp)); + // printf("%f\n", hierTest3D(3,3,ppp)); + } + printf("\n\n"); + + printf("done\n"); + + } // end kokkos scope + MATAR_KOKKOS_FINALIZE return 0; } diff --git a/examples/main_kokkos.cpp b/examples/main_kokkos.cpp index 2dd5dc6f..cb67bb9c 100644 --- a/examples/main_kokkos.cpp +++ b/examples/main_kokkos.cpp @@ -865,110 +865,6 @@ int main(int argc, char* argv[]) printf("\nalias name value [0] on device = %d \n", a_carray_device(0)); }); - // Hierarchical - - printf("\n\n\nHierarchical\n"); - size_t hiersize = 4; - auto hierTest1D = CArrayKokkos(hiersize); - auto hierTest2D = CArrayKokkos(hiersize, hiersize); - auto hierTest3D = CArrayKokkos(hiersize, hiersize, hiersize); - FOR_ALL(i_i, 0, hiersize, j_j, 0, hiersize, k_k, 0, hiersize, { - hierTest3D(i_i, j_j, k_k) = 0.0; - }); - FOR_FIRST(i_i, 0, hiersize, { - // Kokkos::parallel_for( \ - //Kokkos::TeamPolicy<>( 32, Kokkos::AUTO, 32 ), \ - //KOKKOS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { - //const int i_i = TEAM_ID; - FOR_SECOND(j_j, i_i, hiersize, { - // Kokkos::parallel_for( \ - //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { - // hierTest2D(i_i,j_j) = i_i * (j_j+1); - // int jstart = j_j*32; - // int jend = (j_j+1)*32; - FOR_THIRD(k_k, i_i, j_j, { - printf("%d,%d,%d\n", i_i, j_j, k_k); - // hierTest3D(i_i,j_j,k_k) = i_i*j_j*k_k; - }); - }); - }); - Kokkos::fence(); - for (int ppp = 0; ppp < hiersize; ppp++) { - // printf("%f\n", hierTest3D(0,0,ppp)); - // printf("%f\n", hierTest2D(3,ppp)); - // printf("%f\n", hierTest3D(3,3,ppp)); - } - //printf("\n\n"); - - // Hierarchical reductions - - FOR_ALL(i_i, 0, hiersize, j_j, 0, hiersize, k_k, 0, hiersize, { - hierTest3D(i_i, j_j, k_k) = i_i*hiersize*hiersize+j_j*hiersize+k_k; - }); - - printf("\n\n\nHierarchical Reduce\n"); - //2D nesting - FOR_FIRST(i_i, 0, hiersize, { - // Kokkos::parallel_for( \ - //Kokkos::TeamPolicy<>( 32, Kokkos::AUTO, 32 ), \ - //KOKKOS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { - //const int i_i = TEAM_ID; - double result = 0; - double lsum; - FOR_REDUCE_SUM_SECOND(j_j, i_i, hiersize, lsum, { - lsum += hierTest3D(i_i,j_j,0); - // Kokkos::parallel_for( \ - //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { - // hierTest2D(i_i,j_j) = i_i * (j_j+1); - // int jstart = j_j*32; - // int jend = (j_j+1)*32; - }, result); - hierTest1D(i_i)= result; - //printf("value at %d is %f\n", i_i, hierTest1D(i_i)); - }); - Kokkos::fence(); - for (int ppp = 0; ppp < hiersize; ppp++) { - //printf("%f\n", hierTest1D(ppp)); - // printf("%f\n", hierTest2D(3,ppp)); - // printf("%f\n", hierTest3D(3,3,ppp)); - } - printf("\n\n"); - - printf("\n\n\nHierarchical Vectorized Reduce\n"); - //3D vector nesting - FOR_FIRST(i_i, 1, hiersize+1, { - // Kokkos::parallel_for( \ - //Kokkos::TeamPolicy<>( 32, Kokkos::AUTO, 32 ), \ - //KOKKOS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { - //const int i_i = TEAM_ID; - double result = 0; - double lsum; - FOR_SECOND(j_j, i_i-1, hiersize, { - // Kokkos::parallel_for( \ - //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { - // hierTest2D(i_i,j_j) = i_i * (j_j+1); - // int jstart = j_j*32; - // int jend = (j_j+1)*32; - FOR_REDUCE_SUM_THIRD(k_k, i_i-1, j_j, lsum, { - lsum += hierTest3D(i_i-1,j_j,k_k); - // Kokkos::parallel_for( \ - //Kokkos::TeamThreadRange( teamMember, istart, iend ), [&] ( const int (j_j) ) { - // hierTest2D(i_i,j_j) = i_i * (j_j+1); - // int jstart = j_j*32; - // int jend = (j_j+1)*32; - }, result); - hierTest2D(i_i-1,j_j)= result; - printf("value at %d , %d is %f\n", i_i, j_j, hierTest2D(i_i-1,j_j)); - }); - }); - Kokkos::fence(); - for (int ppp = 0; ppp < hiersize; ppp++) { - //printf("%f\n", hierTest1D(ppp)); - // printf("%f\n", hierTest2D(3,ppp)); - // printf("%f\n", hierTest3D(3,3,ppp)); - } - printf("\n\n"); - } // end of kokkos scope Kokkos::finalize(); diff --git a/examples/test_set_values.cpp b/examples/test_set_values.cpp index b02a92d1..82d3f5d5 100644 --- a/examples/test_set_values.cpp +++ b/examples/test_set_values.cpp @@ -184,9 +184,7 @@ int main() Kokkos::initialize(); { DFArrayKokkos DFAtest (2, 3, 4); - DViewFArrayKokkos DVFAtest (&DFAtest(0, 0, 0), 3, 4); DFAtest.set_values(1.25); - DVFAtest.set_values(2.34); printf("DViewFArrayKokkos set_values 2.34 writing over DFArrayKokkos set_values 1.25.\n"); FOR_ALL(i, 0, 4, j, 0, 3, @@ -194,15 +192,8 @@ int main() printf("%.2f ", DFAtest(k,j,i)); }); printf("\n"); - FOR_ALL(i, 0, 4, - j, 0, 3,{ - printf("%.2f ", DVFAtest(j,i)); - }); - printf("\n"); DFMatrixKokkos DFMtest (2, 3, 4); - DViewFMatrixKokkos DVFMtest (&DFMtest(1, 1, 1), 3, 4); DFMtest.set_values(1.33); - DVFMtest.set_values(3.24); printf("DViewFMatrixKokkos set_values 3.24 writing over DFMatrixKokkos set_values 1.33.\n"); FOR_ALL(i, 1, 5, j, 1, 4, @@ -210,15 +201,8 @@ int main() printf("%.2f ", DFMtest(k,j,i)); }); printf("\n"); - FOR_ALL(i, 1, 5, - j, 1, 4,{ - printf("%.2f ", DVFMtest(j,i)); - }); - printf("\n"); DCArrayKokkos DCAtest (2, 3, 4); - DViewCArrayKokkos DVCAtest (&DCAtest(0, 0, 0), 3, 4); DCAtest.set_values(1.53); - DVCAtest.set_values(2.33); printf("DViewCArrayKokkos set_values 2.33 writing over DCArrayKokkos set_values 1.53.\n"); FOR_ALL(i, 0, 4, j, 0, 3, @@ -226,15 +210,8 @@ int main() printf("%.2f ", DCAtest(k,j,i)); }); printf("\n"); - FOR_ALL(i, 0, 4, - j, 0, 3,{ - printf("%.2f ", DVCAtest(j,i)); - }); - printf("\n"); DCMatrixKokkos DCMtest (2, 3, 4); - DViewCMatrixKokkos DVCMtest (&DCMtest(1, 1, 1), 3, 4); DCMtest.set_values(1.77); - DVCMtest.set_values(2.17); printf("DViewCMatrixKokkos set_values 2.17 writing over DCMatrixKokkos set_values 1.77.\n"); FOR_ALL(i, 1, 5, j, 1, 4, @@ -242,40 +219,51 @@ int main() printf("%.2f ", DCMtest(k,j,i)); }); printf("\n"); - FOR_ALL(i, 1, 5, - j, 1, 4,{ - printf("%.2f ", DVCMtest(j,i)); - }); - printf("\n"); DynamicRaggedRightArrayKokkos dynrightK (3,4); - dynrightK.stride(0) = 1; - dynrightK.stride(1) = 3; - dynrightK.stride(2) = 2; + //dynrightK.stride(0) = 1; + //dynrightK.stride(1) = 3; + //dynrightK.stride(2) = 2; + RUN({ + dynrightK.stride(0) = 1; + dynrightK.stride(1) = 3; + dynrightK.stride(2) = 2; + }); dynrightK.set_values(2.14); dynrightK.set_values_sparse(1.35); printf("The values within the populated strides of the DynamicRaggedRight are set to 1.35 and the data in the rest of the array is set to 2.14.\n"); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 4; j++) { - printf("%.2f ", dynrightK(i,j)); - } - printf("\n"); - } + FOR_FIRST(i, 0, 3, { + FOR_SECOND(j, 0, dynrightK.stride(i), { + //printf("%.2f ", dynrightK(i,j)); + }); + }); + printf("\n"); + //for (int i = 0; i < 3; i++) { + // for (int j = 0; j < 4; j++) { + //printf("%.2f ", dynrightK(i,j)); + // } + //printf("\n"); + //} DynamicRaggedDownArrayKokkos dyndownK (3,4); - dyndownK.stride(0) = 1; - dyndownK.stride(1) = 3; - dyndownK.stride(2) = 2; - dyndownK.stride(3) = 1; + RUN({ + dyndownK.stride(0) = 1; + dyndownK.stride(1) = 3; + dyndownK.stride(2) = 2; + dyndownK.stride(3) = 1; + }); dyndownK.set_values(2.14); dyndownK.set_values_sparse(1.35); printf("The values within the populated strides of the DynamicRaggedDown are set to 1.35 and the data in the rest of the array is set to 2.14.\n"); - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 4; j++) { - printf("%.2f ", dyndownK(i,j)); - } - printf("\n"); - } - + FOR_FIRST(i, 0, 4, { + FOR_SECOND(j, 0, dyndownK.stride(i), { + //printf("%.2f ", dyndownK(i,j)); + }); + }); + printf("\n"); + //for (int i = 0; i < 4; i++) { + // for (int j = 0; j < 3; j++) { + // } + //} } Kokkos::finalize(); } diff --git a/scripts/matar-install.sh b/scripts/matar-install.sh index ad2b0bf6..b1ef7def 100644 --- a/scripts/matar-install.sh +++ b/scripts/matar-install.sh @@ -22,7 +22,7 @@ fi if [[ "$kokkos_build_type" = *"mpi"* ]]; then cmake_options+=( - -D MPI=ON + -D Matar_ENABLE_MPI=ON ) fi diff --git a/src/Kokkos/kokkos b/src/Kokkos/kokkos index 71a9bcae..cbcf4cf1 160000 --- a/src/Kokkos/kokkos +++ b/src/Kokkos/kokkos @@ -1 +1 @@ -Subproject commit 71a9bcae52543bd065522bf3e41b5bfa467d8015 +Subproject commit cbcf4cf10f1454fa71b433fb840b683abf09b457 diff --git a/src/include/kokkos_types.h b/src/include/kokkos_types.h index 514da94f..3a923b36 100644 --- a/src/include/kokkos_types.h +++ b/src/include/kokkos_types.h @@ -231,7 +231,6 @@ class FArrayKokkos { T* pointer() const; // set values - KOKKOS_INLINE_FUNCTION void set_values(T val); //return kokkos view @@ -543,7 +542,6 @@ const std::string FArrayKokkos::get_name() cons // set values of array template -KOKKOS_INLINE_FUNCTION void FArrayKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_FArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { this_array_(i) = val; @@ -642,7 +640,6 @@ class ViewFArrayKokkos { T* pointer() const; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); KOKKOS_INLINE_FUNCTION @@ -895,7 +892,6 @@ T* ViewFArrayKokkos::pointer() const { } template -KOKKOS_INLINE_FUNCTION void ViewFArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ this_array_(i) = val; @@ -989,7 +985,6 @@ class FMatrixKokkos { T* pointer() const; // set values - KOKKOS_INLINE_FUNCTION void set_values(T val); //return kokkos view @@ -1284,7 +1279,6 @@ const std::string FMatrixKokkos::get_name() con // set values of array template -KOKKOS_INLINE_FUNCTION void FMatrixKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_FMatrixKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { this_matrix_(i) = val; @@ -1384,7 +1378,6 @@ class ViewFMatrixKokkos { T* pointer() const; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); KOKKOS_INLINE_FUNCTION @@ -1640,7 +1633,6 @@ T* ViewFMatrixKokkos::pointer() const { } template -KOKKOS_INLINE_FUNCTION void ViewFMatrixKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ this_matrix_(i) = val; @@ -1754,7 +1746,6 @@ class DFArrayKokkos { // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -2061,10 +2052,9 @@ const std::string DFArrayKokkos::get_name() con } template -KOKKOS_INLINE_FUNCTION void DFArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_array_.h_view(i) = val; + this_array_.d_view(i) = val; }); } @@ -2182,7 +2172,6 @@ class DViewFArrayKokkos { // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -2536,10 +2525,9 @@ const std::string DViewFArrayKokkos::get_name() } template -KOKKOS_INLINE_FUNCTION void DViewFArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_array_host_(i) = val; + this_array_(i) = val; }); } @@ -2647,7 +2635,6 @@ class DFMatrixKokkos { // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -2954,10 +2941,9 @@ const std::string DFMatrixKokkos::get_name() co } template -KOKKOS_INLINE_FUNCTION void DFMatrixKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_matrix_.h_view(i) = val; + this_matrix_.d_view(i) = val; }); } @@ -3070,7 +3056,6 @@ class DViewFMatrixKokkos { // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -3415,10 +3400,9 @@ const std::string DViewFMatrixKokkos::get_name( template -KOKKOS_INLINE_FUNCTION void DViewFMatrixKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_matrix_host_(i) = val; + this_matrix_(i) = val; }); } @@ -3511,7 +3495,6 @@ class CArrayKokkos { T* pointer() const; // set values - KOKKOS_INLINE_FUNCTION void set_values(T val); //return the view @@ -3802,7 +3785,6 @@ const std::string CArrayKokkos::get_name() cons // set values of array template -KOKKOS_INLINE_FUNCTION void CArrayKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_CArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { this_array_(i) = val; @@ -3900,7 +3882,6 @@ class ViewCArrayKokkos { T* pointer() const; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); KOKKOS_INLINE_FUNCTION @@ -4151,7 +4132,6 @@ T* ViewCArrayKokkos::pointer() const { } template -KOKKOS_INLINE_FUNCTION void ViewCArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ this_array_(i) = val; @@ -4244,7 +4224,6 @@ class CMatrixKokkos { T* pointer() const; // set values - KOKKOS_INLINE_FUNCTION void set_values(T val); //return the view @@ -4541,7 +4520,6 @@ const std::string CMatrixKokkos::get_name() con // set values of array template -KOKKOS_INLINE_FUNCTION void CMatrixKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_CMatrixKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { this_matrix_(i) = val; @@ -4635,7 +4613,6 @@ class ViewCMatrixKokkos { T* pointer() const; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); KOKKOS_INLINE_FUNCTION @@ -4883,7 +4860,6 @@ T* ViewCMatrixKokkos::pointer() const { } template -KOKKOS_INLINE_FUNCTION void ViewCMatrixKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ this_matrix_(i) = val; @@ -5003,7 +4979,6 @@ class DCArrayKokkos { void update_device(); // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Deconstructor @@ -5311,10 +5286,9 @@ void DCArrayKokkos::update_device() { } template -KOKKOS_INLINE_FUNCTION void DCArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_array_.h_view(i) = val; + this_array_.d_view(i) = val; }); } @@ -5428,7 +5402,6 @@ class DViewCArrayKokkos { // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -5782,10 +5755,9 @@ void DViewCArrayKokkos::update_device() { } template -KOKKOS_INLINE_FUNCTION void DViewCArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_array_host_(i) = val; + this_array_(i) = val; }); } @@ -5898,7 +5870,6 @@ class DCMatrixKokkos { void update_device(); // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -6205,10 +6176,9 @@ const std::string DCMatrixKokkos::get_name() co } template -KOKKOS_INLINE_FUNCTION void DCMatrixKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_matrix_.h_view(i) = val; + this_matrix_.d_view(i) = val; }); } @@ -6320,7 +6290,6 @@ class DViewCMatrixKokkos { void update_device(); // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Get the name of the view @@ -6663,10 +6632,9 @@ const std::string DViewCMatrixKokkos::get_name( } template -KOKKOS_INLINE_FUNCTION void DViewCMatrixKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ - this_matrix_host_(i) = val; + this_matrix_(i) = val; }); } @@ -6675,191 +6643,1082 @@ KOKKOS_INLINE_FUNCTION DViewCMatrixKokkos::~DViewCMatrixKokkos() {} // End DViewCMatrixKokkos - -/*! \brief Kokkos version of the serial RaggedRightArray class. +/*! \brief Dynamic version of the CArrayKokkos type. * */ -template -class RaggedRightArrayKokkos { +template +class DynamicArrayKokkos { using TArray1D = Kokkos::View; - using SArray1D = Kokkos::View; - using Strides1D = Kokkos::View; private: - TArray1D array_; - - size_t dim1_; + size_t dims_[7]; + size_t dims_actual_size_[7]; + size_t order_; size_t length_; - + TArray1D this_array_; + public: - // Default constructor - RaggedRightArrayKokkos(); - - //--- 2D array access of a ragged right array --- + DynamicArrayKokkos(); - // Overload constructor for a CArrayKokkos - RaggedRightArrayKokkos(CArrayKokkos &strides_array, const std::string& tag_string = DEFAULTSTRINGARRAY); + DynamicArrayKokkos(size_t dim0, const std::string& tag_string = DEFAULTSTRINGARRAY); - // Overload constructor for a DCArrayKokkos - RaggedRightArrayKokkos(DCArrayKokkos &strides_array, const std::string& tag_string = DEFAULTSTRINGARRAY); - - // Overload constructor for a ViewCArray - RaggedRightArrayKokkos(ViewCArray &strides_array, const std::string& tag_string = DEFAULTSTRINGARRAY); - - // Overloaded constructor for a traditional array - RaggedRightArrayKokkos(size_t* strides_array, size_t some_dim1, const std::string& tag_string = DEFAULTSTRINGARRAY); - - // A method to return the stride size KOKKOS_INLINE_FUNCTION - size_t stride(size_t i) const; + T& operator()(size_t i) const; - // Host method to return the stride size - size_t stride_host(size_t i) const; +/* + DynamicArrayKokkos(size_t dim0, size_t dim1, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicArrayKokkos (size_t dim0, size_t dim1, size_t dim2, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicArrayKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicArrayKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, size_t dim4, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicArrayKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, size_t dim4, size_t dim5, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicArrayKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, size_t dim4, size_t dim5, + size_t dim6, const std::string& tag_string = DEFAULTSTRINGARRAY); - // A method to increase the number of column entries, i.e., - // the stride size. Used with the constructor for building - // the stride_array dynamically. - // DO NOT USE with the constructures with a strides_array KOKKOS_INLINE_FUNCTION - size_t& build_stride(const size_t i) const; - + T& operator()(size_t i, size_t j) const; + KOKKOS_INLINE_FUNCTION - void stride_finalize() const; - - // Overload operator() to access data as array(i,j) - // where i=[0:N-1], j=[stride(i)] + T& operator()(size_t i, size_t j, size_t k) const; + KOKKOS_INLINE_FUNCTION - T& operator()(size_t i, size_t j) const; + T& operator()(size_t i, size_t j, size_t k, size_t l) const; - // method to return total size KOKKOS_INLINE_FUNCTION - size_t size(){ - return length_; - } - - //setup start indices - void data_setup(const std::string& tag_string); - - //return pointer + T& operator()(size_t i, size_t j, size_t k, size_t l, size_t m) const; + KOKKOS_INLINE_FUNCTION - T* pointer(); + T& operator()(size_t i, size_t j, size_t k, size_t l, size_t m, + size_t n) const; - //return the view KOKKOS_INLINE_FUNCTION - TArray1D get_kokkos_view(); - - //print values - void print() const; + T& operator()(size_t i, size_t j, size_t k, size_t l, size_t m, + size_t n, size_t o) const; +*/ - //set values to input KOKKOS_INLINE_FUNCTION - void set_values(T val); + DynamicArrayKokkos& operator=(const DynamicArrayKokkos& temp); - // Get the name of the view + // GPU Method + // Method that returns size KOKKOS_INLINE_FUNCTION - const std::string get_name() const; + size_t size() const; - // Kokkos views of strides and start indices - Strides1D mystrides_; - SArray1D start_index_; - + // Host Method + // Method that returns size KOKKOS_INLINE_FUNCTION - RaggedRightArrayKokkos& operator= (const RaggedRightArrayKokkos &temp); + size_t extent() const; - //initialize start indices view - class init_start_indices_functor{ - public: - SArray1D mystart_index_; - init_start_indices_functor(SArray1D tempstart_index_){ - mystart_index_ = tempstart_index_; - } - KOKKOS_INLINE_FUNCTION void operator()(const int index) const { - mystart_index_(index) = 0; - } - }; + KOKKOS_INLINE_FUNCTION + size_t dims(size_t i) const; - //setup start indices view - class setup_start_indices_functor{ - public: - SArray1D mystart_index_; - Strides1D mytemp_strides_; - setup_start_indices_functor(SArray1D tempstart_index_, Strides1D temp_strides_){ - mystart_index_ = tempstart_index_; - mytemp_strides_ = temp_strides_; - } - KOKKOS_INLINE_FUNCTION void operator()(const int index, int& update, bool final) const { - // Load old value in case we update it before accumulating - const size_t count = mytemp_strides_(index); - update += count; - if (final) { - mystart_index_((index+1)) = update; - } - } - }; + KOKKOS_INLINE_FUNCTION + size_t dims_max(size_t i) const; - //setup length of view - class setup_length_functor{ - public: - //kokkos needs this typedef named - typedef size_t value_type; - // This is helpful for determining the right index type, - // especially if you expect to need a 64-bit index. - //typedef Kokkos::View::size_type size_type; - Strides1D mytemp_strides_; - setup_length_functor(Strides1D temp_strides_){ - mytemp_strides_ = temp_strides_; - } - KOKKOS_INLINE_FUNCTION void operator()(const int index, size_t& update) const { - //const size_t count = mytemp_strides_(index); - update += mytemp_strides_(index); - } - }; + KOKKOS_INLINE_FUNCTION + size_t order() const; + + void push_back(T value); + + void pop(); + + // Methods returns the raw pointer (most likely GPU) of the Kokkos View + KOKKOS_INLINE_FUNCTION + T* pointer() const; - //sets final 1D array size - class finalize_stride_functor{ - public: - SArray1D mystart_index_; - finalize_stride_functor(SArray1D tempstart_index_){ - mystart_index_ = tempstart_index_; - } - KOKKOS_INLINE_FUNCTION void operator()(const int index, int& update, bool final) const { - // Load old value in case we update it before accumulating - const size_t count = mystart_index_(index+1); - update += count; - if (final) { - mystart_index_((index+1)) = update; - } - } - }; + // set values + void set_values(T val); + + //return the view + KOKKOS_INLINE_FUNCTION + TArray1D get_kokkos_view() const; - // Destructor + // Get the name of the view KOKKOS_INLINE_FUNCTION - ~RaggedRightArrayKokkos ( ); -}; // End of RaggedRightArray + const std::string get_name() const; -template -RaggedRightArrayKokkos::RaggedRightArrayKokkos() { - dim1_ = length_ = 0; + // Deconstructor + KOKKOS_INLINE_FUNCTION + ~DynamicArrayKokkos (); +}; // End of DynamicArrayKokkos + +// Default constructor +template +DynamicArrayKokkos::DynamicArrayKokkos() { + length_ = order_ = 0; + for (int i = 0; i < 7; i++) { + dims_[i] = 0; + dims_actual_size_[i] = 0; + } } -// Overloaded constructor -template -RaggedRightArrayKokkos::RaggedRightArrayKokkos(CArrayKokkos &strides_array, - const std::string& tag_string) { - mystrides_ = strides_array.get_kokkos_view(); - dim1_ = strides_array.extent(); - data_setup(tag_string); -} // End constructor +// Overloaded 1D constructor +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + for (int i = 0; i < 1; i++) { + dims_actual_size_[i] = 0; + } + order_ = 1; + length_ = dim0; + this_array_ = TArray1D(tag_string, length_); +} -// Overloaded constructor -template -RaggedRightArrayKokkos::RaggedRightArrayKokkos(DCArrayKokkos &strides_array, - const std::string& tag_string) { - mystrides_ = strides_array.get_kokkos_dual_view().d_view; - dim1_ = strides_array.extent(); - data_setup(tag_string); +/* +// Overloaded 2D constructor +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, size_t dim1, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + for (int i = 0; i < 2; i++) { + dims_actual_size_[i] = 0; + } + order_ = 2; + length_ = (dim0 * dim1); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, size_t dim1, + size_t dim2, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + for (int i = 0; i < 3; i++) { + dims_actual_size_[i] = 0; + } + order_ = 3; + length_ = (dim0 * dim1 * dim2); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + for (int i = 0; i < 4; i++) { + dims_actual_size_[i] = 0; + } + order_ = 4; + length_ = (dim0 * dim1 * dim2 * dim3); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, + size_t dim4, const std::string& tag_string) { + + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + dims_[4] = dim4; + for (int i = 0; i < 5; i++) { + dims_actual_size_[i] = 0; + } + order_ = 5; + length_ = (dim0 * dim1 * dim2 * dim3 * dim4); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, + size_t dim4, size_t dim5, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + dims_[4] = dim4; + dims_[5] = dim5; + for (int i = 0; i < 6; i++) { + dims_actual_size_[i] = 0; + } + order_ = 6; + length_ = (dim0 * dim1 * dim2 * dim3 * dim4 * dim5); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicArrayKokkos::DynamicArrayKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, + size_t dim4, size_t dim5, + size_t dim6, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + dims_[4] = dim4; + dims_[5] = dim5; + dims_[6] = dim6; + for (int i = 0; i < 7; i++) { + dims_actual_size_[i] = 0; + } + order_ = 7; + length_ = (dim0 * dim1 * dim2 * dim3 * dim4 * dim5 * dim6); + this_array_ = TArray1D(tag_string, length_); +} +*/ + +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i) const { + assert(order_ == 1 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 1D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 1D!"); + return this_array_(i); +} + +/* +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i, size_t j) const { + assert(order_ == 2 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 2D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 2D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicArrayKokkos 2D!"); + return this_array_(j + (i * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i, size_t j, size_t k) const { + assert(order_ == 3 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 3D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 3D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicArrayKokkos 3D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicArrayKokkos 3D!"); + return this_array_(k + (j * dims_[2]) + + (i * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i, size_t j, size_t k, size_t l) const { + assert(order_ == 4 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 4D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 4D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicArrayKokkos 4D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicArrayKokkos 4D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicArrayKokkos 4D!"); + return this_array_(l + (k * dims_[3]) + + (j * dims_[3] * dims_[2]) + + (i * dims_[3] * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i, size_t j, size_t k, size_t l, + size_t m) const { + assert(order_ == 5 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 5D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 5D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicArrayKokkos 5D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicArrayKokkos 5D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicArrayKokkos 5D!"); + assert(m >= 0 && m < dims_[4] && "m is out of bounds in DynamicArrayKokkos 5D!"); + return this_array_(m + (l * dims_[4]) + + (k * dims_[4] * dims_[3]) + + (j * dims_[4] * dims_[3] * dims_[2]) + + (i * dims_[4] * dims_[3] * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i, size_t j, size_t k, size_t l, + size_t m, size_t n) const { + assert(order_ == 6 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 6D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 6D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicArrayKokkos 6D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicArrayKokkos 6D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicArrayKokkos 6D!"); + assert(m >= 0 && m < dims_[4] && "m is out of bounds in DynamicArrayKokkos 6D!"); + assert(n >= 0 && n < dims_[5] && "n is out of bounds in DynamicArrayKokkos 6D!"); + return this_array_(n + (m * dims_[5]) + + (l * dims_[5] * dims_[4]) + + (k * dims_[5] * dims_[4] * dims_[3]) + + (j * dims_[5] * dims_[4] * dims_[3] * dims_[2]) + + (i * dims_[5] * dims_[4] * dims_[3] * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicArrayKokkos::operator()(size_t i, size_t j, size_t k, size_t l, + size_t m, size_t n, size_t o) const { + assert(order_ == 7 && "Tensor order (rank) does not match constructor in DynamicArrayKokkos 7D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicArrayKokkos 7D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicArrayKokkos 7D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicArrayKokkos 7D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicArrayKokkos 7D!"); + assert(m >= 0 && m < dims_[4] && "m is out of bounds in DynamicArrayKokkos 7D!"); + assert(n >= 0 && n < dims_[5] && "n is out of bounds in DynamicArrayKokkos 7D!"); + assert(o >= 0 && o < dims_[6] && "o is out of bounds in DynamicArrayKokkos 7D!"); + return this_array_(o + (n * dims_[6]) + + (m * dims_[6] * dims_[5]) + + (l * dims_[6] * dims_[5] * dims_[4]) + + (k * dims_[6] * dims_[5] * dims_[4] * dims_[3]) + + (j * dims_[6] * dims_[5] * dims_[4] * dims_[3] * dims_[2]) + + (i * dims_[6] * dims_[5] * dims_[4] * dims_[3] * dims_[2] * dims_[1])); +} +*/ + +template +KOKKOS_INLINE_FUNCTION +DynamicArrayKokkos& DynamicArrayKokkos::operator= (const DynamicArrayKokkos& temp) { + using TArray1D = Kokkos::View; + + // Do nothing if the assignment is of the form x = x + if (this != &temp) { + for (int iter = 0; iter < temp.order_; iter++){ + dims_[iter] = temp.dims_[iter]; + dims_actual_size_[iter] = temp.dims_actual_size_[iter]; + } // end for + + order_ = temp.order_; + length_ = temp.length_; + this_array_ = temp.this_array_; + } + + return *this; +} + +// Return size +template +KOKKOS_INLINE_FUNCTION +size_t DynamicArrayKokkos::size() const { + return length_; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicArrayKokkos::extent() const { + return length_; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicArrayKokkos::dims(size_t i) const { + assert(i < order_ && "DynamicArrayKokkos order (rank) does not match constructor, dim[i] does not exist!"); + assert(i >= 0 && dims_actual_size_[i]>0 && "Access to DynamicArrayKokkos dims is out of bounds!"); + return dims_actual_size_[i]; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicArrayKokkos::dims_max(size_t i) const { + assert(i < order_ && "DynamicArrayKokkos order (rank) does not match constructor, dim[i] does not exist!"); + assert(i >= 0 && dims_[i]>0 && "Access to DynamicArrayKokkos dims is out of bounds!"); + return dims_[i]; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicArrayKokkos::order() const { + return order_; +} + +template +void DynamicArrayKokkos::pop() { + dims_actual_size_[0]--; +} + +template +void DynamicArrayKokkos::push_back(T value) { + size_t idx = dims_actual_size_[0]; + Kokkos::parallel_for("pushback_DynamicArrayKokkos", 1, KOKKOS_CLASS_LAMBDA(const int i) { + this_array_(idx) = value; + }); + dims_actual_size_[0]++; +} + +template +KOKKOS_INLINE_FUNCTION +T* DynamicArrayKokkos::pointer() const { + return this_array_.data(); +} + +//return the stored Kokkos view +template +KOKKOS_INLINE_FUNCTION +Kokkos::View DynamicArrayKokkos::get_kokkos_view() const { + return this_array_; +} + +// Get the name of the view +template +KOKKOS_INLINE_FUNCTION +const std::string DynamicArrayKokkos::get_name() const{ + return this_array_.label(); +} + +// set values of array +template +void DynamicArrayKokkos::set_values(T val) { + Kokkos::parallel_for("SetValues_DynamicArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { + this_array_(i) = val; + }); +} + +template +KOKKOS_INLINE_FUNCTION +DynamicArrayKokkos::~DynamicArrayKokkos() {} + +//////////////////////////////////////////////////////////////////////////////// +// End of DynamicArrayKokkos +//////////////////////////////////////////////////////////////////////////////// + +/*! \brief Dynamic version of the CMatrixKokkos type. + * + */ +template +class DynamicMatrixKokkos { + + using TArray1D = Kokkos::View; + +private: + size_t dims_[7]; + size_t dims_actual_size_[7]; + size_t order_; + size_t length_; + TArray1D this_array_; + +public: + DynamicMatrixKokkos(); + + DynamicMatrixKokkos(size_t dim0, const std::string& tag_string = DEFAULTSTRINGARRAY); + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i) const; + +/* + DynamicMatrixKokkos(size_t dim0, size_t dim1, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicMatrixKokkos (size_t dim0, size_t dim1, size_t dim2, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicMatrixKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicMatrixKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, size_t dim4, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicMatrixKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, size_t dim4, size_t dim5, const std::string& tag_string = DEFAULTSTRINGARRAY); + + DynamicMatrixKokkos(size_t dim0, size_t dim1, size_t dim2, + size_t dim3, size_t dim4, size_t dim5, + size_t dim6, const std::string& tag_string = DEFAULTSTRINGARRAY); + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j) const; + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j, size_t k) const; + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j, size_t k, size_t l) const; + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j, size_t k, size_t l, size_t m) const; + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j, size_t k, size_t l, size_t m, + size_t n) const; + + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j, size_t k, size_t l, size_t m, + size_t n, size_t o) const; +*/ + + KOKKOS_INLINE_FUNCTION + DynamicMatrixKokkos& operator=(const DynamicMatrixKokkos& temp); + + // GPU Method + // Method that returns size + KOKKOS_INLINE_FUNCTION + size_t size() const; + + // Host Method + // Method that returns size + KOKKOS_INLINE_FUNCTION + size_t extent() const; + + KOKKOS_INLINE_FUNCTION + size_t dims(size_t i) const; + + KOKKOS_INLINE_FUNCTION + size_t dims_max(size_t i) const; + + KOKKOS_INLINE_FUNCTION + size_t order() const; + + void push_back(T value); + + void pop(); + + // Methods returns the raw pointer (most likely GPU) of the Kokkos View + KOKKOS_INLINE_FUNCTION + T* pointer() const; + + // set values + void set_values(T val); + + //return the view + KOKKOS_INLINE_FUNCTION + TArray1D get_kokkos_view() const; + + // Get the name of the view + KOKKOS_INLINE_FUNCTION + const std::string get_name() const; + + // Deconstructor + KOKKOS_INLINE_FUNCTION + ~DynamicMatrixKokkos (); +}; // End of DynamicMatrixKokkos + +// Default constructor +template +DynamicMatrixKokkos::DynamicMatrixKokkos() { + length_ = order_ = 0; + for (int i = 0; i < 7; i++) { + dims_[i] = 0; + dims_actual_size_[i] = 0; + } +} + +// Overloaded 1D constructor +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + for (int i = 0; i < 1; i++) { + dims_actual_size_[i] = 0; + } + order_ = 1; + length_ = dim0; + this_array_ = TArray1D(tag_string, length_); +} + +/* +// Overloaded 2D constructor +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, size_t dim1, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + for (int i = 0; i < 2; i++) { + dims_actual_size_[i] = 0; + } + order_ = 2; + length_ = (dim0 * dim1); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, size_t dim1, + size_t dim2, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + for (int i = 0; i < 3; i++) { + dims_actual_size_[i] = 0; + } + order_ = 3; + length_ = (dim0 * dim1 * dim2); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + for (int i = 0; i < 4; i++) { + dims_actual_size_[i] = 0; + } + order_ = 4; + length_ = (dim0 * dim1 * dim2 * dim3); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, + size_t dim4, const std::string& tag_string) { + + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + dims_[4] = dim4; + for (int i = 0; i < 5; i++) { + dims_actual_size_[i] = 0; + } + order_ = 5; + length_ = (dim0 * dim1 * dim2 * dim3 * dim4); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, + size_t dim4, size_t dim5, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + dims_[4] = dim4; + dims_[5] = dim5; + for (int i = 0; i < 6; i++) { + dims_actual_size_[i] = 0; + } + order_ = 6; + length_ = (dim0 * dim1 * dim2 * dim3 * dim4 * dim5); + this_array_ = TArray1D(tag_string, length_); +} + +template +DynamicMatrixKokkos::DynamicMatrixKokkos(size_t dim0, size_t dim1, + size_t dim2, size_t dim3, + size_t dim4, size_t dim5, + size_t dim6, const std::string& tag_string) { + using TArray1D = Kokkos::View; + + dims_[0] = dim0; + dims_[1] = dim1; + dims_[2] = dim2; + dims_[3] = dim3; + dims_[4] = dim4; + dims_[5] = dim5; + dims_[6] = dim6; + for (int i = 0; i < 7; i++) { + dims_actual_size_[i] = 0; + } + order_ = 7; + length_ = (dim0 * dim1 * dim2 * dim3 * dim4 * dim5 * dim6); + this_array_ = TArray1D(tag_string, length_); +} +*/ + +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i) const { + assert(order_ == 1 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 1D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 1D!"); + return this_array_((i-1)); +} + +/* +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i, size_t j) const { + assert(order_ == 2 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 2D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 2D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicMatrixKokkos 2D!"); + return this_array_(j + (i * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i, size_t j, size_t k) const { + assert(order_ == 3 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 3D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 3D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicMatrixKokkos 3D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicMatrixKokkos 3D!"); + return this_array_(k + (j * dims_[2]) + + (i * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i, size_t j, size_t k, size_t l) const { + assert(order_ == 4 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 4D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 4D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicMatrixKokkos 4D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicMatrixKokkos 4D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicMatrixKokkos 4D!"); + return this_array_(l + (k * dims_[3]) + + (j * dims_[3] * dims_[2]) + + (i * dims_[3] * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i, size_t j, size_t k, size_t l, + size_t m) const { + assert(order_ == 5 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 5D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 5D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicMatrixKokkos 5D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicMatrixKokkos 5D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicMatrixKokkos 5D!"); + assert(m >= 0 && m < dims_[4] && "m is out of bounds in DynamicMatrixKokkos 5D!"); + return this_array_(m + (l * dims_[4]) + + (k * dims_[4] * dims_[3]) + + (j * dims_[4] * dims_[3] * dims_[2]) + + (i * dims_[4] * dims_[3] * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i, size_t j, size_t k, size_t l, + size_t m, size_t n) const { + assert(order_ == 6 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 6D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 6D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicMatrixKokkos 6D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicMatrixKokkos 6D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicMatrixKokkos 6D!"); + assert(m >= 0 && m < dims_[4] && "m is out of bounds in DynamicMatrixKokkos 6D!"); + assert(n >= 0 && n < dims_[5] && "n is out of bounds in DynamicMatrixKokkos 6D!"); + return this_array_(n + (m * dims_[5]) + + (l * dims_[5] * dims_[4]) + + (k * dims_[5] * dims_[4] * dims_[3]) + + (j * dims_[5] * dims_[4] * dims_[3] * dims_[2]) + + (i * dims_[5] * dims_[4] * dims_[3] * dims_[2] * dims_[1])); +} + +template +KOKKOS_INLINE_FUNCTION +T& DynamicMatrixKokkos::operator()(size_t i, size_t j, size_t k, size_t l, + size_t m, size_t n, size_t o) const { + assert(order_ == 7 && "Tensor order (rank) does not match constructor in DynamicMatrixKokkos 7D!"); + assert(i >= 0 && i < dims_[0] && "i is out of bounds in DynamicMatrixKokkos 7D!"); + assert(j >= 0 && j < dims_[1] && "j is out of bounds in DynamicMatrixKokkos 7D!"); + assert(k >= 0 && k < dims_[2] && "k is out of bounds in DynamicMatrixKokkos 7D!"); + assert(l >= 0 && l < dims_[3] && "l is out of bounds in DynamicMatrixKokkos 7D!"); + assert(m >= 0 && m < dims_[4] && "m is out of bounds in DynamicMatrixKokkos 7D!"); + assert(n >= 0 && n < dims_[5] && "n is out of bounds in DynamicMatrixKokkos 7D!"); + assert(o >= 0 && o < dims_[6] && "o is out of bounds in DynamicMatrixKokkos 7D!"); + return this_array_(o + (n * dims_[6]) + + (m * dims_[6] * dims_[5]) + + (l * dims_[6] * dims_[5] * dims_[4]) + + (k * dims_[6] * dims_[5] * dims_[4] * dims_[3]) + + (j * dims_[6] * dims_[5] * dims_[4] * dims_[3] * dims_[2]) + + (i * dims_[6] * dims_[5] * dims_[4] * dims_[3] * dims_[2] * dims_[1])); +} +*/ + +template +KOKKOS_INLINE_FUNCTION +DynamicMatrixKokkos& DynamicMatrixKokkos::operator= (const DynamicMatrixKokkos& temp) { + using TArray1D = Kokkos::View; + + // Do nothing if the assignment is of the form x = x + if (this != &temp) { + for (int iter = 0; iter < temp.order_; iter++){ + dims_[iter] = temp.dims_[iter]; + dims_actual_size_[iter] = temp.dims_actual_size_[iter]; + } // end for + + order_ = temp.order_; + length_ = temp.length_; + this_array_ = temp.this_array_; + } + + return *this; +} + +// Return size +template +KOKKOS_INLINE_FUNCTION +size_t DynamicMatrixKokkos::size() const { + return length_; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicMatrixKokkos::extent() const { + return length_; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicMatrixKokkos::dims(size_t i) const { + assert(i < order_ && "DynamicMatrixKokkos order (rank) does not match constructor, dim[i] does not exist!"); + assert(i >= 0 && dims_actual_size_[i]>0 && "Access to DynamicMatrixKokkos dims is out of bounds!"); + return dims_actual_size_[i]; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicMatrixKokkos::dims_max(size_t i) const { + assert(i < order_ && "DynamicMatrixKokkos order (rank) does not match constructor, dim[i] does not exist!"); + assert(i >= 0 && dims_[i]>0 && "Access to DynamicMatrixKokkos dims is out of bounds!"); + return dims_[i]; +} + +template +KOKKOS_INLINE_FUNCTION +size_t DynamicMatrixKokkos::order() const { + return order_; +} + +template +void DynamicMatrixKokkos::pop() { + dims_actual_size_[0]--; +} + +template +void DynamicMatrixKokkos::push_back(T value) { + size_t idx = dims_actual_size_[0]; + Kokkos::parallel_for("pushback_DynamicMatrixKokkos", 1, KOKKOS_CLASS_LAMBDA(const int i) { + this_array_(idx) = value; + }); + dims_actual_size_[0]++; +} + +template +KOKKOS_INLINE_FUNCTION +T* DynamicMatrixKokkos::pointer() const { + return this_array_.data(); +} + +//return the stored Kokkos view +template +KOKKOS_INLINE_FUNCTION +Kokkos::View DynamicMatrixKokkos::get_kokkos_view() const { + return this_array_; +} + +// Get the name of the view +template +KOKKOS_INLINE_FUNCTION +const std::string DynamicMatrixKokkos::get_name() const{ + return this_array_.label(); +} + +// set values of array +template +void DynamicMatrixKokkos::set_values(T val) { + Kokkos::parallel_for("SetValues_DynamicMatrixKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { + this_array_(i) = val; + }); +} + +template +KOKKOS_INLINE_FUNCTION +DynamicMatrixKokkos::~DynamicMatrixKokkos() {} + +//////////////////////////////////////////////////////////////////////////////// +// End of DynamicMatrixKokkos +//////////////////////////////////////////////////////////////////////////////// + + +/*! \brief Kokkos version of the serial RaggedRightArray class. + * + */ +template +class RaggedRightArrayKokkos { + + using TArray1D = Kokkos::View; + using SArray1D = Kokkos::View; + using Strides1D = Kokkos::View; + +private: + TArray1D array_; + + size_t dim1_; + size_t length_; + +public: + // Default constructor + RaggedRightArrayKokkos(); + + //--- 2D array access of a ragged right array --- + + // Overload constructor for a CArrayKokkos + RaggedRightArrayKokkos(CArrayKokkos &strides_array, const std::string& tag_string = DEFAULTSTRINGARRAY); + + // Overload constructor for a DCArrayKokkos + RaggedRightArrayKokkos(DCArrayKokkos &strides_array, const std::string& tag_string = DEFAULTSTRINGARRAY); + + // Overload constructor for a ViewCArray + RaggedRightArrayKokkos(ViewCArray &strides_array, const std::string& tag_string = DEFAULTSTRINGARRAY); + + // Overloaded constructor for a traditional array + RaggedRightArrayKokkos(size_t* strides_array, size_t some_dim1, const std::string& tag_string = DEFAULTSTRINGARRAY); + + // A method to return the stride size + KOKKOS_INLINE_FUNCTION + size_t stride(size_t i) const; + + // Host method to return the stride size + size_t stride_host(size_t i) const; + + // A method to increase the number of column entries, i.e., + // the stride size. Used with the constructor for building + // the stride_array dynamically. + // DO NOT USE with the constructures with a strides_array + KOKKOS_INLINE_FUNCTION + size_t& build_stride(const size_t i) const; + + KOKKOS_INLINE_FUNCTION + void stride_finalize() const; + + // Overload operator() to access data as array(i,j) + // where i=[0:N-1], j=[stride(i)] + KOKKOS_INLINE_FUNCTION + T& operator()(size_t i, size_t j) const; + + // method to return total size + KOKKOS_INLINE_FUNCTION + size_t size(){ + return length_; + } + + //setup start indices + void data_setup(const std::string& tag_string); + + //return pointer + KOKKOS_INLINE_FUNCTION + T* pointer(); + + //return the view + KOKKOS_INLINE_FUNCTION + TArray1D get_kokkos_view(); + + //print values + void print() const; + + //set values to input + void set_values(T val); + + // Get the name of the view + KOKKOS_INLINE_FUNCTION + const std::string get_name() const; + + // Kokkos views of strides and start indices + Strides1D mystrides_; + SArray1D start_index_; + + KOKKOS_INLINE_FUNCTION + RaggedRightArrayKokkos& operator= (const RaggedRightArrayKokkos &temp); + + //initialize start indices view + class init_start_indices_functor{ + public: + SArray1D mystart_index_; + init_start_indices_functor(SArray1D tempstart_index_){ + mystart_index_ = tempstart_index_; + } + KOKKOS_INLINE_FUNCTION void operator()(const int index) const { + mystart_index_(index) = 0; + } + }; + + //setup start indices view + class setup_start_indices_functor{ + public: + SArray1D mystart_index_; + Strides1D mytemp_strides_; + setup_start_indices_functor(SArray1D tempstart_index_, Strides1D temp_strides_){ + mystart_index_ = tempstart_index_; + mytemp_strides_ = temp_strides_; + } + KOKKOS_INLINE_FUNCTION void operator()(const int index, int& update, bool final) const { + // Load old value in case we update it before accumulating + const size_t count = mytemp_strides_(index); + update += count; + if (final) { + mystart_index_((index+1)) = update; + } + } + }; + + //setup length of view + class setup_length_functor{ + public: + //kokkos needs this typedef named + typedef size_t value_type; + // This is helpful for determining the right index type, + // especially if you expect to need a 64-bit index. + //typedef Kokkos::View::size_type size_type; + Strides1D mytemp_strides_; + setup_length_functor(Strides1D temp_strides_){ + mytemp_strides_ = temp_strides_; + } + KOKKOS_INLINE_FUNCTION void operator()(const int index, size_t& update) const { + //const size_t count = mytemp_strides_(index); + update += mytemp_strides_(index); + } + }; + + //sets final 1D array size + class finalize_stride_functor{ + public: + SArray1D mystart_index_; + finalize_stride_functor(SArray1D tempstart_index_){ + mystart_index_ = tempstart_index_; + } + KOKKOS_INLINE_FUNCTION void operator()(const int index, int& update, bool final) const { + // Load old value in case we update it before accumulating + const size_t count = mystart_index_(index+1); + update += count; + if (final) { + mystart_index_((index+1)) = update; + } + } + }; + + // Destructor + KOKKOS_INLINE_FUNCTION + ~RaggedRightArrayKokkos ( ); +}; // End of RaggedRightArray + +template +RaggedRightArrayKokkos::RaggedRightArrayKokkos() { + dim1_ = length_ = 0; +} + +// Overloaded constructor +template +RaggedRightArrayKokkos::RaggedRightArrayKokkos(CArrayKokkos &strides_array, + const std::string& tag_string) { + mystrides_ = strides_array.get_kokkos_view(); + dim1_ = strides_array.extent(); + data_setup(tag_string); +} // End constructor + +// Overloaded constructor +template +RaggedRightArrayKokkos::RaggedRightArrayKokkos(DCArrayKokkos &strides_array, + const std::string& tag_string) { + mystrides_ = strides_array.get_kokkos_dual_view().d_view; + dim1_ = strides_array.extent(); + data_setup(tag_string); } // End constructor // Overloaded constructor @@ -7082,7 +7941,6 @@ Kokkos::View RaggedRightArrayKokkos -KOKKOS_INLINE_FUNCTION void RaggedRightArrayKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_RaggedRightArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { array_(i) = val; @@ -7257,7 +8115,6 @@ class RaggedRightArrayofVectorsKokkos { }; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Destructor @@ -7452,7 +8309,6 @@ Kokkos::View RaggedRightArrayofVectorsKokko template -KOKKOS_INLINE_FUNCTION void RaggedRightArrayofVectorsKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, length_), KOKKOS_CLASS_LAMBDA(const int i){ array_(i) = val; @@ -7592,7 +8448,6 @@ class RaggedDownArrayKokkos { }; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // Destructor @@ -7827,7 +8682,6 @@ Kokkos::View RaggedDownArrayKokkos -KOKKOS_INLINE_FUNCTION void RaggedDownArrayKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_RaggedDownArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { array_(i) = val; @@ -7918,11 +8772,9 @@ class DynamicRaggedRightArrayKokkos { }; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // set values to only previously non-empty indices based upon stride value - KOKKOS_INLINE_FUNCTION void set_values_sparse(T val); // Destructor @@ -8030,7 +8882,6 @@ Kokkos::View DynamicRaggedRightArrayKokkos< //set values to input template -KOKKOS_INLINE_FUNCTION void DynamicRaggedRightArrayKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_DynamicRaggedRightArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { array_(i) = val; @@ -8038,7 +8889,6 @@ void DynamicRaggedRightArrayKokkos::set_values( } template -KOKKOS_INLINE_FUNCTION void DynamicRaggedRightArrayKokkos::set_values_sparse(T val) { // Kokkos::parallel_for( Kokkos::TeamPolicy<>( dim1_, Kokkos::AUTO, 32 ), KOKKOS_CLASS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { // const int i_i = teamMember.league_rank(); @@ -8136,11 +8986,9 @@ class DynamicRaggedDownArrayKokkos { }; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // set values to only previously non-empty indices based upon stride value - KOKKOS_INLINE_FUNCTION void set_values_sparse(T val); // Destructor @@ -8249,7 +9097,6 @@ Kokkos::View DynamicRaggedDownArrayKokkos -KOKKOS_INLINE_FUNCTION void DynamicRaggedDownArrayKokkos::set_values(T val) { Kokkos::parallel_for("SetValues_DynamicRaggedDownArrayKokkos", length_, KOKKOS_CLASS_LAMBDA(const int i) { array_(i) = val; @@ -8257,7 +9104,6 @@ void DynamicRaggedDownArrayKokkos::set_values(T } template -KOKKOS_INLINE_FUNCTION void DynamicRaggedDownArrayKokkos::set_values_sparse(T val) { // Kokkos::parallel_for( Kokkos::TeamPolicy<>( dim2_, Kokkos::AUTO, 32 ), KOKKOS_CLASS_LAMBDA ( const Kokkos::TeamPolicy<>::member_type &teamMember ) { // const int j_j = teamMember.league_rank(); @@ -8468,7 +9314,6 @@ class CSRArrayKokkos { }; // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); //destructor @@ -8778,7 +9623,6 @@ int CSRArray::toCSC(CArray &data, CArray &col_ptrs, CArray */ template -KOKKOS_INLINE_FUNCTION void CSRArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, nnz_), KOKKOS_CLASS_LAMBDA(const int i){ array_(i) = val; @@ -8961,7 +9805,6 @@ class CSCArrayKokkos //void to_dense(FArray &A); // set values on host to input - KOKKOS_INLINE_FUNCTION void set_values(T val); // destructor @@ -9148,7 +9991,6 @@ int CSCArrayKokkos::flat_index(size_t i, size } template -KOKKOS_INLINE_FUNCTION void CSCArrayKokkos::set_values(T val) { Kokkos:parallel_for( Kokkos::RangePolicy<> ( 0, nnz_), KOKKOS_CLASS_LAMBDA(const int i){ array_(i) = val;