MCPcopy Create free account
hub / github.com/NVIDIA/DALI / test_gpu2cpu_old_exec_error

Function test_gpu2cpu_old_exec_error

dali/test/python/test_pipeline.py:2256–2279  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2254
2255
2256def test_gpu2cpu_old_exec_error():
2257 bs = 8
2258
2259 @pipeline_def(
2260 batch_size=bs,
2261 num_threads=4,
2262 device_id=0,
2263 exec_async=False,
2264 exec_pipelined=False,
2265 exec_dynamic=False,
2266 )
2267 def pdef(to_cpu):
2268 gpu = fn.external_source("input", device="gpu")
2269 return to_cpu(gpu)
2270
2271 with assert_raises(RuntimeError, glob="doesn't support transition from GPU to CPU"):
2272 _ = pdef(lambda gpu: gpu.cpu()) # this will raise an error at construction time
2273
2274 pipe = pdef(lambda gpu: gpu._to_backend("cpu")) # this will not raise errors until build-time
2275
2276 with assert_raises(
2277 RuntimeError, glob="GPU->CPU transitions are not allowed in legacy execution model"
2278 ):
2279 pipe.build()
2280
2281
2282def test_gpu2cpu_conditionals():

Callers

nothing calls this directly

Calls 5

assert_raisesFunction · 0.90
pdefFunction · 0.85
_to_backendMethod · 0.80
cpuMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected