GeneralDistributionTestConfig()
    {
        comm = CommunicatorFactory::get( "MPI" );

        rank = comm->getRank();
        size = comm->getSize();

        elemsPerPartition = 10;

        globalSize = elemsPerPartition * size;

        for ( IndexType k = 0; k < elemsPerPartition; ++k )
        {
            localIndexes.push_back( k * size + rank );
        }

        dist = DistributionPtr( new GeneralDistribution( globalSize, localIndexes, comm ) );

    }
Example #2
0
static Distribution* createDistribution( const IndexType n, CommunicatorPtr comm, int kind )
{
    Distribution* dist;

    if ( kind == 0 )
    {
        dist = new BlockDistribution( n, comm );
    }
    else if ( kind == 1 )
    {
        dist = new NoDistribution( n );
    }
    else if ( kind == 2 )
    {
        std::vector<IndexType> localIndexes;
        IndexType size = comm->getSize();
        IndexType rank = comm->getRank();

        for ( int k = 0; k < n; k++ )
        {
            if ( k % size == rank )
            {
                localIndexes.push_back(k);
            }
        }

        dist = new GeneralDistribution( n, localIndexes, comm);
    }
    else if ( kind == 3 )
    {
        IndexType chunkSize = comm->getSize();

        dist = new CyclicDistribution( n, chunkSize, comm);
    }
    else
    {
        LAMA_THROWEXCEPTION( "kind = " << kind << " unsupported here" )
    }

    return dist;
}