Ejemplo n.º 1
0
int FloydWarshall::setup()
{
    if(!sampleCommon->isPowerOf2(numNodes))
        numNodes = sampleCommon->roundToPowerOf2(numNodes);

    /*
     * An adjacency matrix is a square matrix
     * width = height = number of nodes in the graph
     */

	if(numNodes > 512)
	{
		if(!quiet)
		{
			std::cout<<"Reducing the number of nodes to 512 \n";
		}

		numNodes = 512;
	}
    height = width = numNodes;

    if(setupFloydWarshall()!=SDK_SUCCESS)
        return SDK_FAILURE;

    int timer = sampleCommon->createTimer();
    sampleCommon->resetTimer(timer);
    sampleCommon->startTimer(timer);

    if(setupCL()!=SDK_SUCCESS)
        return SDK_FAILURE;

    sampleCommon->stopTimer(timer);

    setupTime = (cl_double)sampleCommon->readTimer(timer);

    return SDK_SUCCESS;
}
Ejemplo n.º 2
0
int FloydWarshall::setup()
{
     // numNodes should be multiples of blockSize 
    if(numNodes % blockSize != 0)
    {
        numNodes = (numNodes / blockSize + 1) * blockSize;
    }

    if(setupFloydWarshall() != SDK_SUCCESS)
        return SDK_FAILURE;

    int timer = sampleCommon->createTimer();
    sampleCommon->resetTimer(timer);
    sampleCommon->startTimer(timer);

    if(setupCL() != SDK_SUCCESS)
        return SDK_FAILURE;

    sampleCommon->stopTimer(timer);

    setupTime = (cl_double)sampleCommon->readTimer(timer);

    return SDK_SUCCESS;
}