 
 /* 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 */

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

  floatType_t result = 0.0;

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

  *out = result;
  return;

}

int main()
{
  floatType_t *h_in, h_out, good_out;
  floatType_t *d_in, *d_out;
  int size = N;
  int memBytes = size * sizeof( floatType_t );

/* get GPU device number and name */


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

  checkCUDA( cudaMalloc( &d_in, memBytes ) );
  checkCUDA( cudaMalloc( &d_sum, 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_sum      = 0.0;
  cpu_sum   = 0.0;

/* copy inputs to device */

  checkCUDA( cudaMemcpy( d_in, h_in, memBytes, cudaMemcpyHostToDevice ) );
  checkCUDA( cudaMemset( d_sum, 0, sizeof(FLOATTYPE_T) ) );

/* calculate block and grid sizes */

