(shm_name, shape, dtype, result_q, error_q)
| 46 | |
| 47 | |
| 48 | def _consumer_proc(shm_name, shape, dtype, result_q, error_q): |
| 49 | # Shard data |
| 50 | try: |
| 51 | paddle.device.set_device("gpu:0") |
| 52 | dummy = paddle.zeros(shape, dtype=dtype) |
| 53 | shared = share_external_data(dummy, shm_name, shape) |
| 54 | result_q.put(("ok", shared.numpy().tolist())) |
| 55 | except Exception as e: |
| 56 | error_q.put(("consumer_error", str(e))) |
| 57 | |
| 58 | |
| 59 | # Use spawn to avoid forking CUDA contexts |