 
   size->b = b;
   size->w = w;
+  printf("DONE %ld\n", global_idx + 1000000);
 }
 
 #define THREADS 256
-#define BLOCKS 16
+#define BLOCKS ((input_len + (THREADS * MAX_MATCH * 2) + 1)/(THREADS * MAX_MATCH * 2))
 #define PARTITION_SIZE ((input_len + THREADS * BLOCKS - 1)/(THREADS * BLOCKS))
 comp_size_t compress(uint8_t* input, uint64_t input_len, uint8_t* dst, uint8_t* flags)
 {
   uint8_t *gpu_input, *gpu_dst, *gpu_flags;
   comp_size_t *sizes, *gpu_sizes;
-
+  printf("length: %ld, THREADS: %d, BLOCKS: %ld\n",input_len, THREADS, BLOCKS); fflush(0);
   cudaDeviceSynchronize();
 
   cudaMalloc(&gpu_input, input_len);

  {
    cudaMemcpy(dst + cmp_size.w , gpu_dst + i * PARTITION_SIZE, sizes[i].w, cudaMemcpyDeviceToHost);
    cudaMemcpy(flag_buf + cmp_size.b , gpu_flags + i * PARTITION_SIZE, sizes[i].b, cudaMemcpyDeviceToHost);
    cmp_size.b += sizes[i].b;
    cmp_size.w += sizes[i].w;
  }

  uint64_t w=0;
  uint64_t b=0;
  uint8_t *curr;
  /*
  printf("thread ID: %ld, last idx: %ld\n", global_idx + 100000, min((int64_t)(input_len-partition_off),(int64_t)partition_size));
  return;
  */
  for(;i<min((int64_t)(input_len-partition_off),(int64_t)partition_size) && partition_size > 0;)
  {
    curr = input + i;

    printf("OFFSET %5i\n",partition_off + i + 100000);

    uint64_t window_offset = min(partition_off + i,WINDOW);
    window_match(curr, window_offset, min((uint16_t) input_len-partition_off-i, (uint16_t) partition_size-i), &match);
    if( match.l < MIN_MATCH )
    {
      /* add 0 bit and the byte */
