 
 #include <common/timer.h>
 
+using namespace support;
 using namespace visionaray;
+
+using cmdline_options = std::vector<std::shared_ptr<cl::OptionBase>>;
 
 
 namespace visionaray

// See the LICENSE file for details.

#include <cstddef>
#include <iomanip>
#include <iostream>
#include <ostream>
#include <random>

#include <Support/CmdLine.h>
#include <Support/CmdLineUtil.h>

    int width = 512;
    int height = 512;

    bool explicit_copy_mode = false;


    // Setup ----------------------------------------------

    std::cout << std::fixed;
    std::cout << std::setprecision(4);


    // Read command line options
    cl::CmdLine cmd;
    cmdline_options options;

    options.emplace_back( cl::makeOption<size_t&>(
            cl::Parser<>(),
            "num_spheres",
            cl::Desc("Number of random spheres to traverse"),
            cl::ArgRequired,
            cl::init(num_spheres)
            ) );

    options.emplace_back( cl::makeOption<bool&>(
            cl::Parser<>(),
            "explicit_copy",
            cl::Desc("Use explicit memory transfers instead of unified memory"),
            cl::ArgDisallowed,
            cl::init(explicit_copy_mode)
            ) );

    options.emplace_back( cl::makeOption<int&>(
            cl::Parser<>(),
            "width",
            cl::Desc("Image width"),
            cl::ArgRequired,
            cl::init(width)
            ) );

    options.emplace_back( cl::makeOption<int&>(
            cl::Parser<>(),
            "height",
            cl::Desc("Image height"),
            cl::ArgRequired,
            cl::init(height)
            ) );

    for (auto& opt : options)
    {
        cmd.add(*opt);
    }

    auto args = std::vector<std::string>(argv + 1, argv + argc);
    cl::expandWildcards(args);
    cl::expandResponseFiles(args, cl::TokenizeUnix());

    try
    {
        cmd.parse(args);
    }
    catch (...)
    {
        std::cout << cmd.help(argv[0]) << '\n';
        exit(EXIT_FAILURE);
    }


    // Don't measure runtime API initialization overhead
    cudaDeviceSynchronize();

    std::cout << "\n*** CUDA unified memory example ***\n\n";

    if (!explicit_copy_mode)
    {
        std::cout << "Using memory mode: CUDA unified memory\n\n";

