Commit 3e392692 authored by Lukas Cejka's avatar Lukas Cejka Committed by Tomáš Oberhuber
Browse files

Commented out Debugging prints. Preparation for new branch.

parent 8644219b
Loading
Loading
Loading
Loading
+36 −36
Original line number Diff line number Diff line
@@ -149,8 +149,8 @@ warpList< MatrixType >::~warpList()
    delete this->head;
    
    // TEST
    std::cout << "List destructor." << std::endl;
    this->printList();
//    std::cout << "List destructor." << std::endl;
//    this->printList();
}


@@ -195,18 +195,18 @@ void
AdEllpack< Real, Device, Index >::
setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths )
{
    std::cout << "\tCompressedRowLengths:" << std::endl;
//    std::cout << "\tCompressedRowLengths:" << std::endl;
    
    TNL_ASSERT( this->getRows() > 0, );
    TNL_ASSERT( this->getColumns() > 0, );
    
    std::cout << "\t\tAssert rows and columns > 0." << std::endl;
//    std::cout << "\t\tAssert rows and columns > 0." << std::endl;
    
    if( std::is_same< DeviceType, Devices::Host >::value )
    {
        
        // TEST
        std::cout << "\tStarting host setup." << std::endl;
//        std::cout << "\tStarting host setup." << std::endl;
        
        RealType average = 0.0;
        for( IndexType row = 0; row < this->getRows(); row++ )
@@ -215,21 +215,21 @@ setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths )
        this->totalLoad = average;
        
        // TEST
        std::cout << "\t\tAverage assigned to totalLoad." << std::endl;
//        std::cout << "\t\tAverage assigned to totalLoad." << std::endl;

        warpList< ThisType >* list = new warpList< ThisType >();
        
        // TEST
        list->printList();
//        list->printList();
        
        // TEST
        std::cout << "\t\tNew warpList created." << std::endl;
//        std::cout << "\t\tNew warpList created." << std::endl;

        if( !this->balanceLoad( average, rowLengths, list ) )
            throw 0; // TODO: Make better exception
        
        // TEST
        std::cout << "\t\tbalanceLoad exception was not thrown." << std::endl;
//        std::cout << "\t\tbalanceLoad exception was not thrown." << std::endl;

        IndexType SMs = 15;
        IndexType threadsPerSM = 2048;
@@ -237,13 +237,13 @@ setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths )
        this->computeWarps( SMs, threadsPerSM, list );
        
        // TEST
        std::cout << "\t\tWarps computed." << std::endl;
//        std::cout << "\t\tWarps computed." << std::endl;

        if( !this->createArrays( list ) )
            throw 0; // TODO: Make better excpetion
        
        // TEST
        std::cout << "\t\tArrays created." << std::endl;
//        std::cout << "\t\tArrays created." << std::endl;

        //this->performRowTest();
        //cout << "========================" << std::endl;
@@ -252,14 +252,14 @@ setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths )
        //this->performRowLengthsTest( rowLengths );
        
        // TEST
        std::cout << "\tCompleted host setup." << std::endl;
//        std::cout << "\tCompleted host setup." << std::endl;
    
    }
    
    if( std::is_same< DeviceType, Devices::Cuda >::value )
    {
        // TEST
        std::cout << "\tStarting device setup." << std::endl;
//        std::cout << "\tStarting device setup." << std::endl;
        
        AdEllpack< RealType, Devices::Host, IndexType > hostMatrix;
        hostMatrix.setDimensions( this->getRows(), this->getColumns() );
@@ -281,7 +281,7 @@ setCompressedRowLengths( ConstCompressedRowLengthsVectorView rowLengths )
        this->allocateMatrixElements( this->offset.getElement( this->offset.getSize() - 1 ) );
        
        // TEST
        std::cout << "\tCompleted device setup." << std::endl;
//        std::cout << "\tCompleted device setup." << std::endl;
    }
}

@@ -851,13 +851,13 @@ void AdEllpack< Real, Device, Index >::computeWarps( const IndexType SMs,
{
// Included for 'system("pause")'. Where pause is "read -p 'Press Enter to continue...' var" in linux-based systems.
#include <iostream>
    std::cout << "\t\tComputeWarps:" << std::endl;
//    std::cout << "\t\tComputeWarps:" << std::endl;
    
    IndexType averageLoad = 0;
    warpInfo< ThisType >* temp = list->getHead()->next;
    
    //TEST
    list->printList();
//    list->printList();
    
    // MISTAKE? If list looks like this:
    //
@@ -879,41 +879,41 @@ void AdEllpack< Real, Device, Index >::computeWarps( const IndexType SMs,
    /*averageLoad /= list->getNumberOfWarps();*/
    
    // TEST
    std::cout << "\t\t\tBefore roundUpDivision:" << std::endl;
    std::cout << "\t\t\t\taverageLoad = " << averageLoad << "\tlist->getNumberOfWarps() = " << list->getNumberOfWarps() << std::endl;
//    std::cout << "\t\t\tBefore roundUpDivision:" << std::endl;
//    std::cout << "\t\t\t\taverageLoad = " << averageLoad << "\tlist->getNumberOfWarps() = " << list->getNumberOfWarps() << std::endl;
    
    // TEST
    averageLoad = roundUpDivision( averageLoad, list->getNumberOfWarps() );
    
    // TEST
    std::cout << "\t\t\tAverage load calculated. = " << averageLoad << std::endl;
//    std::cout << "\t\t\tAverage load calculated. = " << averageLoad << std::endl;

    IndexType totalWarps = SMs * ( threadsPerSM / this->warpSize );
    IndexType remainingThreads = list->getNumberOfWarps();
    bool warpsToSplit = true;
    
    // TEST
    std::cout << "\t\t\tTotal warps, remaining threads, warpsToSplit set." << std::endl;
//    std::cout << "\t\t\tTotal warps, remaining threads, warpsToSplit set." << std::endl;

    while( remainingThreads < ( totalWarps / 2 ) && warpsToSplit )
    {
        // TEST
        std::cout << "\t\t\tBeginning of outer while." << std::endl;
//        std::cout << "\t\t\tBeginning of outer while." << std::endl;
        
        warpsToSplit = false;
        temp = list->getHead()->next;
        
        // TEST - PRINT
        std::cout << "\t\t\t\t[ list PRINT ]: " << std::endl;
        list->printList();
//        std::cout << "\t\t\t\t[ list PRINT ]: " << std::endl;
//        list->printList();
        
        // FIXME: This can be an INFINITE LOOP.
        //        It will cause the process to be killed by bash.
        while( temp != list->getTail() )
        {
            // TEST
            std::cout << "\n\t\t\t\tBeginning of inner while." << std::endl;
            std::cout << "\t\t\t\ttemp->localLoad = " << temp->localLoad << "\ttemp->offset = " << temp->offset << "\ttemp->rowOffset = " << temp->rowOffset << std::endl;
//            std::cout << "\n\t\t\t\tBeginning of inner while." << std::endl;
//            std::cout << "\t\t\t\ttemp->localLoad = " << temp->localLoad << "\ttemp->offset = " << temp->offset << "\ttemp->rowOffset = " << temp->rowOffset << std::endl;
            
            // FIXME: localLoad of newly created secondHalf from splitInHalf is always at least 1.
            //          If averageLoad is 0, then this will create new warpInfos until the system memory is depleted.
@@ -923,26 +923,26 @@ void AdEllpack< Real, Device, Index >::computeWarps( const IndexType SMs,
                warpsToSplit = true;
                
                // TEST - PRINT after splitInHalf
                std::cout << "\t\t\t\t[ list PRINT - after splitInHalf ]: " << std::endl;
                list->printList();
//                std::cout << "\t\t\t\t[ list PRINT - after splitInHalf ]: " << std::endl;
//                list->printList();
                
                // TEST
                std::cout << "\n\t\t\t\t\ttemp after splitInHalf:" << std::endl;
                std::cout << "\t\t\t\t\ttemp->localLoad = " << temp->localLoad << "\ttemp->offset = " << temp->offset << "\ttemp->rowOffset = " << temp->rowOffset << std::endl;
//                std::cout << "\n\t\t\t\t\ttemp after splitInHalf:" << std::endl;
//                std::cout << "\t\t\t\t\ttemp->localLoad = " << temp->localLoad << "\ttemp->offset = " << temp->offset << "\ttemp->rowOffset = " << temp->rowOffset << std::endl;
                
                // TEST
                if( temp == list->getHead()->next )
                    std::cout << "\n\t\t\t\t\ttemp == list->getHead()->next" << std::endl;
//                if( temp == list->getHead()->next )
//                    std::cout << "\n\t\t\t\t\ttemp == list->getHead()->next" << std::endl;
                
            }
            
            // TEST
            if( temp->next == list->getHead()->next->next )
                std::cout << "\n\t\t\t\t\ttemp->next == list->getHead()->next->next" << std::endl;
//            if( temp->next == list->getHead()->next->next )
//                std::cout << "\n\t\t\t\t\ttemp->next == list->getHead()->next->next" << std::endl;
            
            // TEST
            if( list->getHead()->next->next == list->getTail() )
                std::cout << "\n\t\t\t\t\tlist->getHead()->next->next == list->getTail()" << std::endl;
//            if( list->getHead()->next->next == list->getTail() )
//                std::cout << "\n\t\t\t\t\tlist->getHead()->next->next == list->getTail()" << std::endl;
            
            temp = temp->next;
            
@@ -956,7 +956,7 @@ void AdEllpack< Real, Device, Index >::computeWarps( const IndexType SMs,
	remainingThreads = list->getNumberOfWarps();
        
        // TEST
        std::cout << "\t\t\tRemaining threads set." << std::endl;
//        std::cout << "\t\t\tRemaining threads set." << std::endl;
        
    }
}