     cudaStream_t stream;
 
     cudaSetDevice(0); // TODO: adjust when we have multiple GPUs; probably assign a new group of threads to each GPU
+
 
     error = cudaStreamCreate(&stream);
 

        args[i].current_chunk_id = &current_chunk_id;
        args[i].host_dataset = dataset;
        args[i].host_outputs = host_outputs;

        int rc = pthread_create(&threads[i], NULL, thread, (void *)&args[i]);
        assert(rc == 0);

// C++ <atomic> doesn't work on Mac for whatever reason
#include <libkern/OSAtomic.h>

// consider electricfence
// http://lh3lh3.users.sourceforge.net/memdebug.shtml
// http://thingsilearned.com/2007/09/30/electric-fence-on-os-x/


typedef struct _output_t {
    double sum;
    double mean;
    double variance;

    double alpha;
    double beta;
    double log_likelihood;
} output_t;

void *thread(void *void_args);

void usage(char **argv)
{
