     
     CUDA_SAFE_CALL(cudaMemcpy(output, dev_output, outputSize, cudaMemcpyDeviceToHost));
 
-    
     LOG_PRINTF("gpu done...\n");
 
     bool next = false;

            
            LOG_PRINTF("splitting...\n");

            for (int i = 0 ; i < dupCount ; i += size) {
                if (dupCount < i + size) {
                    work_down(noDuplicates + i, x_max, y_max, dupCount - i, !vertical, depth + 1);
                } else {
                    work_down(noDuplicates + i, x_max, y_max, size, !vertical, depth + 1);
                }
            }
        } else {
            work_down(noDuplicates, x_max, y_max, dupCount, !vertical, depth + 1);
        }

#define CUDA_CHECK_ERROR()    __CUDA_CHECK_ERROR( __FILE__, __LINE__ )
#define GET_INDEX(y_max, x, y) (y_max * x + y)
#define LOG_PRINTF(...) do { \
    struct timeval time_now; \
    gettimeofday(&time_now, NULL); \
    tm* time_str_tm = gmtime(&time_now.tv_sec); \
    printf("%02i:%02i:%02i:%06i : ", time_str_tm->tm_hour, time_str_tm->tm_min, \
            time_str_tm->tm_sec, time_now.tv_usec); \
    printf(__VA_ARGS__); \
} while (0) 
#define LOG_FPRINTF(f, ...) do { \
    struct timeval time_now; \
    gettimeofday(&time_now, NULL); \
    tm* time_str_tm = gmtime(&time_now.tv_sec); \
    fprintf(f, "%02i:%02i:%02i:%06i : ", time_str_tm->tm_hour, time_str_tm->tm_min, \
            time_str_tm->tm_sec, time_now.tv_usec); \
    fprintf(f, __VA_ARGS__); \
} while (0) 

