alpaka
Abstraction Library for Parallel Kernel Acceleration
Loading...
Searching...
No Matches
PlatformGenericSycl.hpp
Go to the documentation of this file.
1/* Copyright 2025 Jan Stephan, Luca Ferragina, Aurora Perego, Andrea Bocci
2 * SPDX-License-Identifier: MPL-2.0
3 */
4
5#pragma once
6
10#include "alpaka/dev/Traits.hpp"
12
13#include <cstddef>
14#include <exception>
15#if ALPAKA_DEBUG >= ALPAKA_DEBUG_MINIMAL
16# include <iostream>
17#endif
18#include <sstream>
19#include <stdexcept>
20#include <vector>
21
22#ifdef ALPAKA_ACC_SYCL_ENABLED
23
24# if ALPAKA_COMP_CLANG
25# pragma clang diagnostic push
26# pragma clang diagnostic ignored "-Wswitch-default"
27# endif
28
29# include <sycl/sycl.hpp>
30
31namespace alpaka
32{
33 namespace detail
34 {
35 template<concepts::Tag TTag>
36 struct SYCLDeviceSelector;
37 } // namespace detail
38
39 //! The SYCL device manager.
40 template<concepts::Tag TTag>
41 struct PlatformGenericSycl : interface::Implements<ConceptPlatform, PlatformGenericSycl<TTag>>
42 {
43 PlatformGenericSycl()
44 {
45 try
46 {
47 m_platform = sycl::platform(detail::SYCLDeviceSelector<TTag>{});
48 m_devices = m_platform->get_devices();
49 m_context = sycl::context{
50 m_devices,
51 [](sycl::exception_list exceptions)
52 {
53 auto ss_err = std::stringstream{};
54 ss_err << "Caught asynchronous SYCL exception(s):\n";
55 for(std::exception_ptr e : exceptions)
56 {
57 try
58 {
59 std::rethrow_exception(e);
60 }
61 catch(sycl::exception const& err)
62 {
63 ss_err << err.what() << " (" << err.code() << ")\n";
64 }
65 }
66 throw std::runtime_error(ss_err.str());
67 }};
68 }
69 catch(sycl::exception const&)
70 {
71 // An error was encountered while constructing the platform. For example, the platform
72 // may not be available, or it may not have any devices associated with it.
73 // Make sure that platform, devices and context data members are empty.
74 m_context.reset();
75 m_devices.clear();
76 m_platform.reset();
77 }
78 }
79
80 [[nodiscard]] auto syclPlatform() -> sycl::platform&
81 {
82 if(not m_platform.has_value())
83 throw std::runtime_error("The underlying SYCL platform is empty and invalid.");
84
85 return m_platform.value();
86 }
87
88 [[nodiscard]] auto syclPlatform() const -> sycl::platform const&
89 {
90 if(not m_platform.has_value())
91 throw std::runtime_error("The underlying SYCL platform is empty and invalid.");
92
93 return m_platform.value();
94 }
95
96 [[nodiscard]] auto syclDevices() -> std::vector<sycl::device>&
97 {
98 return m_devices;
99 }
100
101 [[nodiscard]] auto syclDevices() const -> std::vector<sycl::device> const&
102 {
103 return m_devices;
104 }
105
106 [[nodiscard]] auto syclContext() -> sycl::context&
107 {
108 if(not m_context.has_value())
109 throw std::runtime_error("The underlying SYCL platform is empty and invalid.");
110
111 return m_context.value();
112 }
113
114 [[nodiscard]] auto syclContext() const -> sycl::context const&
115 {
116 if(not m_context.has_value())
117 throw std::runtime_error("The underlying SYCL platform is empty and invalid.");
118
119 return m_context.value();
120 }
121
122 private:
123 std::optional<sycl::platform> m_platform;
124 std::vector<sycl::device> m_devices;
125 std::optional<sycl::context> m_context;
126 };
127
128 namespace trait
129 {
130 //! The SYCL platform device type trait specialization.
131 template<concepts::Tag TTag>
132 struct DevType<PlatformGenericSycl<TTag>>
133 {
134 using type = DevGenericSycl<TTag>;
135 };
136
137 //! The SYCL platform device count get trait specialization.
138 template<concepts::Tag TTag>
139 struct GetDevCount<PlatformGenericSycl<TTag>>
140 {
141 static auto getDevCount(PlatformGenericSycl<TTag> const& platform) -> std::size_t
142 {
144
145 return platform.syclDevices().size();
146 }
147 };
148
149 //! The SYCL platform device get trait specialization.
150 template<concepts::Tag TTag>
151 struct GetDevByIdx<PlatformGenericSycl<TTag>>
152 {
153 static auto getDevByIdx(PlatformGenericSycl<TTag> const& platform, std::size_t const& devIdx)
154 {
156
157 auto const& devices = platform.syclDevices();
158 if(devIdx >= devices.size())
159 {
160 auto ss_err = std::stringstream{};
161 ss_err << "Unable to return device handle for device " << devIdx << ". There are only "
162 << devices.size() << " SYCL devices!";
163 throw std::runtime_error(ss_err.str());
164 }
165
166 auto sycl_dev = devices.at(devIdx);
167
168 // Log this device.
169# if ALPAKA_DEBUG >= ALPAKA_DEBUG_FULL
170 printDeviceProperties(sycl_dev);
171# elif ALPAKA_DEBUG >= ALPAKA_DEBUG_MINIMAL
172 std::cout << __func__ << sycl_dev.template get_info<sycl::info::device::name>() << '\n';
173# endif
174 using SyclPlatform = alpaka::PlatformGenericSycl<TTag>;
175 return typename DevType<SyclPlatform>::type{sycl_dev, platform.syclContext()};
176 }
177
178 private:
179# if ALPAKA_DEBUG >= ALPAKA_DEBUG_FULL
180 //! Prints all the device properties to std::cout.
181 static auto printDeviceProperties(sycl::device const& device) -> void
182 {
184
185 constexpr auto KiB = std::size_t{1024};
186 constexpr auto MiB = KiB * KiB;
187
188 std::cout << "Device type: ";
189 switch(device.get_info<sycl::info::device::device_type>())
190 {
191 case sycl::info::device_type::cpu:
192 std::cout << "CPU";
193 break;
194
195 case sycl::info::device_type::gpu:
196 std::cout << "GPU";
197 break;
198
199 case sycl::info::device_type::accelerator:
200 std::cout << "Accelerator";
201 break;
202
203 case sycl::info::device_type::custom:
204 std::cout << "Custom";
205 break;
206
207 case sycl::info::device_type::automatic:
208 std::cout << "Automatic";
209 break;
210
211 case sycl::info::device_type::host:
212 std::cout << "Host";
213 break;
214
215 // The SYCL spec forbids the return of device_type::all
216 // Including this here to prevent warnings because of
217 // missing cases
218 case sycl::info::device_type::all:
219 std::cout << "All";
220 break;
221 }
222 std::cout << '\n';
223
224 std::cout << "Name: " << device.get_info<sycl::info::device::name>() << '\n';
225
226 std::cout << "Vendor: " << device.get_info<sycl::info::device::vendor>() << '\n';
227
228 std::cout << "Vendor ID: " << device.get_info<sycl::info::device::vendor_id>() << '\n';
229
230 std::cout << "Driver version: " << device.get_info<sycl::info::device::driver_version>() << '\n';
231
232 std::cout << "SYCL version: " << device.get_info<sycl::info::device::version>() << '\n';
233
234# if !defined(ALPAKA_COMP_ICPX)
235 // Not defined by Level Zero back-end
236 std::cout << "Backend version: " << device.get_info<sycl::info::device::backend_version>() << '\n';
237# endif
238
239 std::cout << "Aspects: " << '\n';
240
241# if defined(ALPAKA_COMP_ICPX)
242# if ALPAKA_COMP_ICPX >= ALPAKA_VERSION_NUMBER(53, 2, 0)
243 // These aspects are missing from oneAPI versions < 2023.2.0
244 if(device.has(sycl::aspect::emulated))
245 std::cout << "\t* emulated\n";
246
247 if(device.has(sycl::aspect::host_debuggable))
248 std::cout << "\t* debuggable using standard debuggers\n";
249# endif
250# endif
251
252 if(device.has(sycl::aspect::fp16))
253 std::cout << "\t* supports sycl::half precision\n";
254
255 if(device.has(sycl::aspect::fp64))
256 std::cout << "\t* supports double precision\n";
257
258 if(device.has(sycl::aspect::atomic64))
259 std::cout << "\t* supports 64-bit atomics\n";
260
261 if(device.has(sycl::aspect::image))
262 std::cout << "\t* supports images\n";
263
264 if(device.has(sycl::aspect::online_compiler))
265 std::cout << "\t* supports online compilation of device code\n";
266
267 if(device.has(sycl::aspect::online_linker))
268 std::cout << "\t* supports online linking of device code\n";
269
270 if(device.has(sycl::aspect::queue_profiling))
271 std::cout << "\t* supports queue profiling\n";
272
273 if(device.has(sycl::aspect::usm_device_allocations))
274 std::cout << "\t* supports explicit USM allocations\n";
275
276 if(device.has(sycl::aspect::usm_host_allocations))
277 std::cout << "\t* can access USM memory allocated by sycl::usm::alloc::host\n";
278
279 if(device.has(sycl::aspect::usm_atomic_host_allocations))
280 std::cout << "\t* can access USM memory allocated by sycl::usm::alloc::host atomically\n";
281
282 if(device.has(sycl::aspect::usm_shared_allocations))
283 std::cout << "\t* can access USM memory allocated by sycl::usm::alloc::shared\n";
284
285 if(device.has(sycl::aspect::usm_atomic_shared_allocations))
286 std::cout << "\t* can access USM memory allocated by sycl::usm::alloc::shared atomically\n";
287
288 if(device.has(sycl::aspect::usm_system_allocations))
289 std::cout << "\t* can access memory allocated by the system allocator\n";
290
291 std::cout << "Available compute units: " << device.get_info<sycl::info::device::max_compute_units>()
292 << '\n';
293
294 std::cout << "Maximum work item dimensions: ";
295 auto dims = device.get_info<sycl::info::device::max_work_item_dimensions>();
296 std::cout << dims << std::endl;
297
298 std::cout << "Maximum number of work items:\n";
299 auto const wi_1D = device.get_info<sycl::info::device::max_work_item_sizes<1>>();
300 auto const wi_2D = device.get_info<sycl::info::device::max_work_item_sizes<2>>();
301 auto const wi_3D = device.get_info<sycl::info::device::max_work_item_sizes<3>>();
302 std::cout << "\t* 1D: (" << wi_1D.get(0) << ")\n";
303 std::cout << "\t* 2D: (" << wi_2D.get(0) << ", " << wi_2D.get(1) << ")\n";
304 std::cout << "\t* 3D: (" << wi_3D.get(0) << ", " << wi_3D.get(1) << ", " << wi_3D.get(2) << ")\n";
305
306 std::cout << "Maximum number of work items per work-group: "
307 << device.get_info<sycl::info::device::max_work_group_size>() << '\n';
308
309 std::cout << "Maximum number of sub-groups per work-group: "
310 << device.get_info<sycl::info::device::max_num_sub_groups>() << '\n';
311
312 std::cout << "Supported sub-group sizes: ";
313 auto const sg_sizes = device.get_info<sycl::info::device::sub_group_sizes>();
314 for(auto const& sz : sg_sizes)
315 std::cout << sz << ", ";
316 std::cout << '\n';
317
318 std::cout << "Preferred native vector width (char): "
319 << device.get_info<sycl::info::device::preferred_vector_width_char>() << '\n';
320
321 std::cout << "Native ISA vector width (char): "
322 << device.get_info<sycl::info::device::native_vector_width_char>() << '\n';
323
324 std::cout << "Preferred native vector width (short): "
325 << device.get_info<sycl::info::device::preferred_vector_width_short>() << '\n';
326
327 std::cout << "Native ISA vector width (short): "
328 << device.get_info<sycl::info::device::native_vector_width_short>() << '\n';
329
330 std::cout << "Preferred native vector width (int): "
331 << device.get_info<sycl::info::device::preferred_vector_width_int>() << '\n';
332
333 std::cout << "Native ISA vector width (int): "
334 << device.get_info<sycl::info::device::native_vector_width_int>() << '\n';
335
336 std::cout << "Preferred native vector width (long): "
337 << device.get_info<sycl::info::device::preferred_vector_width_long>() << '\n';
338
339 std::cout << "Native ISA vector width (long): "
340 << device.get_info<sycl::info::device::native_vector_width_long>() << '\n';
341
342 std::cout << "Preferred native vector width (float): "
343 << device.get_info<sycl::info::device::preferred_vector_width_float>() << '\n';
344
345 std::cout << "Native ISA vector width (float): "
346 << device.get_info<sycl::info::device::native_vector_width_float>() << '\n';
347
348 if(device.has(sycl::aspect::fp64))
349 {
350 std::cout << "Preferred native vector width (double): "
351 << device.get_info<sycl::info::device::preferred_vector_width_double>() << '\n';
352
353 std::cout << "Native ISA vector width (double): "
354 << device.get_info<sycl::info::device::native_vector_width_double>() << '\n';
355 }
356
357 if(device.has(sycl::aspect::fp16))
358 {
359 std::cout << "Preferred native vector width (half): "
360 << device.get_info<sycl::info::device::preferred_vector_width_half>() << '\n';
361
362 std::cout << "Native ISA vector width (half): "
363 << device.get_info<sycl::info::device::native_vector_width_half>() << '\n';
364 }
365
366 std::cout << "Maximum clock frequency: " << device.get_info<sycl::info::device::max_clock_frequency>()
367 << " MHz\n";
368
369 std::cout << "Address space size: " << device.get_info<sycl::info::device::address_bits>() << "-bit\n";
370
371 std::cout << "Maximum size of memory object allocation: "
372 << device.get_info<sycl::info::device::max_mem_alloc_size>() << " bytes\n";
373
374 if(device.has(sycl::aspect::image))
375 {
376 std::cout << "Maximum number of simultaneous image object reads per kernel: "
377 << device.get_info<sycl::info::device::max_read_image_args>() << '\n';
378
379 std::cout << "Maximum number of simultaneous image writes per kernel: "
380 << device.get_info<sycl::info::device::max_write_image_args>() << '\n';
381
382 std::cout << "Maximum 1D/2D image width: "
383 << device.get_info<sycl::info::device::image2d_max_width>() << " px\n";
384
385 std::cout << "Maximum 2D image height: "
386 << device.get_info<sycl::info::device::image2d_max_height>() << " px\n";
387
388 std::cout << "Maximum 3D image width: " << device.get_info<sycl::info::device::image3d_max_width>()
389 << " px\n";
390
391 std::cout << "Maximum 3D image height: "
392 << device.get_info<sycl::info::device::image3d_max_height>() << " px\n";
393
394 std::cout << "Maximum 3D image depth: " << device.get_info<sycl::info::device::image3d_max_depth>()
395 << " px\n";
396
397 std::cout << "Maximum number of samplers per kernel: "
398 << device.get_info<sycl::info::device::max_samplers>() << '\n';
399 }
400
401 std::cout << "Maximum kernel argument size: "
402 << device.get_info<sycl::info::device::max_parameter_size>() << " bytes\n";
403
404 std::cout << "Memory base address alignment: "
405 << device.get_info<sycl::info::device::mem_base_addr_align>() << " bit\n";
406
407 auto print_fp_config = [](std::string const& fp, std::vector<sycl::info::fp_config> const& conf)
408 {
409 std::cout << fp << " precision floating-point capabilities:\n";
410
411 auto find_and_print = [&](sycl::info::fp_config val)
412 {
413 auto it = std::find(begin(conf), end(conf), val);
414 std::cout << (it == std::end(conf) ? "No" : "Yes") << '\n';
415 };
416
417 std::cout << "\t* denorm support: ";
418 find_and_print(sycl::info::fp_config::denorm);
419
420 std::cout << "\t* INF & quiet NaN support: ";
421 find_and_print(sycl::info::fp_config::inf_nan);
422
423 std::cout << "\t* round to nearest even support: ";
424 find_and_print(sycl::info::fp_config::round_to_nearest);
425
426 std::cout << "\t* round to zero support: ";
427 find_and_print(sycl::info::fp_config::round_to_zero);
428
429 std::cout << "\t* round to infinity support: ";
430 find_and_print(sycl::info::fp_config::round_to_inf);
431
432 std::cout << "\t* IEEE754-2008 FMA support: ";
433 find_and_print(sycl::info::fp_config::fma);
434
435 std::cout << "\t* correctly rounded divide/sqrt support: ";
436 find_and_print(sycl::info::fp_config::correctly_rounded_divide_sqrt);
437
438 std::cout << "\t* software-implemented floating point operations: ";
439 find_and_print(sycl::info::fp_config::soft_float);
440 };
441
442 if(device.has(sycl::aspect::fp16))
443 {
444 auto const fp16_conf = device.get_info<sycl::info::device::half_fp_config>();
445 print_fp_config("Half", fp16_conf);
446 }
447
448 auto const fp32_conf = device.get_info<sycl::info::device::single_fp_config>();
449 print_fp_config("Single", fp32_conf);
450
451 if(device.has(sycl::aspect::fp64))
452 {
453 auto const fp64_conf = device.get_info<sycl::info::device::double_fp_config>();
454 print_fp_config("Double", fp64_conf);
455 }
456
457 std::cout << "Global memory cache type: ";
458 auto has_global_mem_cache = false;
459 switch(device.get_info<sycl::info::device::global_mem_cache_type>())
460 {
461 case sycl::info::global_mem_cache_type::none:
462 std::cout << "none";
463 break;
464
465 case sycl::info::global_mem_cache_type::read_only:
466 std::cout << "read-only";
467 has_global_mem_cache = true;
468 break;
469
470 case sycl::info::global_mem_cache_type::read_write:
471 std::cout << "read-write";
472 has_global_mem_cache = true;
473 break;
474 }
475 std::cout << '\n';
476
477 if(has_global_mem_cache)
478 {
479 std::cout << "Global memory cache line size: "
480 << device.get_info<sycl::info::device::global_mem_cache_line_size>() << " bytes\n";
481
482 std::cout << "Global memory cache size: "
483 << device.get_info<sycl::info::device::global_mem_cache_size>() / KiB << " KiB\n";
484 }
485
486 std::cout << "Global memory size: " << device.get_info<sycl::info::device::global_mem_size>() / MiB
487 << " MiB" << std::endl;
488
489 std::cout << "Local memory type: ";
490 auto has_local_memory = false;
491 switch(device.get_info<sycl::info::device::local_mem_type>())
492 {
493 case sycl::info::local_mem_type::none:
494 std::cout << "none";
495 break;
496
497 case sycl::info::local_mem_type::local:
498 std::cout << "local";
499 has_local_memory = true;
500 break;
501
502 case sycl::info::local_mem_type::global:
503 std::cout << "global";
504 has_local_memory = true;
505 break;
506 }
507 std::cout << '\n';
508
509 if(has_local_memory)
510 std::cout << "Local memory size: " << device.get_info<sycl::info::device::local_mem_size>() / KiB
511 << " KiB\n";
512
513 std::cout << "Error correction support: "
514 << (device.get_info<sycl::info::device::error_correction_support>() ? "Yes" : "No") << '\n';
515
516 auto print_memory_orders = [](std::vector<sycl::memory_order> const& mem_orders)
517 {
518 for(auto const& cap : mem_orders)
519 {
520 switch(cap)
521 {
522 case sycl::memory_order::relaxed:
523 std::cout << "relaxed";
524 break;
525
526 case sycl::memory_order::acquire:
527 std::cout << "acquire";
528 break;
529
530 case sycl::memory_order::release:
531 std::cout << "release";
532 break;
533
534 case sycl::memory_order::acq_rel:
535 std::cout << "acq_rel";
536 break;
537
538 case sycl::memory_order::seq_cst:
539 std::cout << "seq_cst";
540 break;
541# if defined(ALPAKA_COMP_ICPX)
542 // Stop icpx from complaining about its own internals.
543 case sycl::memory_order::__consume_unsupported:
544 break;
545# endif
546 }
547 std::cout << ", ";
548 }
549 std::cout << '\n';
550 };
551
552 std::cout << "Supported memory orderings for atomic operations: ";
553 auto const mem_orders = device.get_info<sycl::info::device::atomic_memory_order_capabilities>();
554 print_memory_orders(mem_orders);
555
556# if defined(ALPAKA_COMP_ICPX)
557# if ALPAKA_COMP_ICPX >= ALPAKA_VERSION_NUMBER(53, 2, 0)
558 // Not implemented in oneAPI < 2023.2.0
559 std::cout << "Supported memory orderings for sycl::atomic_fence: ";
560 auto const fence_orders = device.get_info<sycl::info::device::atomic_fence_order_capabilities>();
561 print_memory_orders(fence_orders);
562# endif
563# endif
564
565 auto print_memory_scopes = [](std::vector<sycl::memory_scope> const& mem_scopes)
566 {
567 for(auto const& cap : mem_scopes)
568 {
569 switch(cap)
570 {
571 case sycl::memory_scope::work_item:
572 std::cout << "work-item";
573 break;
574
575 case sycl::memory_scope::sub_group:
576 std::cout << "sub-group";
577 break;
578
579 case sycl::memory_scope::work_group:
580 std::cout << "work-group";
581 break;
582
583 case sycl::memory_scope::device:
584 std::cout << "device";
585 break;
586
587 case sycl::memory_scope::system:
588 std::cout << "system";
589 break;
590 }
591 std::cout << ", ";
592 }
593 std::cout << '\n';
594 };
595
596 std::cout << "Supported memory scopes for atomic operations: ";
597 auto const mem_scopes = device.get_info<sycl::info::device::atomic_memory_scope_capabilities>();
598 print_memory_scopes(mem_scopes);
599
600# if defined(ALPAKA_COMP_ICPX)
601# if ALPAKA_COMP_ICPX >= ALPAKA_VERSION_NUMBER(53, 2, 0)
602 // Not implemented in oneAPI < 2023.2.0
603 std::cout << "Supported memory scopes for sycl::atomic_fence: ";
604 auto const fence_scopes = device.get_info<sycl::info::device::atomic_fence_scope_capabilities>();
605 print_memory_scopes(fence_scopes);
606# endif
607# endif
608
609 std::cout << "Device timer resolution: "
610 << device.get_info<sycl::info::device::profiling_timer_resolution>() << " ns\n";
611
612 std::cout << "Built-in kernels: ";
613 auto const builtins = device.get_info<sycl::info::device::built_in_kernel_ids>();
614 for(auto const& b : builtins)
615 std::cout << b.get_name() << ", ";
616 std::cout << '\n';
617
618 std::cout << "Maximum number of subdevices: ";
619 auto const max_subs = device.get_info<sycl::info::device::partition_max_sub_devices>();
620 std::cout << max_subs << '\n';
621
622 if(max_subs > 1)
623 {
624 std::cout << "Supported partition properties: ";
625 auto const part_props = device.get_info<sycl::info::device::partition_properties>();
626 auto has_affinity_domains = false;
627 for(auto const& prop : part_props)
628 {
629 switch(prop)
630 {
631 case sycl::info::partition_property::no_partition:
632 std::cout << "no partition";
633 break;
634
635 case sycl::info::partition_property::partition_equally:
636 std::cout << "equally";
637 break;
638
639 case sycl::info::partition_property::partition_by_counts:
640 std::cout << "by counts";
641 break;
642
643 case sycl::info::partition_property::partition_by_affinity_domain:
644 std::cout << "by affinity domain";
645 has_affinity_domains = true;
646 break;
647# if defined(ALPAKA_COMP_ICPX)
648 case sycl::info::partition_property::ext_intel_partition_by_cslice:
649 std::cout << "by compute slice (Intel extension; deprecated)";
650 break;
651# endif
652 }
653 std::cout << ", ";
654 }
655 std::cout << '\n';
656
657 if(has_affinity_domains)
658 {
659 std::cout << "Supported partition affinity domains: ";
660 auto const aff_doms = device.get_info<sycl::info::device::partition_affinity_domains>();
661 for(auto const& dom : aff_doms)
662 {
663 switch(dom)
664 {
665 case sycl::info::partition_affinity_domain::not_applicable:
666 std::cout << "not applicable";
667 break;
668
669 case sycl::info::partition_affinity_domain::numa:
670 std::cout << "NUMA";
671 break;
672
673 case sycl::info::partition_affinity_domain::L4_cache:
674 std::cout << "L4 cache";
675 break;
676
677 case sycl::info::partition_affinity_domain::L3_cache:
678 std::cout << "L3 cache";
679 break;
680
681 case sycl::info::partition_affinity_domain::L2_cache:
682 std::cout << "L2 cache";
683 break;
684
685 case sycl::info::partition_affinity_domain::L1_cache:
686 std::cout << "L1 cache";
687 break;
688
689 case sycl::info::partition_affinity_domain::next_partitionable:
690 std::cout << "next partitionable";
691 break;
692 }
693 std::cout << ", ";
694 }
695 std::cout << '\n';
696 }
697
698 std::cout << "Current partition property: ";
699 switch(device.get_info<sycl::info::device::partition_type_property>())
700 {
701 case sycl::info::partition_property::no_partition:
702 std::cout << "no partition";
703 break;
704
705 case sycl::info::partition_property::partition_equally:
706 std::cout << "partitioned equally";
707 break;
708
709 case sycl::info::partition_property::partition_by_counts:
710 std::cout << "partitioned by counts";
711 break;
712
713 case sycl::info::partition_property::partition_by_affinity_domain:
714 std::cout << "partitioned by affinity domain";
715 break;
716
717# if defined(ALPAKA_COMP_ICPX)
718 case sycl::info::partition_property::ext_intel_partition_by_cslice:
719 std::cout << "partitioned by compute slice (Intel extension; deprecated)";
720 break;
721# endif
722 }
723 std::cout << '\n';
724
725 std::cout << "Current partition affinity domain: ";
726 switch(device.get_info<sycl::info::device::partition_type_affinity_domain>())
727 {
728 case sycl::info::partition_affinity_domain::not_applicable:
729 std::cout << "not applicable";
730 break;
731
732 case sycl::info::partition_affinity_domain::numa:
733 std::cout << "NUMA";
734 break;
735
736 case sycl::info::partition_affinity_domain::L4_cache:
737 std::cout << "L4 cache";
738 break;
739
740 case sycl::info::partition_affinity_domain::L3_cache:
741 std::cout << "L3 cache";
742 break;
743
744 case sycl::info::partition_affinity_domain::L2_cache:
745 std::cout << "L2 cache";
746 break;
747
748 case sycl::info::partition_affinity_domain::L1_cache:
749 std::cout << "L1 cache";
750 break;
751
752 case sycl::info::partition_affinity_domain::next_partitionable:
753 std::cout << "next partitionable";
754 break;
755 }
756 std::cout << '\n';
757 }
758
759 std::cout.flush();
760 }
761# endif
762 };
763 } // namespace trait
764} // namespace alpaka
765
766# if ALPAKA_COMP_CLANG
767# pragma clang diagnostic pop
768# endif
769
770#endif
#define ALPAKA_DEBUG_FULL_LOG_SCOPE
Definition Debug.hpp:62
ALPAKA_FN_HOST auto end(TView &view) -> Iterator< TView >
Definition Iterator.hpp:133
ALPAKA_FN_HOST auto begin(TView &view) -> Iterator< TView >
Definition Iterator.hpp:127
The alpaka accelerator library.
ALPAKA_FN_HOST auto getDevCount(TPlatform const &platform)
Definition Traits.hpp:55
ALPAKA_FN_HOST auto getDevByIdx(TPlatform const &platform, std::size_t const &devIdx) -> Dev< TPlatform >
Definition Traits.hpp:62
STL namespace.