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

Method testManyCPUs

tensorflow/python/client/session_test.py:117–135  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

115 copy_val)
116
117 def testManyCPUs(self):
118 with session.Session(
119 config=config_pb2.ConfigProto(device_count={
120 'CPU': 2, 'GPU': 0
121 })) as sess:
122 inp = constant_op.constant(10.0, name='W1')
123 self.assertAllEqual(inp.eval(), 10.0)
124
125 num_cpu_devices = 0
126 num_gpu_devices = 0
127 for device in sess.list_devices():
128 device_type = framework_device_lib.DeviceSpec.from_string(
129 device.name).device_type
130 if device_type == 'CPU':
131 num_cpu_devices += 1
132 elif device_type == 'GPU':
133 num_gpu_devices += 1
134 self.assertEqual(2, num_cpu_devices)
135 self.assertEqual(0, num_gpu_devices)
136
137 def testPerSessionThreads(self):
138 with session.Session(

Callers

nothing calls this directly

Calls 6

from_stringMethod · 0.80
SessionMethod · 0.45
constantMethod · 0.45
assertAllEqualMethod · 0.45
evalMethod · 0.45
list_devicesMethod · 0.45

Tested by

no test coverage detected