Skip to content

Commit

Permalink
chore(perception): workaround for nvcc > 11.6 (#3310)
Browse files Browse the repository at this point in the history
  • Loading branch information
soblin authored and tkimura4 committed Sep 26, 2024
1 parent 126be79 commit 18dc365
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ namespace cuda
inline void check_error(const ::cudaError_t e, const char * f, int n)
{
if (e != ::cudaSuccess) {
std::stringstream s;
::std::stringstream s;
s << ::cudaGetErrorName(e) << " (" << e << ")@" << f << "#L" << n << ": "
<< ::cudaGetErrorString(e);
throw std::runtime_error{s.str()};
throw ::std::runtime_error{s.str()};
}
}

Expand All @@ -69,13 +69,13 @@ struct deleter
};

template <typename T>
using unique_ptr = std::unique_ptr<T, deleter>;
using unique_ptr = ::std::unique_ptr<T, deleter>;

template <typename T>
typename std::enable_if<std::is_array<T>::value, cuda::unique_ptr<T>>::type make_unique(
const std::size_t n)
typename ::std::enable_if<::std::is_array<T>::value, cuda::unique_ptr<T>>::type make_unique(
const ::std::size_t n)
{
using U = typename std::remove_extent<T>::type;
using U = typename ::std::remove_extent<T>::type;
U * p;
CHECK_CUDA_ERROR(::cudaMalloc(reinterpret_cast<void **>(&p), sizeof(U) * n));
return cuda::unique_ptr<T>{p};
Expand Down Expand Up @@ -107,7 +107,7 @@ inline T * get_next_ptr(size_t num_elem, void *& workspace, size_t & workspace_s
{
size_t size = get_size_aligned<T>(num_elem);
if (size > workspace_size) {
throw std::runtime_error("Workspace is too small!");
throw ::std::runtime_error("Workspace is too small!");
}
workspace_size -= size;
T * ptr = reinterpret_cast<T *>(workspace);
Expand Down
14 changes: 7 additions & 7 deletions perception/tensorrt_yolo/lib/include/cuda_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ namespace cuda
void check_error(const ::cudaError_t e, const char * f, int n)
{
if (e != ::cudaSuccess) {
std::stringstream s;
::std::stringstream s;
s << ::cudaGetErrorName(e) << " (" << e << ")@" << f << "#L" << n << ": "
<< ::cudaGetErrorString(e);
throw std::runtime_error{s.str()};
throw ::std::runtime_error{s.str()};
}
}

Expand All @@ -69,13 +69,13 @@ struct deleter
void operator()(void * p) const { CHECK_CUDA_ERROR(::cudaFree(p)); }
};
template <typename T>
using unique_ptr = std::unique_ptr<T, deleter>;
using unique_ptr = ::std::unique_ptr<T, deleter>;

template <typename T>
typename std::enable_if<std::is_array<T>::value, cuda::unique_ptr<T>>::type make_unique(
const std::size_t n)
typename ::std::enable_if<::std::is_array<T>::value, cuda::unique_ptr<T>>::type make_unique(
const ::std::size_t n)
{
using U = typename std::remove_extent<T>::type;
using U = typename ::std::remove_extent<T>::type;
U * p;
CHECK_CUDA_ERROR(::cudaMalloc(reinterpret_cast<void **>(&p), sizeof(U) * n));
return cuda::unique_ptr<T>{p};
Expand Down Expand Up @@ -107,7 +107,7 @@ inline T * get_next_ptr(size_t num_elem, void *& workspace, size_t & workspace_s
{
size_t size = get_size_aligned<T>(num_elem);
if (size > workspace_size) {
throw std::runtime_error("Workspace is too small!");
throw ::std::runtime_error("Workspace is too small!");
}
workspace_size -= size;
T * ptr = reinterpret_cast<T *>(workspace);
Expand Down

0 comments on commit 18dc365

Please sign in to comment.