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

Function TEST_F

tensorflow/core/common_runtime/gpu/gpu_device_test.cc:126–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124};
125
126TEST_F(GPUDeviceTest, CudaMallocAsync) {
127 SessionOptions opts = MakeSessionOptions("0", 0, 1, {},
128 /*use_cuda_malloc_async=*/true);
129 std::vector<std::unique_ptr<Device>> devices;
130 Status status;
131 int number_instantiated = GpuCudaMallocAsyncAllocator::GetInstantiatedCountTestOnly();
132 { // The new scope is to trigger the destruction of the object.
133 status = DeviceFactory::GetFactory("GPU")->CreateDevices(
134 opts, kDeviceNamePrefix, &devices);
135 EXPECT_EQ(devices.size(), 1);
136 Device* device = devices[0].get();
137 auto* device_info = device->tensorflow_gpu_device_info();
138 CHECK(device_info);
139 DeviceContext* device_context = device_info->default_context;
140
141 AllocatorAttributes allocator_attributes = AllocatorAttributes();
142 allocator_attributes.set_gpu_compatible(true);
143 Allocator* allocator = devices[0]->GetAllocator(allocator_attributes);
144 void* ptr = allocator->AllocateRaw(Allocator::kAllocatorAlignment,
145 1024);
146 EXPECT_NE(ptr, nullptr);
147 allocator->DeallocateRaw(ptr);
148 }
149 EXPECT_EQ(number_instantiated + 1 , GpuCudaMallocAsyncAllocator::GetInstantiatedCountTestOnly());
150 EXPECT_EQ(status.code(), error::OK);
151}
152
153TEST_F(GPUDeviceTest, FailedToParseVisibleDeviceList) {
154 SessionOptions opts = MakeSessionOptions("0,abc");

Callers

nothing calls this directly

Calls 15

AllocatorAttributesClass · 0.85
ExpectErrorMessageSubstrFunction · 0.85
GPUMachineManagerFunction · 0.85
GetTotalGPUMemoryFunction · 0.85
cpu_allocatorFunction · 0.85
New64Function · 0.85
set_gpu_compatibleMethod · 0.80
memory_limitMethod · 0.80
NumPendingMethod · 0.80
LastTerminatedCountMethod · 0.80
GetComputeCapabilityFunction · 0.70

Tested by

no test coverage detected