Skip to content
Snippets Groups Projects
Commit c34ca5ac authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Preliminary templating of WarpInfo and WarpList. Commenting for backup purposes.

parent b80ec5b8
No related branches found
No related tags found
1 merge request!45Matrices revision
......@@ -27,50 +27,80 @@ namespace Matrices {
template< typename Device >
class AdEllpackDeviceDependentCode;
template< typename MatrixType >
struct warpInfo
{
int offset;
int rowOffset;
int localLoad;
int reduceMap[ 32 ];
warpInfo* next;
warpInfo* previous;
using RealType = typename MatrixType::RealType;
using DeviceType = typename MatrixType::DeviceType;
using IndexType = typename MatrixType::IndexType;
IndexType offset;
IndexType rowOffset;
IndexType localLoad;
IndexType reduceMap[ 32 ];
warpInfo< MatrixType >* next;
warpInfo< MatrixType >* previous;
};
template< typename MatrixType >
class warpList
{
public:
using RealType = typename MatrixType::RealType;
using DeviceType = typename MatrixType::DeviceType;
using IndexType = typename MatrixType::IndexType;
warpList();
bool addWarp( const int offset,
const int rowOffset,
const int localLoad,
const int* reduceMap );
bool addWarp( const IndexType offset,
const IndexType rowOffset,
const IndexType localLoad,
const IndexType* reduceMap );
warpInfo* splitInHalf( warpInfo* warp );
warpInfo< MatrixType >* splitInHalf( warpInfo< MatrixType >* warp );
int getNumberOfWarps()
IndexType getNumberOfWarps()
{ return this->numberOfWarps; }
warpInfo* getNextWarp( warpInfo* warp )
warpInfo< MatrixType >* getNextWarp( warpInfo< MatrixType >* warp )
{ return warp->next; }
warpInfo* getHead()
warpInfo< MatrixType >* getHead()
{ return this->head; }
warpInfo* getTail()
warpInfo< MatrixType >* getTail()
{ return this->tail; }
~warpList();
void printList()
{
if( this->getHead() == this->getTail() )
std::cout << "HEAD==TAIL" << std::endl;
else
{
// TEST
for( warpInfo< MatrixType >* i = this->getHead(); i != this->getTail()->next; i = i->next )
{
if( i == this->getHead() )
std::cout << "Head:" << "\ti->localLoad = " << i->localLoad << "\ti->offset = " << i->offset << "\ti->rowOffset = " << i->rowOffset << std::endl;
else if( i == this->getTail() )
std::cout << "Tail:" << "\ti->localLoad = " << i->localLoad << "\ti->offset = " << i->offset << "\ti->rowOffset = " << i->rowOffset << std::endl;
else
std::cout << "\ti->localLoad = " << i->localLoad << "\ti->offset = " << i->offset << "\ti->rowOffset = " << i->rowOffset << std::endl;
}
std::cout << std::endl;
}
}
private:
int numberOfWarps;
IndexType numberOfWarps;
warpInfo* head;
warpInfo* tail;
warpInfo< MatrixType >* head;
warpInfo< MatrixType >* tail;
};
......@@ -155,13 +185,13 @@ public:
bool balanceLoad( const RealType average,
ConstCompressedRowLengthsVectorView rowLengths,
warpList* list );
warpList< ThisType >* list );
void computeWarps( const IndexType SMs,
const IndexType threadsPerSM,
warpList* list );
warpList< ThisType >* list );
bool createArrays( warpList* list );
bool createArrays( warpList< ThisType >* list );
void performRowTest();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment