File tree 2 files changed +25
-0
lines changed 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,27 @@ torch::Tensor decode_jpeg_cuda(
47
47
48
48
TORCH_CHECK (device.is_cuda (), " Expected a cuda device" )
49
49
50
+ int major_version;
51
+ int minor_version;
52
+ nvjpegStatus_t get_major_property_status =
53
+ nvjpegGetProperty (MAJOR_VERSION, &major_version);
54
+ nvjpegStatus_t get_minor_property_status =
55
+ nvjpegGetProperty (MINOR_VERSION, &minor_version);
56
+
57
+ TORCH_CHECK (
58
+ get_major_property_status == NVJPEG_STATUS_SUCCESS,
59
+ " nvjpegGetProperty failed: " ,
60
+ get_major_property_status);
61
+ TORCH_CHECK (
62
+ get_minor_property_status == NVJPEG_STATUS_SUCCESS,
63
+ " nvjpegGetProperty failed: " ,
64
+ get_minor_property_status);
65
+ if ((major_version < 11 ) || ((major_version == 11 ) && (minor_version < 6 ))) {
66
+ TORCH_WARN_ONCE (
67
+ " There is a memory leak issue in the nvjpeg library for CUDA versions < 11.6. "
68
+ " Make sure to rely on CUDA 11.6 or above before using decode_jpeg(..., device='cuda')." );
69
+ }
70
+
50
71
at::cuda::CUDAGuard device_guard (device);
51
72
52
73
// Create global nvJPEG handle
Original file line number Diff line number Diff line change @@ -145,6 +145,10 @@ def decode_jpeg(
145
145
with `nvjpeg <https://developer.nvidia.com/nvjpeg>`_. This is only
146
146
supported for CUDA version >= 10.1
147
147
148
+ .. warning::
149
+ There is a memory leak in the nvjpeg library for CUDA versions < 11.6.
150
+ Make sure to rely on CUDA 11.6 or above before using ``device="cuda"``.
151
+
148
152
Returns:
149
153
output (Tensor[image_channels, image_height, image_width])
150
154
"""
You can’t perform that action at this time.
0 commit comments