Template Numerical Library version\ main:58f2aa3f5
Loading...
Searching...
No Matches
TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda > Class Template Reference
Collaboration diagram for TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >:

Public Types

using DeviceType = Devices::Cuda
 
using ValueType = Value
 

Public Member Functions

template<typename CMP>
void firstPhase (const CMP &Cmp)
 
int getElemPerBlock () const
 
int getSetsNeeded (int elemPerBlock) const
 
void init (Containers::ArrayView< Value, Devices::Cuda > arr, int gridDim, int blockDim, int desiredElemPerBlock, int maxSharable)
 
template<typename CMP>
int initTasks (int elemPerBlock, const CMP &Cmp)
 
template<typename CMP>
void performSort (const CMP &Cmp)
 
void processNewTasks ()
 
template<typename CMP>
void secondPhase (const CMP &Cmp)
 
template<typename Array>
void sort (Array &arr)
 
template<typename Array, typename Compare>
void sort (Array &arr, const Compare &cmp)
 

Protected Attributes

Containers::ArrayView< Value, Devices::Cudaarr
 
Containers::ArrayView< Value, Devices::Cudaaux
 
Containers::Array< Value, Devices::CudaauxMem
 
Containers::Array< TASK, Devices::Cudacuda_2ndPhaseTasks
 
Containers::Array< int, Devices::Cudacuda_2ndPhaseTasksAmount
 
Containers::Array< int, Devices::Cudacuda_blockToTaskMapping
 
Containers::Array< TASK, Devices::Cudacuda_newTasks
 
Containers::Array< int, Devices::Cudacuda_newTasksAmount
 
Containers::Array< int, Devices::Cudacuda_reductionTaskInitMem
 
Containers::Array< TASK, Devices::Cudacuda_tasks
 
int desired_2ndPhasElemPerBlock
 
int desiredElemPerBlock
 
const int g_maxTasks = 1 << 14
 
int host_1stPhaseTasksAmount = 0
 
int host_2ndPhaseTasksAmount = 0
 
int iteration = 0
 
int maxBlocks
 
std::size_t maxSharable
 
int maxTasks
 
int threadsPerBlock
 

Member Function Documentation

◆ firstPhase()

template<typename Value>
template<typename CMP>
void TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >::firstPhase ( const CMP & Cmp)

does the 1st phase of Quicksort until out of task memory or each task is small enough for correctness, secondphase method needs to be called to sort each subsequences

◆ getElemPerBlock()

template<typename Value>
int TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >::getElemPerBlock ( ) const
nodiscard

returns the optimal amount of elements per thread needed for phase

◆ getSetsNeeded()

template<typename Value>
int TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >::getSetsNeeded ( int elemPerBlock) const
nodiscard

returns how many blocks are needed to start sort phase 1 if

Parameters
elemPerBlockwere to be used

◆ initTasks()

template<typename Value>
template<typename CMP>
int TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >::initTasks ( int elemPerBlock,
const CMP & Cmp )

returns the amount of blocks needed to start phase 1 while also initializing all tasks

◆ processNewTasks()

template<typename Value>
void TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >::processNewTasks ( )

update necessary variables after 1 phase1 sort

◆ secondPhase()

template<typename Value>
template<typename CMP>
void TNL::Algorithms::Sorting::Quicksorter< Value, Devices::Cuda >::secondPhase ( const CMP & Cmp)

sorts all leftover tasks


The documentation for this class was generated from the following file: