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 { ...@@ -27,50 +27,80 @@ namespace Matrices {
template< typename Device > template< typename Device >
class AdEllpackDeviceDependentCode; class AdEllpackDeviceDependentCode;
template< typename MatrixType >
struct warpInfo struct warpInfo
{ {
int offset; using RealType = typename MatrixType::RealType;
int rowOffset; using DeviceType = typename MatrixType::DeviceType;
int localLoad; using IndexType = typename MatrixType::IndexType;
int reduceMap[ 32 ];
IndexType offset;
warpInfo* next; IndexType rowOffset;
warpInfo* previous; IndexType localLoad;
IndexType reduceMap[ 32 ];
warpInfo< MatrixType >* next;
warpInfo< MatrixType >* previous;
}; };
template< typename MatrixType >
class warpList class warpList
{ {
public: public:
using RealType = typename MatrixType::RealType;
using DeviceType = typename MatrixType::DeviceType;
using IndexType = typename MatrixType::IndexType;
warpList(); warpList();
bool addWarp( const int offset, bool addWarp( const IndexType offset,
const int rowOffset, const IndexType rowOffset,
const int localLoad, const IndexType localLoad,
const int* reduceMap ); const IndexType* reduceMap );
warpInfo* splitInHalf( warpInfo* warp ); warpInfo< MatrixType >* splitInHalf( warpInfo< MatrixType >* warp );
int getNumberOfWarps() IndexType getNumberOfWarps()
{ return this->numberOfWarps; } { return this->numberOfWarps; }
warpInfo* getNextWarp( warpInfo* warp ) warpInfo< MatrixType >* getNextWarp( warpInfo< MatrixType >* warp )
{ return warp->next; } { return warp->next; }
warpInfo* getHead() warpInfo< MatrixType >* getHead()
{ return this->head; } { return this->head; }
warpInfo* getTail() warpInfo< MatrixType >* getTail()
{ return this->tail; } { return this->tail; }
~warpList(); ~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: private:
int numberOfWarps; IndexType numberOfWarps;
warpInfo* head; warpInfo< MatrixType >* head;
warpInfo* tail; warpInfo< MatrixType >* tail;
}; };
...@@ -155,13 +185,13 @@ public: ...@@ -155,13 +185,13 @@ public:
bool balanceLoad( const RealType average, bool balanceLoad( const RealType average,
ConstCompressedRowLengthsVectorView rowLengths, ConstCompressedRowLengthsVectorView rowLengths,
warpList* list ); warpList< ThisType >* list );
void computeWarps( const IndexType SMs, void computeWarps( const IndexType SMs,
const IndexType threadsPerSM, const IndexType threadsPerSM,
warpList* list ); warpList< ThisType >* list );
bool createArrays( warpList* list ); bool createArrays( warpList< ThisType >* list );
void performRowTest(); 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