 /* allocate space for device copies of in, out */
 
   checkCUDA( cudaMalloc( &d_in, memBytes ) );
-  checkCUDA( cudaMalloc( &d_out, sizeof(FLOATTYPE_T) ) );
+  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 */

 */

#include <stdio.h>
#include <cub/cub.cuh>
#include "../debug.h"

#define N ( 1 << 27 )
#define FLOATTYPE_T float

int main()
{
  FLOATTYPE_T *h_in, h_out, good_out;
  FLOATTYPE_T *d_in, *d_out, *d_tempArray;
  int size = N;
  int memBytes = size * sizeof( FLOATTYPE_T );
  int tempArraySize = 32768;

  checkCUDA( cudaEventRecord( start, 0 ) );

/* launch the kernel on the GPU */

  sumReduction<<< blocks, threads1 >>>( size, d_in,  d_tempArray );
  checkKERNEL()
  sumReduction<<<      1, threads2 >>>( blocks.x, d_tempArray, d_sum );
  checkKERNEL()

/* stop the timers */

