Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Commit 4712b8c

Browse files
committed
Reference CUDA back end functions only when CUDA back end is enabled
Add a #if block to temporary_allocator<T,S>::allocate in thrust/detail/allocator/temporary_allocator.inl so that the CUDA back end function thrust::system::cuda::detail::terminate_with_message is referenced only when the CUDA back end is enabled. Putting the reference within the device-specific branch of an NV_IF_TARGET isn't good enough; there are some situations, e.g. 'nvc++ -cuda -stdpar=multicore', where that doesn't work and an explicit check for the CUDA back end is necessary.
1 parent be34b50 commit 4712b8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

thrust/detail/allocator/temporary_allocator.inl

+4
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ __host__ __device__
5050
// note that we pass cnt to deallocate, not a value derived from result.second
5151
deallocate(result.first, cnt);
5252

53+
#if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA
5354
NV_IF_TARGET(NV_IS_HOST, (
5455
throw thrust::system::detail::bad_alloc("temporary_buffer::allocate: get_temporary_buffer failed");
5556
), ( // NV_IS_DEVICE
5657
thrust::system::cuda::detail::terminate_with_message("temporary_buffer::allocate: get_temporary_buffer failed");
5758
));
59+
#else
60+
throw thrust::system::detail::bad_alloc("temporary_buffer::allocate: get_temporary_buffer failed");
61+
#endif
5862
} // end if
5963

6064
return result.first;

0 commit comments

Comments
 (0)