   using outer_executor_type = cuda::this_thread::parallel_executor;
   using inner_executor_type = cuda::grid_executor;
 
+  int num_devices = 0;
+  cudaError_t error = cudaGetDeviceCount(&num_devices);
+  if(error)
+  {
+    std::string what("CUDA error after cudaGetDeviceCount(): ");
+    what += std::string(cudaGetErrorString(error));
+    throw std::runtime_error(what);
+  }
+
   {
     // test executor_array then_execute()
     using executor_type = executor_array<inner_executor_type, outer_executor_type>;

    using shape_type = typename traits::shape_type;
    using index_type = typename traits::index_type;

    executor_type exec(2);

    for(size_t i = 0; i < 2; ++i)
    {
      exec[i].device(i);
    }

    auto shape = exec.make_shape(2,{2,2});

    auto f = traits::async_execute(exec, [] __host__ __device__ (const index_type& idx, int& outer_shared, int& inner_shared, int& inner_inner_shared)
    {

    using shape_type = typename traits::shape_type;
    using index_type = typename traits::index_type;

    executor_array_type exec_array(num_devices);

    for(size_t i = 0; i < exec_array.size(); ++i)
    {
      exec_array[i].device(i);
    }

    executor_type exec{exec_array};

    shape_type shape{exec_array.size(), 2};

    auto ready = traits::make_ready_future<void>(exec);

