 
 /* launch the kernel on the GPU */
 
-  sumReduction<<< 1, 1 >>>( size, d_in, d_out );
+  sumReduction<<< 1, 1 >>>( size, d_in, d_sum );
   checkKERNEL()
 
 /* stop the timers */

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

  checkCUDA( cudaMalloc( &d_in, memBytes ) );
  checkCUDA( cudaMalloc( &d_out, sizeof(floatType_t) ) );

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

  h_in = (floatType_t *)malloc( memBytes );

  for( int i = 0; i < size; i++ )
  {
   h_in[i] = floatType_t( rand() ) / ( floatType_t (RAND_MAX) + 1.0 );
  }

  h_out      = 0.0;
  good_out   = 0.0;

/* copy inputs to device */

  checkCUDA( cudaMemcpy( d_in, h_in, memBytes, cudaMemcpyHostToDevice ) );
  checkCUDA( cudaMemset( d_out, 0, sizeof(floatType_t) ) );

/* calculate block and grid sizes */


/* return if my global index is larger than the array size */
  if( globalIndex >= n ) return;

/* temp for accumulating result */
  FLOATTYPE_T result = 0.0;

/* loop for calculating the result */
  for( int i = 0; i < N; i++ ) 
  { 
    result += in[i];
  } /* end for */

/* write the result to global memory */

  *sum = result;
  return;

}

int main()
{
  FLOATTYPE_T *h_in, h_sum, cpu_sum;
  FLOATTYPE_T *d_in, *d_sum;
  int size = N;
  int memBytes = size * sizeof( FLOATTYPE_T );

/* get GPU device number and name */

