diff --git a/src/Interaction/contactLists/sortedPairs.hpp b/src/Interaction/contactLists/sortedPairs.hpp index 1ca30862..4a91718a 100644 --- a/src/Interaction/contactLists/sortedPairs.hpp +++ b/src/Interaction/contactLists/sortedPairs.hpp @@ -193,7 +193,7 @@ public: if( capacity+1 > flags_.size() ) { - reallocNoInit(flags_, capacity+1); + reallocInit(flags_, capacity+1); } // fill the flags @@ -219,7 +219,7 @@ public: { // get more space to prevent reallocations in next iterations uint32 len = size_*1.1+1; - reallocNoInit(sortedPairs_, len); + reallocInit(sortedPairs_, len); } Kokkos::parallel_for( @@ -231,6 +231,7 @@ public: // - sort paris based on the first and second sort(sortedPairs_, 0, size_ ); + } diff --git a/src/phasicFlow/Kokkos/KokkosUtilities.hpp b/src/phasicFlow/Kokkos/KokkosUtilities.hpp index 7669ba1f..0a6608c8 100644 --- a/src/phasicFlow/Kokkos/KokkosUtilities.hpp +++ b/src/phasicFlow/Kokkos/KokkosUtilities.hpp @@ -56,7 +56,7 @@ template INLINE_FUNCTION_H void reallocInit(ViewType1D& view, uint32 len) { - Kokkos::realloc(Kokkos::WithoutInitializing, view, len); + Kokkos::realloc(view, len); } template diff --git a/src/phasicFlow/Kokkos/ViewAlgorithms.hpp b/src/phasicFlow/Kokkos/ViewAlgorithms.hpp index 280c1c18..7c51653f 100644 --- a/src/phasicFlow/Kokkos/ViewAlgorithms.hpp +++ b/src/phasicFlow/Kokkos/ViewAlgorithms.hpp @@ -28,6 +28,8 @@ Licence: #include "cudaAlgorithms.hpp" #include "kokkosAlgorithms.hpp" #include "stdAlgorithms.hpp" +#include "Kokkos_Sort.hpp" + namespace pFlow { @@ -295,7 +297,9 @@ sort(ViewType1D& view, uint32 start, uint32 end) if constexpr (isHostAccessible()) { - pFlow::algorithms::STD::sort(view.data() + start, numElems); + //auto sView = Kokkos::subview(view, Kokkos::make_pair(start,end)); + //Kokkos::sort(sView); + pFlow::algorithms::STD::sort(view.data() + start, numElems); return; } @@ -316,7 +320,7 @@ sort( ViewType1D& view, uint32 start, uint32 end, - CompareFunc compare + const CompareFunc& compare ) { using ExecutionSpace = @@ -326,9 +330,12 @@ sort( if constexpr (isHostAccessible()) { - pFlow::algorithms::STD::sort( + // sort without parallelization + pFlow::algorithms::STD::sort( view.data() + start, numElems, compare ); + //auto sView = Kokkos::subview(view, Kokkos::make_pair(start,end)); + //Kokkos::sort(sView, compare); return; } @@ -345,6 +352,7 @@ sort( return; } + template< typename Type, typename... properties, diff --git a/src/phasicFlow/algorithms/stdAlgorithms.hpp b/src/phasicFlow/algorithms/stdAlgorithms.hpp index 89341a0a..c6d652ae 100644 --- a/src/phasicFlow/algorithms/stdAlgorithms.hpp +++ b/src/phasicFlow/algorithms/stdAlgorithms.hpp @@ -148,7 +148,7 @@ void sort(Type* first, int32 numElems) if constexpr(useParallel) { std::sort( - std::execution::par, + std::execution::par_unseq, first, first+numElems, less());