MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/common_runtime/gpu/gpu_vmem_allocator_test.cc:51–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51TEST(GPUVMemAllocatorTest, VMemCreate) {
52 PlatformGpuId platform_gpu_id(0);
53 se::StreamExecutor* se =
54 GpuIdUtil::ExecutorForPlatformGpuId(platform_gpu_id).ValueOrDie();
55 GPUMemAllocator* sub_allocator = new GPUMemAllocator(
56 se, platform_gpu_id, false /*use_unified_memory*/, {}, {});
57 Allocator* device_allocator = new GPUBFCAllocator(sub_allocator, 1 << 30, "GPU_0_bfc");
58
59 // VMEM disabled, expect OOM
60 setenv("TF_GPU_VMEM", "false", 1);
61 Allocator* allocator = maybe_create_gpu_vmem_allocator(device_allocator,
62 0, platform_gpu_id, 0, se);
63 void* raw_ptr = allocator->AllocateRaw(1, (1 << 30) + 1024);
64 CHECK_EQ(raw_ptr, nullptr);
65
66 // VMEM enabled, expect success
67 setenv("TF_GPU_VMEM", "true", 1);
68 setenv("TF_CUDA_HOST_MEM_LIMIT_IN_MB", "1025", 1);
69 allocator = maybe_create_gpu_vmem_allocator(device_allocator,
70 0, platform_gpu_id, 0, se);
71 raw_ptr = allocator->AllocateRaw(1, (1 << 30) + 1024);
72 CHECK_NE(raw_ptr, nullptr);
73
74 // VMEM enbaled, but exceeds host memory size, expect OOM
75 setenv("TF_GPU_VMEM", "true", 1);
76 setenv("TF_CUDA_HOST_MEM_LIMIT_IN_MB", "1024", 1);
77 allocator = maybe_create_gpu_vmem_allocator(device_allocator,
78 0, platform_gpu_id, 0, se);
79 raw_ptr = allocator->AllocateRaw(1, (1 << 30) + 1024);
80 CHECK_EQ(raw_ptr, nullptr);
81}
82
83TEST(GPUVMemAllocatorTest, VMemNoDups) {
84 PlatformGpuId platform_gpu_id(0);

Callers

nothing calls this directly

Calls 12

sortFunction · 0.85
CheckStatsFunction · 0.70
setenvFunction · 0.50
AllocateRawMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
RequestedSizeMethod · 0.45
DeallocateRawMethod · 0.45
ClearStatsMethod · 0.45

Tested by

no test coverage detected