Skip to content

Commit

Permalink
Restrict use of pinned when there's no GPU.
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Zientkiewicz <[email protected]>
  • Loading branch information
mzient committed Jul 17, 2024
1 parent ddb2f5c commit ae06b04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dali/pipeline/data/buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ DLL_PUBLIC shared_ptr<uint8_t> AllocBuffer(size_t bytes, bool pinned,

DLL_PUBLIC bool RestrictPinnedMemUsage() {
static bool val = []() {
/* int n = 0;
if (cudaGetDeviceCount(&n) != CUDA_SUCCESS)
int n = 0;
if (cudaGetDeviceCount(&n) != cudaSuccess)
return true;
if (n == 0)
return true; */
return true;
const char *env = getenv("DALI_RESTRICT_PINNED_MEM");
return env && atoi(env);
}();
Expand Down

0 comments on commit ae06b04

Please sign in to comment.