   float daa[NELTS][NWINDOW];
   float bb[NELTS];
   float dbb[NELTS];
-  __shared__ float prods[NYDIM][32];
-  __shared__ int wb[NNEG];
+  __shared__ float prods[NYDIM][NNEG*NWINDOW];
+  __shared__ int wb[NNEG*NWINDOW];
 
   int tid = threadIdx.x + blockDim.x * threadIdx.y;
   int dxy = blockDim.x * blockDim.y;


int word2vec(int nrows, int ncols, int *WA, int *WB, float *A, float *B, float lrate) {
  const int NSKIP = 5;
  const int NNEG = 6;
  const int NELTS = 5;
  const int NYDIM = 2; 
  dim3 threads(32, NYDIM, 1);

  bool good = false;

#pragma unroll
  for (icol = 0; icol < NSKIP; icol++) {                  // Fill up the data WINDOW
    thiscol = istart + icol + 1;
    good = (thiscol > 0 && thiscol < ncols);
    if (good) {
      wa = WA[thiscol];
