diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2018-07-13 21:20:27 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2018-07-13 21:20:27 +0200 |
commit | 3621639b63c291d29024339c6fc4f05be8be8a84 (patch) | |
tree | ce1b10189299d422a3484161422c0c854b8bd377 /src/utilities | |
parent | 08b1417956bbaf48611fc0b844ab1bc547089bed (diff) |
Added device-name removal code to handle POCL naming convention
Diffstat (limited to 'src/utilities')
-rw-r--r-- | src/utilities/device_mapping.hpp | 5 | ||||
-rw-r--r-- | src/utilities/utilities.cpp | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/utilities/device_mapping.hpp b/src/utilities/device_mapping.hpp index 7fdc04a0..c814622f 100644 --- a/src/utilities/device_mapping.hpp +++ b/src/utilities/device_mapping.hpp @@ -43,6 +43,11 @@ const std::unordered_map<std::string, std::string> kDeviceNames { // Empty }; +// Things to remove from device names (low-level) +const std::vector<std::string> kDeviceRemovals { + "pthread-" +}; + // ================================================================================================= } // namespace device_mapping } // namespace clblast diff --git a/src/utilities/utilities.cpp b/src/utilities/utilities.cpp index 2008b6a3..a8fdaa19 100644 --- a/src/utilities/utilities.cpp +++ b/src/utilities/utilities.cpp @@ -477,6 +477,14 @@ std::string GetDeviceName(const Device& device) { for (auto &find_and_replace : device_mapping::kDeviceNames) { // replacing to common names if (device_name == find_and_replace.first) { device_name = find_and_replace.second; } } + + for (auto &removal : device_mapping::kDeviceRemovals) { // removing certain things + if (device_name.find(removal) != std::string::npos) { + auto start_position_to_erase = device_name.find(removal); + device_name.erase(start_position_to_erase, removal.length()); + } + } + return device_name; } |