Этот коммит содержится в:
Ben Sander
2016-03-23 01:15:05 -05:00
родитель ab910efb96
Коммит 608bb21797
2 изменённых файлов: 76 добавлений и 0 удалений
+5
Просмотреть файл
@@ -97,3 +97,8 @@ The README with the procedures and tips the team used during this porting effort
* **hipexamine.sh** : Script to scan directory, find all code, and report statistics on how much can be ported with HIP (and identify likely features not yet supported)
* **doc**: Documentation - markdown and doxygen info
## Reporting an issue
Use the [GitHub issue tracker] (https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP/issues).
If reporting a bug, include the output of "hipconfig --full" and samples/1_hipInfo/hipInfo (if possible).
+71
Просмотреть файл
@@ -0,0 +1,71 @@
#include <iostream>
#include <iomanip>
#include <string>
#define CASE_STR(x) case x: return #x;
// Building block functions:
template <typename T>
std::string ToHexString(T v)
{
std::ostringstream ss;
ss << "0x" << std::hex << v;
return ss.str();
};
// Template overloads for ToString to handle various types:
// Note these use C++11 variadic templates
template <typename T>
std::string ToString(T v) {
std::ostringstream ss;
ss << v;
return ss.str();
};
#if 0
template <>
std::string ToString(void* v) {
std::ostringstream ss;
//ss << "0x" << std::setw(16) << std::setfill('0') << std::hex << v;
ss << "0x" << std::hex << v;
return ss.str();
};
#endif
template <>
std::string ToString(hipMemcpyKind v) {
switch(v) {
CASE_STR(hipMemcpyHostToHost);
CASE_STR(hipMemcpyHostToDevice);
CASE_STR(hipMemcpyDeviceToHost);
CASE_STR(hipMemcpyDeviceToDevice);
CASE_STR(hipMemcpyDefault);
default : return ToHexString(v);
};
};
template <>
std::string ToString(hipError_t v) {
return ihipErrorString(v);
};
// Catch empty arguments case
std::string ToString() {
return ("");
}
///
// C++11 variadic template - peels off first argument, converts to string, and calls itself again to peel the next arg.
template <typename T, typename... Args>
std::string ToString(T first, Args... args) {
return ToString(first) + ", " + ToString(args...) ;
}