Commit 25467ffc authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Fixed setLike from bool to void. Casted reduceMap to (int *) to avoid compile error.

addWarp( const int, const int, const int, const int * ) takes int, but
in balanceLoad is given IndexType!! recast or rewrite warp list/info
using IndexType?
parent 1e1469f5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public:
    IndexType getRowLength( const IndexType row ) const;

    template< typename Real2, typename Device2, typename Index2 >
    bool setLike( const AdEllpack< Real2, Device2, Index2 >& matrix );
    void setLike( const AdEllpack< Real2, Device2, Index2 >& matrix );

    void reset();

+9 −11
Original line number Diff line number Diff line
@@ -379,15 +379,13 @@ template< typename Real,
template< typename Real2,
          typename Device2,
          typename Index2 >
bool AdEllpack< Real, Device, Index >::setLike( const AdEllpack< Real2, Device2, Index2 >& matrix )
void AdEllpack< Real, Device, Index >::setLike( const AdEllpack< Real2, Device2, Index2 >& matrix )
{
    if( !Sparse< Real, Device, Index >::setLike( matrix ) ||
        !this->offset.setLike( matrix.offset ) ||
        !this->rowOffset.setLike( matrix.rowOffset ) ||
        !this->localLoad.setLike( matrix.localLoad ) ||
        !this->reduceMap.setLike( matrix.reduceMap ) )
        return false;
    return true;
    Sparse< Real, Device, Index >::setLike( matrix );
    this->offset.setLike( matrix.offset );
    this->rowOffset.setLike( matrix.rowOffset );
    this->localLoad.setLike( matrix.localLoad );
    this->reduceMap.setLike( matrix.reduceMap );
}

template< typename Real,
@@ -724,7 +722,7 @@ bool AdEllpack< Real, Device, Index >::balanceLoad( const RealType average,
                for( IndexType i = numberOfThreads + 1; i < this->warpSize; i++ )
                    reduceMap[ i ] = 0;

                if( !list->addWarp( offset, rowOffset, localLoad, reduceMap ) )
                if( !list->addWarp( offset, rowOffset, localLoad, (int *)reduceMap ) )
                    return false;

                offset += this->warpSize * localLoad;
@@ -754,7 +752,7 @@ bool AdEllpack< Real, Device, Index >::balanceLoad( const RealType average,
                    reduceMap[ i ] = 0;

                // count new offsets, add new warp and reset variables
                if( !list->addWarp( offset, rowOffset, localLoad, reduceMap ) )
                if( !list->addWarp( offset, rowOffset, localLoad, (int *)reduceMap ) )
                    return false;
                offset += this->warpSize * localLoad;
                rowOffset = row;
@@ -793,7 +791,7 @@ bool AdEllpack< Real, Device, Index >::balanceLoad( const RealType average,
        if( ( ( row == this->getRows() - 1 ) && !addedWarp ) ||
            ( ( row == this->getRows() - 1 ) && ( threadsPerRow == numberOfThreads ) && ( numberOfThreads > 0 ) ) )
        {
            list->addWarp( offset, rowOffset, localLoad, reduceMap );
            list->addWarp( offset, rowOffset, localLoad, (int *)reduceMap );
        }
    }
    return true;