tensorflow/core/common_runtime/gpu/gpu_allocator_retry_test.cc
// Verifies correct retrying when memory is slightly overcommitted but
// we allow retry.
Verifies correct retrying when memory is slightly overcommitted but
we allow retry.
Verifies correct retrying when memory is slightly overcommitted but we allow retry .
TEST_F(GPUAllocatorRetryTest, RetrySuccess) {
  alloc_.reset(new FakeAllocator(2, 1000));
  LaunchConsumerThreads(3, 1);
  Env::Default()->SleepForMicroseconds(50000);
  JoinConsumerThreads(false, 0);
  for (int i = 0; i < 3; ++i) {
    LOG(INFO) << "Consumer " << i << " is " << consumer_count_[i];
  }
  {
    mutex_lock l(mu_);
    EXPECT_FALSE(has_failed_);
  }
  EXPECT_GT(consumer_count_[0], 0);
  EXPECT_GT(consumer_count_[1], 0);
  EXPECT_GT(consumer_count_[2], 0);
}
TEST_F ( GPUAllocatorRetryTest , RetrySuccess ) { alloc_ . reset ( new FakeAllocator ( 2 , 1000 ) ) ; LaunchConsumerThreads ( 3 , 1 ) ; Env :: Default ( ) -> SleepForMicroseconds ( 50000 ) ; JoinConsumerThreads ( false , 0 ) ; for ( int i = 0 ; i < 3 ; ++ i ) { LOG ( INFO ) << " " << i << " " << consumer_count_ [ i ] ; } { mutex_lock l ( mu_ ) ; EXPECT_FALSE ( has_failed_ ) ; } EXPECT_GT ( consumer_count_ [ 0 ] , 0 ) ; EXPECT_GT ( consumer_count_ [ 1 ] , 0 ) ; EXPECT_GT ( consumer_count_ [ 2 ] , 0 ) ; }
Verifies correct retrying when memory is slightly overcommitted but
we allow retry.
Verifies correct retrying when memory is slightly overcommitted but we allow retry .
// Support up to 2 allocations simultaneously, waits up to 1000 msec for // a chance to alloc. // Launch 3 consumers, each of whom needs 1 unit at a time. // This should be enough time for each consumer to be satisfied many times.