32 std::optional<u32> local_id = shamcomm::node_local_rank();
36 u32 valid_dev_cnt = 0;
39 const sycl::platform &plat,
40 const sycl::device &dev) {
49 const sycl::platform &plat,
50 const sycl::device &dev) {
53 if ((*local_id) % valid_dev_cnt == valid_dev_id) {
54 shamlog_debug_sycl_ln(
62 auto PlatformName = plat.get_info<sycl::info::platform::name>();
63 auto DeviceName = dev.get_info<sycl::info::device::name>();
64 shamlog_debug_sycl_ln(
72 shambase::getDevice_type(dev),
75 ret.device_alt = std::make_shared<sham::Device>(
76 sham::sycl_dev_to_sham_dev(key_global, dev));
78 shamlog_debug_sycl_ln(
86 shambase::getDevice_type(dev),
88 ret.device_compute = std::make_shared<sham::Device>(
89 sham::sycl_dev_to_sham_dev(key_global, dev));
97 logger::err_ln(
"Sys",
"cannot query local rank cannot use autodetect");
99 "cannot query local rank cannot use autodetect");
112 [&](
u32 key_global,
const sycl::platform &plat,
const sycl::device &dev) {});
114 if (alt_id >= cnt_dev) {
116 "the alt queue id is larger than the number of queue");
119 if (compute_id >= cnt_dev) {
121 "the compute queue id is larger than the number of queue");
125 [&](
u32 key_global,
const sycl::platform &plat,
const sycl::device &dev) {
126 auto PlatformName = plat.get_info<sycl::info::platform::name>();
127 auto DeviceName = dev.get_info<sycl::info::device::name>();
129 if (key_global == alt_id) {
130 shamlog_debug_sycl_ln(
144 if (key_global == compute_id) {
145 shamlog_debug_sycl_ln(
147 "init comp queue : ",
180 std::string search = sycl_cfg.substr(5);
181 return init_queues_auto(search);
185 size_t split_alt_comp = 0;
186 split_alt_comp = sycl_cfg.find(
":");
188 if (split_alt_comp == std::string::npos) {
189 logger::err_ln(
"NodeInstance",
"sycl-cfg layout should be x:x");
193 std::string alt_cfg = sycl_cfg.substr(0, split_alt_comp);
194 std::string comp_cfg = sycl_cfg.substr(split_alt_comp + 1, sycl_cfg.length());
199 ialt = std::stoi(alt_cfg);
200 }
catch (
const std::invalid_argument &a) {
201 logger::err_ln(
"NodeInstance",
"alt config is not an int");
204 }
catch (
const std::out_of_range &a) {
205 logger::err_ln(
"NodeInstance",
"alt config is to big for an integer");
211 icomp = std::stoi(comp_cfg);
212 }
catch (
const std::invalid_argument &a) {
213 logger::err_ln(
"NodeInstance",
"compute config is not an int");
216 }
catch (
const std::out_of_range &a) {
217 logger::err_ln(
"NodeInstance",
"compute config is to big for an integer");
219 "compute config is to big for an integer");
222 return init_queues(ialt, icomp);
std::uint32_t u32
32 bit unsigned integer
This header file contains utility functions related to exception handling in the code.
Functions related to the MPI communicator.
Device sycl_dev_to_sham_dev(usize i, const sycl::device &dev)
Convert a SYCL device to a shamrock backend device.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
std::string getDevice_type(const sycl::device &Device)
Get the Device Type Name.
bool contain_substr(std::string str, std::string what)
Check if a substring is present in a given string.
namespace for the system handling
DeviceSelectRet_t select_devices(std::string sycl_cfg)
Select the devices for the queues.
u32 for_each_device(std::function< void(u32, const sycl::platform &, const sycl::device &)> fct)
Iterate over all SYCL devices and perform a given function.
This file contains the definition for the stacktrace related functionality.