33 std::optional<u32> local_id = shamcomm::node_local_rank();
37 u32 valid_dev_cnt = 0;
40 const sycl::platform &plat,
41 const sycl::device &dev) {
50 const sycl::platform &plat,
51 const sycl::device &dev) {
54 if ((*local_id) % valid_dev_cnt == valid_dev_id) {
55 shamlog_debug_sycl_ln(
63 auto PlatformName = plat.get_info<sycl::info::platform::name>();
64 auto DeviceName = dev.get_info<sycl::info::device::name>();
65 shamlog_debug_sycl_ln(
76 ret.device_alt = std::make_shared<sham::Device>(
79 shamlog_debug_sycl_ln(
89 ret.device_compute = std::make_shared<sham::Device>(
98 logger::err_ln(
"Sys",
"cannot query local rank cannot use autodetect");
100 "cannot query local rank cannot use autodetect");
113 [&](
u32 key_global,
const sycl::platform &plat,
const sycl::device &dev) {});
115 if (alt_id >= cnt_dev) {
117 "the alt queue id is larger than the number of queue");
120 if (compute_id >= cnt_dev) {
122 "the compute queue id is larger than the number of queue");
126 [&](
u32 key_global,
const sycl::platform &plat,
const sycl::device &dev) {
127 auto PlatformName = plat.get_info<sycl::info::platform::name>();
128 auto DeviceName = dev.get_info<sycl::info::device::name>();
130 if (key_global == alt_id) {
131 shamlog_debug_sycl_ln(
145 if (key_global == compute_id) {
146 shamlog_debug_sycl_ln(
148 "init comp queue : ",
181 std::string search = sycl_cfg.substr(5);
182 return init_queues_auto(search);
186 size_t split_alt_comp = 0;
187 split_alt_comp = sycl_cfg.find(
":");
189 if (split_alt_comp == std::string::npos) {
194 std::string alt_cfg = sycl_cfg.substr(0, split_alt_comp);
195 std::string comp_cfg = sycl_cfg.substr(split_alt_comp + 1, sycl_cfg.length());
200 ialt = std::stoi(alt_cfg);
201 }
catch (
const std::invalid_argument &a) {
205 }
catch (
const std::out_of_range &a) {
206 logger::err_ln(
"NodeInstance",
"alt config is to big for an integer");
212 icomp = std::stoi(comp_cfg);
213 }
catch (
const std::invalid_argument &a) {
217 }
catch (
const std::out_of_range &a) {
218 logger::err_ln(
"NodeInstance",
"compute config is to big for an integer");
220 "compute config is to big for an integer");
223 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.
ExcptTypes make_except_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Create an exception with a message and a location.
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.
void err_ln(std::string module_name, Types... var2)
Prints a log message with multiple arguments followed by a newline.
This file contains the definition for the stacktrace related functionality.
shambase::details::BasicStackEntry StackEntry
Alias for shambase::details::BasicStackEntry.