From abf59d439a43842ed2fa630c67b9d68d2b96e2f0 Mon Sep 17 00:00:00 2001 From: Aryan Salmanpour Date: Tue, 17 Dec 2024 12:04:59 -0500 Subject: [PATCH] Add support for ROCR_VISIBLE_DEVICES environment variable (#478) [ROCm/rocdecode commit: e3816a23e6ca522465a81da0eb890ac8734af203] --- .../rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp b/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp index 995392b24f..52c6050d25 100644 --- a/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp +++ b/projects/rocdecode/src/rocdecode/vaapi/vaapi_videodecoder.cpp @@ -536,7 +536,12 @@ rocDecStatus VaapiVideoDecoder::SyncSurface(int pic_idx) { } void VaapiVideoDecoder::GetVisibleDevices(std::vector& visible_devices_vetor) { - char *visible_devices = std::getenv("HIP_VISIBLE_DEVICES"); + // First, check if the ROCR_VISIBLE_DEVICES environment variable is present + char *visible_devices = std::getenv("ROCR_VISIBLE_DEVICES"); + // If ROCR_VISIBLE_DEVICES is not present, check if HIP_VISIBLE_DEVICES is present + if (visible_devices == nullptr) { + visible_devices = std::getenv("HIP_VISIBLE_DEVICES"); + } if (visible_devices != nullptr) { char *token = std::strtok(visible_devices,","); while (token != nullptr) {