 #include <cuda_runtime.h>
 #include <curand_kernel.h>
 #include <stdio.h>
+
+#define NUMTREES 64
+#define NUMSAMPS 32
+#define NUMREPS NUMTREES*NUMSAMPS/1024
+
 
 #ifdef __CUDA_ARCH__ 
 #if __CUDA_ARCH__ > 200

      vtmp = totals[1][threadIdx.x];
      if (doth) {                       // Apply the threshold if doth true, otherwise save the value
        newt = 2 * pos[threadIdx.x] + 1;
        fthresh = *((float *)&inds[0][threadIdx.x]);
        if (vtmp > fthresh) {
          newt++;
        }
        otpos[threadIdx.x + ntrees * bd] = newt; 


__global__ void __treeprod(unsigned int *trees, float *feats, int *tpos, int *otpos, int nrows, int ncols, int ns, int tstride, int ntrees, int doth) {

  __shared__ int pos[NUMTREES];
  __shared__ float thresholds[NUMTREES];
  __shared__ float totals[NUMTREES];            // (ns+1) x ntrees
  int newt, bd;
  unsigned int tind[NUMREPS];
  float vv[NUMREPS];
  float vtmp[NUMREPS];
  float vt;

  for (bd = blockIdx.x; bd < ncols; bd += gridDim.x) {
    __syncthreads();
