     ( (double) elapsedTime / 1000.0 ) * 1.e-9);
 
 
-  FLOATTYPE_T diff = abs( good_out - h_out );
+  FLOATTYPE_T diff = abs( cpu_sum - h_sum );
 
-  if( diff / h_out < 0.001 ) printf("PASS\n");
+  if( diff / h_sum < 0.001 ) printf("PASS\n");
   else
   {                       
     printf("FAIL\n");
-    printf("Error is %f\n", diff / h_out );
-    printf("GPU result is %f, CPU result is %f\n",h_out, good_out );
+    printf("Error is %f\n", diff / h_sum );
+    printf("GPU result is %f, CPU result is %f\n",h_sum, cpu_sum );
   } /* end else */
 
 /* clean up */
 
   free(h_in);
   checkCUDA( cudaFree( d_in ) );
-  checkCUDA( cudaFree( d_out ) );
+  checkCUDA( cudaFree( d_sum ) );
   checkCUDA( cudaFree( d_tempArray ) );
-  checkCUDA( cudaFree( d_temp_storage ) );
 
   checkCUDA( cudaDeviceReset() );
 	

  checkCUDA( cudaEventRecord( start, 0 ) );

/* launch the kernel on the GPU */
  cub::DeviceReduce::Sum( d_temp_storage, temp_storage_bytes, d_in, d_out, 
    size );

/* stop the timers */


/* allocate space for device copies of in, out */

  checkCUDA( cudaMalloc( &d_in, memBytes ) );
  checkCUDA( cudaMalloc( &d_sum, sizeof(FLOATTYPE_T) ) );
  checkCUDA( cudaMalloc( &d_tempArray, tempArraySize * sizeof(FLOATTYPE_T) ) );

/* allocate space for host copies of in, out and setup input values */
