 int main(void) {
 
     const size_t N=128*1024*1024;
+    const size_t nchunks=16;
+    const size_t chunk_dim=N/nchunks;
     const size_t size = sizeof(double)*N;
+    const size_t chunk_size = size/nchunks;
 
     // initialize CUDA
     if(!initialize_cuda()) {

    size_t grid_step = blockDim.x * gridDim.x;

    while(tid<N) {
        a[tid] += b[tid];
        tid += grid_step;
    }
}

    T* ptr=0;
    if( pinned ) {
        //cudaHostAlloc((void**)&ptr, N*sizeof(T), cudaHostAllocPortable);
        std::cout << "allocating " << N*sizeof(T) << " bytes pinned host data" << std::endl;
        cudaMallocHost((void**)&ptr, N*sizeof(T));
    }
    else {
        std::cout << "allocating " << N*sizeof(T) << " bytes unpinned host data" << std::endl;
        ptr = reinterpret_cast<T*>(malloc(N*sizeof(T)));
    }
    std::fill(ptr, ptr+N, value);
