Skip to content

Instantly share code, notes, and snippets.

@dwilliamson
Created May 9, 2014 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwilliamson/1c2e98679526abf1f323 to your computer and use it in GitHub Desktop.
Save dwilliamson/1c2e98679526abf1f323 to your computer and use it in GitHub Desktop.
CUDA error lookup with clReflect
const char* cudaGetErrorEnum(cudaError_t error)
{
const clcpp::Enum* enum_type = clcpp::GetType<cudaError_t>()->AsEnum();
for (u32 i = 0; i < enum_type->constants.size; i++)
{
const clcpp::EnumConstant* constant = enum_type->constants[i];
if (constant->value == error)
return constant->name.text;
}
return "<unknown>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment