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

Method testGpuMultiple

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

Source from the content-addressed store, hash-verified

422
423 @reset_eager
424 def testGpuMultiple(self):
425 gpus = config.list_physical_devices('GPU')
426 if len(gpus) < 2:
427 self.skipTest('Need at least 2 GPUs')
428
429 context.ensure_initialized()
430
431 for i in range(0, len(gpus)):
432 with ops.device('/device:GPU:' + str(i)):
433 a = constant_op.constant(1.0)
434 self.evaluate(a)
435
436 with self.assertRaisesRegexp(RuntimeError, 'unknown device'):
437 with ops.device('/device:GPU:' + str(len(gpus))):
438 a = constant_op.constant(1.0)
439 self.evaluate(a)
440
441 @test_util.run_gpu_only
442 @reset_eager

Callers

nothing calls this directly

Calls 6

list_physical_devicesMethod · 0.80
ensure_initializedMethod · 0.80
rangeFunction · 0.50
deviceMethod · 0.45
constantMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected