Skip to content

Commit

Permalink
[IDAG] do not select devices from multiple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
fknorr committed May 7, 2024
1 parent 65895cf commit 36a4857
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/device_selection.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ auto pick_devices(const config& cfg, const DevicesOrSelector& user_devices_or_se
}

const auto select_all = [platforms](auto& selector) {
std::unordered_map<BackendT, std::vector<std::pair<DeviceT, size_t>>> scored_devices_by_backend;
std::unordered_map<std::pair<size_t /* index in platforms[] */, BackendT>, std::vector<std::pair<DeviceT, size_t /* score */>>, utils::pair_hash>
scored_devices_by_platform_and_backend;
for(size_t i = 0; i < platforms.size(); ++i) {
const auto devices = platforms[i].get_devices(sycl::info::device_type::all);
for(size_t j = 0; j < devices.size(); ++j) {
Expand All @@ -79,12 +80,12 @@ auto pick_devices(const config& cfg, const DevicesOrSelector& user_devices_or_se
}
const auto score = selector(devices[j]);
if(score < 0) continue;
scored_devices_by_backend[devices[j].get_backend()].push_back(std::pair{devices[j], score});
scored_devices_by_platform_and_backend[{i, devices[j].get_backend()}].push_back(std::pair{devices[j], score});
}
}
size_t max_score = 0;
std::vector<DeviceT> max_score_devices;
for(auto& [backend, scored_devices] : scored_devices_by_backend) {
for(auto& [platform_and_backend, scored_devices] : scored_devices_by_platform_and_backend) {
size_t sum_score = 0;
std::vector<DeviceT> devices;
for(auto& [d, score] : scored_devices) {
Expand Down

0 comments on commit 36a4857

Please sign in to comment.