Fail gracefully when PTX is not found for a device.

This commit is contained in:
Allison Vacanti
2021-03-05 10:50:57 -05:00
parent b1269b2f7f
commit 27eb2b81ff

View File

@@ -210,6 +210,7 @@ __global__ void noop_kernel()
inline const auto noop_kernel_ptr = &noop_kernel<void>;
[[nodiscard]] inline int get_ptx_version(int dev_id)
try
{
nvbench::detail::device_scope _{dev_id};
cudaFuncAttributes attr{};
@@ -217,6 +218,11 @@ inline const auto noop_kernel_ptr = &noop_kernel<void>;
cudaFuncGetAttributes(&attr, nvbench::detail::noop_kernel_ptr));
return attr.ptxVersion * 10;
}
catch(...)
{ // Fail gracefully when no appropriate PTX is found for this device.
return -1;
}
} // namespace detail
} // namespace nvbench