From 5cd0cdbdd85eddbb6c6b53b012b8bbd89507fed4 Mon Sep 17 00:00:00 2001 From: RayHE Date: Mon, 8 Apr 2024 09:14:53 -0500 Subject: [PATCH] Add a function to get the platform --- src/Evaluator.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/Evaluator.cpp b/src/Evaluator.cpp index e800e03..6d77017 100644 --- a/src/Evaluator.cpp +++ b/src/Evaluator.cpp @@ -6,8 +6,6 @@ #include -namespace sycl = cl::sycl; - Evaluator::Evaluator(int npts, double _r0) { npoint = npts; @@ -83,26 +81,45 @@ double Evaluator::evalFunction(char func, const double cart[3]) } } +void Evaluator::GetPlatform() +{ + for( auto platform: cl::sycl::platform::get_platforms()) + { + std::cout << " Platform: " + << platform.get_info() + << std::endl; + for(auto device: platform.get_devices()) + { + std::cout <<"\t Device: " + << device.get_info() << std::endl; + } + } + + std::cout << "Out GetPlatform()" << std::endl; +} + void Evaluator::evaluate_sycl(char choice) { + GetPlatform(); - sycl::queue q(sycl::default_selector{}); + //sycl::queue q(sycl::host_selector{}); + cl::sycl::queue q(cl::sycl::default_selector{}); - std::cout << " Running on " << q.get_device().get_info() << "\n\n"; + std::cout << " Running on " << q.get_device().get_info() << "\n\n"; const size_t nsize_loc = nsize; double *field_local = new double[nsize_loc]; - sycl::buffer field_buff(field_local, sycl::range<1>(nsize_loc)); + cl::sycl::buffer field_buff(field_local, cl::sycl::range<1>(nsize_loc)); int np = npoint; double r_0 = r0; double hstep = step; - q.submit([&](sycl::handler &h) + q.submit([&](cl::sycl::handler &h) { - auto field_acc = field_buff.get_access(h); + auto field_acc = field_buff.get_access(h); - h.parallel_for(sycl::range<1>(nsize_loc), [=](sycl::id<1> idx) + h.parallel_for(cl::sycl::range<1>(nsize_loc), [=](cl::sycl::id<1> idx) { double cart[3]; int k = (int)idx % np; int j = ((int)idx / np) % np;