 		1
 	};
 
+    auto ptr_out = cuda::memory::managed::make_unique<float[]>(arr.size());
+    // The following is to make it easier to notice if nothing get copied
+    // to the output
+    std::iota(ptr_out.get(), ptr_out.get() + arr.size(), 90);
+//    print_2d_array("Data at ptr_out after initialization", ptr_out.get(), w, h);
+
 	cuda::launch(
 		kernels::from_2D_texture_to_memory_space,
 		cuda::make_launch_config(grid_dims, block_dims),
 		tv.raw_handle(), ptr_out.get(), w, h);
 	cuda::memory::copy(ptr_out.get(), arr);
 	device.synchronize();
-	print_2d_array(ptr_out.get(), w, h);
+	print_2d_array("Data at ptr_out after execution of 'from_2D_texture_to_memory_space'", ptr_out.get(), w, h);
 
 	check_output_is_iota("copy from 2D texture into (managed) global memory", ptr_out.get(), arr.size());
 

}

template <typename T>
void print_2d_array(const T* a, size_t width, size_t height)
{
	for (size_t i = 0; i < height; ++i) {
		for (size_t j = 0; j < width; ++j) {
			std::cout << a[j + i * width] << ' ';

	cuda::memory::copy(ptr_in.get(), other_arr);

	check_output_is_iota("copy from (managed) global memory into a 2D array", ptr_in.get(), arr.size());

	// also asynchronously
	auto stream = cuda::stream::create(device, cuda::stream::async);
	cuda::memory::async::copy(other_arr, ptr_out.get(), stream);
	cuda::memory::async::copy(ptr_in.get(), other_arr, stream);
	device.synchronize();
