def block(self, *args): """ Makes all future work submitted to the ``args`` contexts wait until all computations in the context have finished. Parameters ---------- args : list of :class:`~quagga.context.GpuContext` """ for context in args: self.activate() event = GpuContext._events[self, context] cudart.cuda_event_record(event, self.cuda_stream) context.activate() cudart.cuda_stream_wait_event(context.cuda_stream, event)