 CUDPPHandle scanPlan;
 
 float *SATs[2][3];
-unsigned int satTimer[3];
+cudaEvent_t timerStart, timerStop;
 
 extern "C"
 __host__ void initialize(int width, int height)

    CUT_CHECK_ERROR("scan 2");
    cudppMultiScan(scanPlan, SATs[1][2], SATs[0][2], width, height);
    CUT_CHECK_ERROR("scan 3");
    CUT_SAFE_CALL(cutStopTimer(satTimer[1]));


    CUT_SAFE_CALL(cutStartTimer(satTimer[2]));
    // transpose so columns become rows
    transpose<float, 16, 16><<<grid, block, 0>>>
        (SATs[0][0], SATs[0][1], SATs[0][2], 
         SATs[1][0], SATs[1][1], SATs[1][2], d_satPitchInElements, width, height);
    CUT_CHECK_ERROR("transpose");
    CUT_SAFE_CALL(cutStopTimer(satTimer[2]));

    CUT_SAFE_CALL(cutStartTimer(satTimer[1]));
    // scan columns
    cudppMultiScan(scanPlan, SATs[1][0], SATs[0][0], width, height);
    CUT_CHECK_ERROR("scan 4");
    cudppMultiScan(scanPlan, SATs[1][1], SATs[0][1], width, height);
    CUT_CHECK_ERROR("scan 5");
    cudppMultiScan(scanPlan, SATs[1][2], SATs[0][2], width, height);
    CUT_CHECK_ERROR("scan 6");
    CUT_SAFE_CALL(cutStopTimer(satTimer[1]));
    
    CUT_SAFE_CALL(cutStartTimer(satTimer[0]));
    interleaveFloat32toRGBAfp32<<<grid, block, 0>>>((float4*)out_data, 
                                                    SATs[1][0], 
                                                    SATs[1][1], 
                                                    SATs[1][2], 
                                                    d_satPitchInElements,
                                                    width, height);
    CUT_CHECK_ERROR("interleave");
    CUT_SAFE_CALL(cutStopTimer(satTimer[0]));


    CUDA_SAFE_CALL(cudaGLUnmapBufferObject( pbo_in));
    CUDA_SAFE_CALL(cudaGLUnmapBufferObject( pbo_out));

    //printf("SAT: %0.2f ms\n", cutGetTimerValue(satTimer[0]));
    /*printf("Total: %0.2f ms | (de)Interleave: %0.2f ms | Multiscan: %0.2f ms | Transpose: %0.2f ms\n",
           cutGetTimerValue(satTimer[0])+cutGetTimerValue(satTimer[1])+cutGetTimerValue(satTimer[2]),
           cutGetTimerValue(satTimer[0]), cutGetTimerValue(satTimer[1]), cutGetTimerValue(satTimer[2]));
*/

}

extern "C"

        printf("Error creating CUDPPPlan.\n");
    }

    CUDA_SAFE_CALL( cudaEventCreate(&timerStart) );
    CUDA_SAFE_CALL( cudaEventCreate(&timerStop) );
    
}

extern "C"
