Skip to content

Commit

Permalink
SYCL: Improve print_configuration (kokkos#6795)
Browse files Browse the repository at this point in the history
* SYCL: Improve print_configuration

* Account for all device types

* Reorder output
  • Loading branch information
masterleinad authored Feb 12, 2024
1 parent 65dca52 commit 3611cfe
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions core/src/SYCL/Kokkos_SYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,13 @@ bool SYCL::impl_is_initialized() {
void SYCL::impl_finalize() { Impl::SYCLInternal::singleton().finalize(); }

void SYCL::print_configuration(std::ostream& os, bool verbose) const {
os << "Devices:\n";
os << " KOKKOS_ENABLE_SYCL: yes\n";

os << "\nRuntime Configuration:\n";

os << "macro KOKKOS_ENABLE_SYCL : defined\n";
#ifdef KOKKOS_ENABLE_ONEDPL
os << "macro KOKKOS_ENABLE_ONEDPL : defined\n";
#else
os << "macro KOKKOS_ENABLE_ONEDPL : undefined\n";
#endif
#ifdef KOKKOS_IMPL_SYCL_DEVICE_GLOBAL_SUPPORTED
os << "macro KOKKOS_IMPL_SYCL_DEVICE_GLOBAL_SUPPORTED : defined\n";
#else
Expand All @@ -104,15 +105,40 @@ void SYCL::print_configuration(std::ostream& os, bool verbose) const {
#else
os << "macro SYCL_EXT_ONEAPI_DEVICE_GLOBAL : undefined\n";
#endif

#ifdef KOKKOS_IMPL_SYCL_USE_IN_ORDER_QUEUES
os << "macro KOKKOS_IMPL_SYCL_USE_IN_ORDER_QUEUES : defined\n";
#else
os << "macro KOKKOS_IMPL_SYCL_USE_IN_ORDER_QUEUES : undefined\n";
#endif

if (verbose)
int counter = 0;
int active_device = Kokkos::device_id();
std::cout << "\nAvailable devices: \n";
std::vector<sycl::device> devices = Impl::get_sycl_devices();
for (const auto& device : devices) {
std::string device_type;
switch (device.get_info<sycl::info::device::device_type>()) {
case sycl::info::device_type::cpu: device_type = "cpu"; break;
case sycl::info::device_type::gpu: device_type = "gpu"; break;
case sycl::info::device_type::accelerator:
device_type = "accelerator";
break;
case sycl::info::device_type::custom: device_type = "custom"; break;
case sycl::info::device_type::automatic: device_type = "automatic"; break;
case sycl::info::device_type::host: device_type = "host"; break;
case sycl::info::device_type::all: device_type = "all"; break;
}
os << "[" << device.get_backend() << "]:" << device_type << ':' << counter
<< "] " << device.get_info<sycl::info::device::name>();
if (counter == active_device) os << " : Selected";
os << '\n';
++counter;
}

if (verbose) {
os << '\n';
SYCL::impl_sycl_info(os, m_space_instance->m_queue->get_device());
}
}

void SYCL::fence(const std::string& name) const {
Expand Down

0 comments on commit 3611cfe

Please sign in to comment.