#include #include "../c++/remote.hpp" namespace { namespace schema { using namespace saw::schema; using TestStruct = Struct< Member, Member, Member, "doubles"> >; using Foo = Interface< Member, "foo"> >; using Calculator = Interface< Member< Function, Int64>, "add" > , Member< Function, Int64>, "multiply" > >; } SAW_TEST("SYCL Test Setup"){ using namespace saw; data host_data; host_data.template get<"foo">() = 321; host_data.template get<"bar">() = 50.0; host_data.template get<"doubles">() = {1024u}; saw::event_loop loop; saw::wait_scope wait{loop}; remote rmt; saw::own> rmt_addr{}; rmt.resolve_address().then([&](auto addr){ rmt_addr = std::move(addr); }).detach(); wait.poll(); SAW_EXPECT(rmt_addr, "Remote Address class hasn't been filled"); auto device = rmt.connect_device(*rmt_addr); data device_data{host_data}; interface cl_iface { [&](data& in, cl::sycl::queue* cmd) -> error_or { cmd->submit([&](cl::sycl::handler& h){ auto acc_buff = in.template access(h); uint64_t si = host_data.template get<"doubles">().size(); h.parallel_for(cl::sycl::range<1>(si), [=] (cl::sycl::id<1> it){ acc_buff[0u].template get<"foo">() = acc_buff[0u].template get<"doubles">().size(); auto& dbls = acc_buff[0u].template get<"doubles">(); dbls.at(it[0u]) = it[0u] * 2.0; }); }); /* cmd->submit([&](cl::sycl::handler& h){ auto acc_buff = in.template access(h); h.copy(acc_buff, &host_data); }); */ /** cl::sycl::host_accessor result{in.get_handle()}; std::cout<().get()<().get()<()<().get()<().get()<(device_data, &device.get_handle()); device.get_handle().wait(); std::cout<().get()<().get()<(); std::cout<