diff options
Diffstat (limited to 'modules/remote-sycl/benchmarks/mixed_precision.cpp')
| -rw-r--r-- | modules/remote-sycl/benchmarks/mixed_precision.cpp | 68 |
1 files changed, 31 insertions, 37 deletions
diff --git a/modules/remote-sycl/benchmarks/mixed_precision.cpp b/modules/remote-sycl/benchmarks/mixed_precision.cpp index d4b119b..aabe949 100644 --- a/modules/remote-sycl/benchmarks/mixed_precision.cpp +++ b/modules/remote-sycl/benchmarks/mixed_precision.cpp @@ -82,20 +82,20 @@ int main(int argc, char** argv){ if(!rmt_addr){ return -1; } - - cl::sycl::event mixed_ev; - cl::sycl::event float32_ev; - cl::sycl::event float64_ev; + // acpp::sycl::queue cmd_queue; + acpp::sycl::event mixed_ev; + acpp::sycl::event float32_ev; + acpp::sycl::event float64_ev; auto sycl_iface = listen_mixed_precision(mixed_ev, float64_ev, float32_ev, arithmetic_intensity); - data<sch::MixedArray> mixed_host_data; - data<sch::Float64Array> float64_host_data; - data<sch::Float32Array> float32_host_data; + data<sch::MixedArray, encode::Sycl<encode::Native>> mixed_data; + data<sch::Float64Array, encode::Sycl<encode::Native>> float64_data; + data<sch::Float32Array, encode::Sycl<encode::Native>> float32_data; - auto time_eval = [](uint64_t & current_min_time, cl::sycl::event& ev){ - auto end = ev.get_profiling_info<cl::sycl::info::event_profiling::command_end>(); - auto start = ev.get_profiling_info<cl::sycl::info::event_profiling::command_start>(); + auto time_eval = [](uint64_t & current_min_time, acpp::sycl::event& ev){ + auto end = ev.get_profiling_info<acpp::sycl::info::event_profiling::command_end>(); + auto start = ev.get_profiling_info<acpp::sycl::info::event_profiling::command_start>(); uint64_t curr_time = (end-start); current_min_time = std::min(curr_time, current_min_time); @@ -110,22 +110,19 @@ int main(int argc, char** argv){ std::cout<<"Warming up ..."<<std::endl; for(uint64_t test_size = 1ul; test_size < max_test_size; test_size *= 2ul){ - mixed_host_data = {test_size}; - float64_host_data = {test_size}; - float32_host_data = {test_size}; + mixed_data = {{{test_size,}}}; + float64_data = {{{test_size}}}; + float32_data = {{{test_size}}}; for(uint64_t i = 0; i < test_size; ++i){ double gen_num = dis(e1); - mixed_host_data.at(i) = static_cast<double>(gen_num); - float64_host_data.at(i) = static_cast<double>(gen_num); - float32_host_data.at(i) = static_cast<float>(gen_num); + mixed_data.at({{i}}) = {static_cast<double>(gen_num)}; + float64_data.at({{i}}) = {static_cast<double>(gen_num)}; + float32_data.at({{i}}) = {static_cast<float>(gen_num)}; } - data<sch::MixedArray, encode::Sycl<encode::Native>> mixed_device_data{mixed_host_data}; - data<sch::Float64Array, encode::Sycl<encode::Native>> float64_device_data{float64_host_data}; - data<sch::Float32Array, encode::Sycl<encode::Native>> float32_device_data{float32_host_data}; - sycl_iface.template call<"float64_32">(mixed_device_data, &(device.get_handle())); - sycl_iface.template call<"float64">(float64_device_data, &(device.get_handle())); - sycl_iface.template call<"float32">(float32_device_data, &(device.get_handle())); + sycl_iface.template call<"float64_32">(mixed_data, &(device.get_handle())); + sycl_iface.template call<"float64">(float64_data, &(device.get_handle())); + sycl_iface.template call<"float32">(float32_data, &(device.get_handle())); device.get_handle().wait(); } @@ -142,32 +139,29 @@ int main(int argc, char** argv){ (std::cout<<'.').flush(); - data<sch::MixedArray> mixed_host_data; - data<sch::Float64Array> float64_host_data; - data<sch::Float32Array> float32_host_data; + data<sch::MixedArray, encode::Sycl<encode::Native>> mixed_data; + data<sch::Float64Array, encode::Sycl<encode::Native>> float64_data; + data<sch::Float32Array, encode::Sycl<encode::Native>> float32_data; - mixed_host_data = {test_size}; - float64_host_data = {test_size}; - float32_host_data = {test_size}; + mixed_data = {{{test_size}}}; + float64_data = {{{test_size}}}; + float32_data = {{{test_size}}}; for(uint64_t i = 0; i < test_size; ++i){ double gen_num = dis(e1); - mixed_host_data.at(i) = static_cast<double>(gen_num); - float64_host_data.at(i) = static_cast<double>(gen_num); - float32_host_data.at(i) = static_cast<float>(gen_num); + mixed_data.at({{i}}) = {static_cast<double>(gen_num)}; + float64_data.at({{i}}) = {static_cast<double>(gen_num)}; + float32_data.at({{i}}) = {static_cast<float>(gen_num)}; } - data<sch::MixedArray, encode::Sycl<encode::Native>> mixed_device_data{mixed_host_data}; - data<sch::Float64Array, encode::Sycl<encode::Native>> float64_device_data{float64_host_data}; - data<sch::Float32Array, encode::Sycl<encode::Native>> float32_device_data{float32_host_data}; - sycl_iface.template call<"float64_32">(mixed_device_data, &(device.get_handle())); + sycl_iface.template call<"float64_32">(mixed_data, &(device.get_handle())); device.get_handle().wait(); time_eval(time_mixed, mixed_ev); - sycl_iface.template call<"float64">(float64_device_data, &(device.get_handle())); + sycl_iface.template call<"float64">(float64_data, &(device.get_handle())); device.get_handle().wait(); time_eval(time_float64, float64_ev); - sycl_iface.template call<"float32">(float32_device_data, &(device.get_handle())); + sycl_iface.template call<"float32">(float32_data, &(device.get_handle())); device.get_handle().wait(); time_eval(time_float32, float32_ev); } |
