예제 #1
0
int 
NBody::run()
{
    /* Arguments are set and execution call is enqueued on command buffer */
    if(setupCLKernels() != SDK_SUCCESS)
    {
        return SDK_FAILURE;
    }

    if(verify || timing)
    {
        int timer = sampleCommon->createTimer();
        sampleCommon->resetTimer(timer);
        sampleCommon->startTimer(timer);

        for(int i = 0; i < iterations; ++i)
        {
            runCLKernels();
        }

        sampleCommon->stopTimer(timer);
        /* Compute kernel time */
        kernelTime = (double)(sampleCommon->readTimer(timer)) / iterations;
    }

    if(!quiet)
    {
        sampleCommon->printArray<cl_float>("Output", pos, numBodies, 1);
    }

    return SDK_SUCCESS;
}
예제 #2
0
파일: NBody.cpp 프로젝트: GMAC-lib/gmac
int
NBody::run()
{
    /* Arguments are set and execution call is enqueued on command buffer */
    setupCLKernels();

    if(verify || timing) {
        for(int i = 0; i < iterations; ++i) {
            runCLKernels();
        }
    }

    return 0;
}
int 
FluidSimulation2D::run()
{
    if(!reqdExtSupport)
        return SDK_SUCCESS;

    // Arguments are set and execution call is enqueued on command buffer 
    if(setupCLKernels() != SDK_SUCCESS)
    {
        return SDK_FAILURE;
    }

    if(display == 0)
    {
        // Warm up
        for(int i = 0; i < 2 && iterations != 1; ++i)
        {
            runCLKernels();
        }

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

        for(int i = 0; i < iterations; ++i)
        {
            runCLKernels();
        }

        sampleCommon->stopTimer(timer);
        // Compute kernel time 
        kernelTime = (double)(sampleCommon->readTimer(timer)) / iterations;
    }

    return SDK_SUCCESS;
}