From 8c5841ce7dd11b2a11080261f7c24f6b1c4b49e4 Mon Sep 17 00:00:00 2001 From: Robert Cohn Date: Fri, 2 Aug 2024 11:30:02 -0400 Subject: [PATCH] Implement device_init for sycl (#107) --- .../util/include/cutlass/util/helper_cuda.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/util/include/cutlass/util/helper_cuda.hpp b/tools/util/include/cutlass/util/helper_cuda.hpp index 6edb028fb5..62d393eb12 100644 --- a/tools/util/include/cutlass/util/helper_cuda.hpp +++ b/tools/util/include/cutlass/util/helper_cuda.hpp @@ -43,6 +43,22 @@ namespace cute void device_init(int device_id, bool quiet = false) { + +#if defined(CUTLASS_ENABLE_SYCL) + + syclcompat::select_device(device_id); + auto &device = syclcompat::get_current_device(); + + if (!quiet) { + printf("Using device %d: %s (%d Compute Units)\n", + device_id, device.get_device_info().get_name(), + device.get_max_compute_units() + ); + fflush(stdout); + } + +#else + cudaDeviceProp device_prop; std::size_t device_free_physmem; std::size_t device_total_physmem; @@ -65,6 +81,9 @@ device_init(int device_id, bool quiet = false) device_prop.multiProcessorCount); fflush(stdout); } + +#endif + } /**