nvbench
nvbench copied to clipboard
Reasonable enum defaults don't work
Not specifying the optional NVBENCH_DECLARE_ENUM_TYPE_STRINGS
causes compiler errors:
error: no instance of overloaded function "std::to_string" matches the argument list
This should be easy to reproduce by commenting out the NVBENCH_DECLARE_ENUM_TYPE_STRINGS
part of the enums.cu
example.
My setup is cuda11.4.3 and gcc10.3.0.
Also, when using NVBENCH_DECLARE_ENUM_TYPE_STRINGS
, it needs to be at global namespace scope. If I put it in a namespace, compilation fails with hundreds of unhelpful errors:
error: identifier "enum_type" is undefined
error: type_strings is not a template
error: expected a ";"
error: namespace "my_namespace::nvbench" has no member "enum_type_list"
...
The fourth one is somewhat helpful, but still this should be documented (at least in the comments of enums.cu
for the time being).
Definitely agree about documenting the macro/namespace issue. I thought I'd mentioned it somewhere, but maybe not. It should be made clearer in either case.
We should also look into making this work for enums without the macro, and add tests for this. It's probably a matter of adding some std::underlying_type
bits. We'd only be able to print the integer value of the enum, but that's significantly better than a compile error 😅