tensorflow/core/common_runtime/gpu/gpu_allocator_retry_test.cc
// Verifies OutOfMemory failure when memory is slightly overcommitted
// and retry is not allowed.  Note that this test will fail, i.e. no
// memory alloc failure will be detected, if it is run in a context that
// does not permit real multi-threaded execution.
Verifies OutOfMemory failure when memory is slightly overcommitted
and retry is not allowed.  Note that this test will fail, i.e. no
memory alloc failure will be detected, if it is run in a context that
does not permit real multi-threaded execution.
Verifies OutOfMemory failure when memory is slightly overcommitted and retry is not allowed . Note that this test will fail i . e . no memory alloc failure will be detected if it is run in a context that does not permit real multi - threaded execution .
TEST_F(GPUAllocatorRetryTest, NoRetryFail) {
  alloc_.reset(new FakeAllocator(2, 0));
  LaunchConsumerThreads(3, 1);
  Env::Default()->SleepForMicroseconds(50000);
  JoinConsumerThreads(true, 10000000);
  for (int i = 0; i < 3; ++i) {
    LOG(INFO) << "Consumer " << i << " is " << consumer_count_[i];
  }
  {
    mutex_lock l(mu_);
    EXPECT_TRUE(has_failed_);
  }
}
TEST_F ( GPUAllocatorRetryTest , NoRetryFail ) { alloc_ . reset ( new FakeAllocator ( 2 , 0 ) ) ; LaunchConsumerThreads ( 3 , 1 ) ; Env :: Default ( ) -> SleepForMicroseconds ( 50000 ) ; JoinConsumerThreads ( true , 10000000 ) ; for ( int i = 0 ; i < 3 ; ++ i ) { LOG ( INFO ) << " " << i << " " << consumer_count_ [ i ] ; } { mutex_lock l ( mu_ ) ; EXPECT_TRUE ( has_failed_ ) ; } }
Verifies OutOfMemory failure when memory is slightly overcommitted
and retry is not allowed.
Verifies OutOfMemory failure when memory is slightly overcommitted and retry is not allowed .
// Support up to 2 allocations simultaneously, waits up to 0 msec for // a chance to alloc. // Launch 3 consumers, each of whom needs 1 unit at a time. // Will wait up to 10 seconds for proper race condition to occur, resulting // in failure.