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

Method testGpuGrowth

tensorflow/python/framework/config_test.py:488–509  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

486 @test_util.run_gpu_only
487 @reset_eager
488 def testGpuGrowth(self):
489 gpus = config.list_physical_devices('GPU')
490 self.assertNotEqual(len(gpus), 0)
491
492 self.assertIsNone(config.get_memory_growth(gpus[-1]))
493 for gpu in gpus:
494 config.set_memory_growth(gpu, True)
495
496 c = context.context().config
497 self.assertTrue(c.gpu_options.allow_growth)
498
499 logical_gpus = config.list_logical_devices('GPU')
500 self.assertTrue(len(logical_gpus), len(gpus))
501
502 # Modifying the GPU configuration is not supported
503 with self.assertRaisesRegexp(RuntimeError, 'cannot be modified'):
504 for gpu in gpus:
505 config.set_memory_growth(gpu, False)
506
507 # Setting the same GPU configuration is fine
508 for gpu in gpus:
509 config.set_memory_growth(gpu, True)
510
511 @test_util.run_gpu_only
512 @reset_eager

Callers

nothing calls this directly

Calls 5

list_physical_devicesMethod · 0.80
get_memory_growthMethod · 0.80
set_memory_growthMethod · 0.80
list_logical_devicesMethod · 0.80
contextMethod · 0.45

Tested by

no test coverage detected