   double bandwidth = gigabytes / seconds;
 
   std::cout << "SAXPY Bandwidth: " << bandwidth << " GB/s" << std::endl;
+}
+
+int main()
+{
+  std::cout << "Measuring the performance of SAXPY using contiguous containers..." << std::endl;
+  using contiguous_container = std::vector<float, agency::cuda::managed_allocator<float>>;
+  time_saxpy<contiguous_container>();
+
+  std::cout << std::endl;
+
+  std::cout << "Measuring the performance of SAXPY using segmented containers..." << std::endl;
+  using segmented_container = agency::cuda::experimental::multidevice_array<float>;
+  time_saxpy<segmented_container>();
 
   return 0;
 }

}


template<class T>
class multidevice_array
{
  public:
    constexpr static size_t num_devices = 2;

    using value_type = T;
    using allocator_type = agency::cuda::managed_allocator<value_type>;

    multidevice_array(size_t n, const value_type& val = value_type{})
      : containers_{container(n/num_devices, val, allocator_type(0)), container(n/num_devices, val, allocator_type(1))}
    {}

    agency::experimental::span<value_type> span(size_t i)
    {
      return agency::experimental::view(containers_[i]);
    }

    agency::experimental::segmented_span<value_type,2> view()
    {
      return agency::experimental::segmented_span<value_type,2>(span(0), span(1));
    }

    value_type& operator[](size_t i)
    {
      return span()[i];
    }

    bool operator==(const multidevice_array& other) const
    {
      return containers_ == other.containers_;
    }

    void clear()
    {
      containers_[0].clear();
      containers_[1].clear();
    }

  private:
    using container = std::vector<value_type, allocator_type>;

    std::array<container,num_devices> containers_;
};


template<class T>
agency::experimental::segmented_span<T,2> view(multidevice_array<T>& a)
{
  return a.view();
}

int main()
{
  using namespace agency;
  using namespace agency::experimental;

  cuda::multidevice_executor exec;

#if GO_FASTER
  using container = multidevice_array<float>;
#else
  using container = std::vector<float, cuda::managed_allocator<float>>;
#endif

  size_t n = 32 << 20;
  container x(n, 1.f), y(n, 2.f), z(n);
  float a = 13.;

  saxpy(exec, n, a, view(x), view(y), view(z));

#include <cassert>
#include <iostream>
#include <chrono>
#include <agency/execution_policy.hpp>
#include <agency/cuda/execution_policy.hpp>
#include <agency/cuda/multidevice_executor.hpp>
#include <agency/cuda/experimental/multidevice_array.hpp>
#include <agency/experimental/view.hpp>


