/usr/local/lib64/python3.6/site-packages/torch/cuda/__pycache__
NameSizeModeActions
comm.cpython-36.pyc3720644editdlrm
error.cpython-36.pyc1430644editdlrm
graphs.cpython-36.pyc158110644editdlrm
memory.cpython-36.pyc217170644editdlrm
nccl.cpython-36.pyc34440644editdlrm
nvtx.cpython-36.pyc19660644editdlrm
profiler.cpython-36.pyc16320644editdlrm
random.cpython-36.pyc55200644editdlrm
sparse.cpython-36.pyc1440644editdlrm
streams.cpython-36.pyc94850644editdlrm
_utils.cpython-36.pyc18920644editdlrm
__init__.cpython-36.pyc232100644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/torch/cuda/__pycache__/streams.cpython-36.pyc (9485B)
3 Eg@sddlZddlZddlmZeejdsHedejjd<edejjd<GdddejjZGdd d eZ Gd d d ejj Z dS) N) _dummy_type_CudaStreamBase_CudaEventBasecs|eZdZdZdfdd ZddZdd Zdd d Zfd d ZfddZ e ddZ fddZ ddZ ddZZS)StreamaWrapper around a CUDA stream. A CUDA stream is a linear sequence of execution that belongs to a specific device, independent from other streams. See :ref:`cuda-semantics` for details. Args: device(torch.device or int, optional): a device on which to allocate the stream. If :attr:`device` is ``None`` (default) or a negative integer, this will use the current device. priority(int, optional): priority of the stream. Can be either -1 (high priority) or 0 (low priority). By default, streams have priority 0. .. note:: Although CUDA versions >= 11 support more than two levels of priorities, in PyTorch, we only support two levels of priorities. Nrc s4tjj|tt|j|fd|i|SQRXdS)Npriority)torchcudadevicesuperr__new__)clsr rkwargs) __class__>/usr/local/lib64/python3.6/site-packages/torch/cuda/streams.pyr szStream.__new__cCs|j|dS)aMakes all future work submitted to the stream wait for an event. Args: event (torch.cuda.Event): an event to wait for. .. note:: This is a wrapper around ``cudaStreamWaitEvent()``: see `CUDA Stream documentation`_ for more info. This function returns without waiting for :attr:`event`: only future operations are affected. .. _CUDA Stream documentation: https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__STREAM.html N)wait)selfeventrrr wait_event#szStream.wait_eventcCs|j|jdS)aSynchronizes with another stream. All future work submitted to this stream will wait until all kernels submitted to a given stream at the time of call complete. Args: stream (Stream): a stream to synchronize. .. note:: This function returns without waiting for currently enqueued kernels in :attr:`stream`: only future operations are affected. N)r record_event)rstreamrrr wait_stream4s zStream.wait_streamcCs|dkrt}|j||S)zRecords an event. Args: event (torch.cuda.Event, optional): event to record. If not given, a new one will be allocated. Returns: Recorded event. N)Eventrecord)rrrrrrBs  zStream.record_eventcstt|jS)zChecks if all the work submitted has been completed. Returns: A boolean indicating if all kernels in this stream are completed.)r rquery)r)rrrrQsz Stream.querycstt|jdS)zWait for all the kernels in this stream to complete. .. note:: This is a wrapper around ``cudaStreamSynchronize()``: see `CUDA Stream documentation`_ for more info. N)r r synchronize)r)rrrrXszStream.synchronizecCs tj|jS)N)ctypesc_void_p cuda_stream)rrrr_as_parameter_`szStream._as_parameter_cst|trtt|j|SdS)NF) isinstancerr __eq__)ro)rrrr"ds z Stream.__eq__cCst|j|jfS)N)hashrr )rrrr__hash__iszStream.__hash__cCsdj|j|jS)Nz1)formatr r)rrrr__repr__lszStream.__repr__)Nr)N)__name__ __module__ __qualname____doc__r rrrrrpropertyr r"r%r' __classcell__rr)rrr s     rcs"eZdZdZdfdd ZZS)ExternalStreamaWrapper around an externally allocated CUDA stream. This class is used to wrap streams allocated in other libraries in order to facilitate data exchange and multi-library interactions. .. note:: This class doesn't manage the stream life-cycle, it is the user responsibility to keep the referenced stream alive while this class is being used. Args: stream_ptr(int): Integer representation of the `cudaStream_t` value. allocated externally. device(torch.device or int, optional): the device where the stream was originally allocated. if device is specified incorrectly, subsequent launches using this stream may fail. Nc s4tjj|tt|j|fd|i|SQRXdS)N stream_ptr)rr r r rr )r r/r r)rrrr szExternalStream.__new__)N)r(r)r*r+r r-rr)rrr.qsr.cseZdZdZdfdd ZefddZdfdd Zdfd d Zfd d Z fddZ fddZ fddZ e ddZddZZS)raWrapper around a CUDA event. CUDA events are synchronization markers that can be used to monitor the device's progress, to accurately measure timing, and to synchronize CUDA streams. The underlying CUDA events are lazily initialized when the event is first recorded or exported to another process. After creation, only streams on the same device may record the event. However, streams on any device can wait on the event. Args: enable_timing (bool, optional): indicates if the event should measure time (default: ``False``) blocking (bool, optional): if ``True``, :meth:`wait` will be blocking (default: ``False``) interprocess (bool): if ``True``, the event can be shared between processes (default: ``False``) .. _CUDA Event Documentation: https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__EVENT.html Fcstt|j||||dS)N) enable_timingblocking interprocess)r rr )r r0r1r2)rrrr s z Event.__new__cstt|j||S)zz )r8r&r value)rrrrr'szEvent.__repr__)FFF)N)N)r(r)r*r+r classmethodr3rrrr6rr7r,r r'r-rr)rrrs    r) rr_utilsrhasattr_C__dict__rrr.rrrrrrs  e