         
         float* d_w;
         cudaMalloc((void **) &(d_w), sizeof(float)*dim*wordvecs[batch].lens[batch_size-1]);
-        printf("Done allocating d_w \n");
+        if (DEBUG) {
+            printf("Done allocating d_w \n");
+        }
         
         err = cudaGetLastError();
         if (err != cudaSuccess)
             printf("***ERROR***: %s\n", cudaGetErrorString(err));
         
         cudaMemcpy(d_w, wordvecs[batch].w, sizeof(float)*dim*wordvecs[batch].lens[batch_size-1], cudaMemcpyHostToDevice);
-        printf("Done transfering wordvecs[batch].w -> d_w \n");
+        if (DEBUG) {
+            printf("Done transfering wordvecs[batch].w -> d_w \n");
+        }
         d_wordvec.w = d_w;
         
         err = cudaGetLastError();

        d_output.b_size = batch_size;
        long* d_olens;
        cudaMalloc((void **) &(d_olens), sizeof(long)*batch_size);
        printf("Done allocating d_olens \n");
        
        err = cudaGetLastError();
        if (err != cudaSuccess)
            printf("***ERROR***: %s\n", cudaGetErrorString(err));
        
        cudaMemcpy(d_olens, outputs[batch].lens, sizeof(long)*batch_size, cudaMemcpyHostToDevice);
        printf("Done transfering wordvecs[batch].lens -> d_olens \n");
        d_output.lens = d_olens;
        
        err = cudaGetLastError();

    }
    
    // Test output lens for a given mini-batch
    if (DEBUG) {
        printf("i=%d, len=%d, out_len=%d \n", 0, wordvecs[test_batch].lens[0], outputs[test_batch].lens[0]);
        for (int i=1; i < wordvecs[test_batch].b_size; i++) {
            printf("i=%d, len=%d, out_len=%d \n", i, wordvecs[test_batch].lens[i] - wordvecs[test_batch].lens[i-1],  outputs[test_batch].lens[i]-outputs[test_batch].lens[i-1]);
        }
    }

    
    //Allocate outputs
    for (int batch=0; batch < n_batches; batch++) {
        outputs[batch].out = (float*) calloc(kerns.num*outputs[batch].lens[batch_size-1], sizeof(float));
    }
    
    if (DEBUG) {
        // CPU loop
        for (int batch=0; batch < n_batches; batch++) {
            conv1d(wordvecs[batch], kerns, outputs[batch]);
        }
        
        //Testing computation
        printf("CPU Output: \n");
        if (test_idx == 0) {
            print_mat(&(outputs[test_batch].out[0*kerns.num]), outputs[test_batch].lens[test_idx], kerns.num);
        } else {
            print_mat(&(outputs[test_batch].out[outputs[test_batch].lens[test_idx-1]*kerns.num]), outputs[test_batch].lens[test_idx]-outputs[test_batch].lens[test_idx-1], kerns.num);
        }
        
        //Set back output results to zero.
        for (int batch=0; batch < n_batches; batch++) {
            memset(outputs[batch].out, 0, kerns.num*outputs[batch].lens[batch_size-1]*sizeof(float));
        }
    }
    
    //Select the device you want to run the code.
