Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/conversion/conversionctx/ConversionCtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ ConversionCtx::ConversionCtx(BuilderSettings build_settings)
util::logging::get_logger().get_is_colored_output_on()) {
// TODO: Support FP16 and FP32 from JIT information
if (settings.device.gpu_id) {
int device_count;
cudaError_t err = cudaGetDeviceCount(&device_count);
TORCHTRT_CHECK(err == cudaSuccess, "Failed to get CUDA device count");
TORCHTRT_CHECK(device_count > 0, "No CUDA devices available but gpu_id specified: " << settings.device.gpu_id);
TORCHTRT_CHECK(settings.device.gpu_id < device_count, "gpu_id " << settings.device.gpu_id << " out of range, available devices: " << device_count);
TORCHTRT_CHECK(
cudaSetDevice(settings.device.gpu_id) == cudaSuccess, "Unable to set gpu id: " << settings.device.gpu_id);
}
Expand Down
7 changes: 7 additions & 0 deletions core/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#ifdef CUDA_VERSION
#define TORCHTRT_CUDA_13_WORKAROUND (CUDA_VERSION >= 13000)
#else
#define TORCHTRT_CUDA_13_WORKAROUND 0
#endif
Loading