Skip to content

Commit

Permalink
Trim device names
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Nov 21, 2023
1 parent 4c981f0 commit 481278d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/alpaka/dev/Traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "alpaka/core/Common.hpp"
#include "alpaka/core/Concepts.hpp"

#include <boost/algorithm/string/trim.hpp>

#include <cstddef>
#include <string>
#include <vector>
Expand Down Expand Up @@ -65,11 +67,13 @@ namespace alpaka
return trait::GetDev<ImplementationBase>::getDev(t);
}

//! \return The device name.
//! \return The device name with leading/trailing space characters trimmed off.
template<typename TDev>
ALPAKA_FN_HOST auto getName(TDev const& dev) -> std::string
{
return trait::GetName<TDev>::getName(dev);
auto name = trait::GetName<TDev>::getName(dev);
boost::algorithm::trim(name);
return name;
}

//! \return The memory on the device in Bytes. Returns 0 if querying memory
Expand Down

0 comments on commit 481278d

Please sign in to comment.