Ë
    P/æjV  ã                   ó  — U d dl Z d dlZd dlmZmZmZ d dlZd dlmZ g Z	ee
   ed<   de
defd„Z eej                  d«      �s# eej                  d	«      rJ ‚ eej                  d
«      rJ ‚ eej                  d«      rJ ‚ eej                  d«      rJ ‚ eej                  d«      rJ ‚ ed«      ej                  j                  d<    ed	«      ej                  j                  d	<    ed
«      ej                  j                  d
<    ed«      ej                  j                  d<    ed«      ej                  j                  d<    ed«      ej                  j                  d<   deddfd„Zdeddfd„Z G d„ d«      Zy)é    N)ÚCallableÚListÚOptional)ÚStorageÚ__all__ÚnameÚreturnc                 ó   ‡ — ˆ fd„}|S )Nc                  ó"   •— t        d‰› d�«      ‚)Nz	torch._C.z" is not supported on this platform)ÚRuntimeError)ÚargsÚkwargsr   s     €úQ/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/torch/cuda/gds.pyÚfnz_dummy_fn.<locals>.fn   s   ø€ Ü˜Y t fÐ,NÐOÓPÐPó    © )r   r   s   ` r   Ú	_dummy_fnr      s   ø€ ôQð €Ir   Ú_gds_register_bufferÚ_gds_deregister_bufferÚ_gds_register_handleÚ_gds_deregister_handleÚ_gds_load_storageÚ_gds_save_storageÚsc                 óB   — t         j                  j                  | «       y©zLRegisters a buffer.

    Args:
        s (Storage): Buffer to register.
    N)ÚtorchÚ_Cr   ©r   s    r   r   r   "   s   € ô 
‡H�H×!Ñ! !Õ$r   c                 óB   — t         j                  j                  | «       yr   )r   r   r   r   s    r   r   r   +   s   € ô 
‡H�H×#Ñ# AÕ&r   c                   ód   — e Zd ZdZdedefd„Zdd„Zdd„Zdd	„Z	dd
e
deddfd„Zdd
e
deddfd„Zy)Ú_GdsFilea±  Wrapper around cuFile.

    cuFile is a file-like interface to the GPUDirect Storage (GDS) API.

    Args:
        filename (str): Name of the file to open.
        flags (int): Flags to pass to ``os.open`` when opening the file. ``os.O_DIRECT`` will
            be added automatically.

    .. _CUDA GPUDirect Storage Documentation:
        https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html#cufile-io-api
    ÚfilenameÚflagsc                 óâ   — t         j                  dk(  rt        d«      ‚|| _        || _        t        j                  ||t
        j                  z  «      | _        d | _	        | j                  «        y )NÚwin32z*GdsFile is not supported on this platform.)ÚsysÚplatformr   r#   r$   ÚosÚopenÚO_DIRECTÚfdÚhandleÚregister_handle)Úselfr#   r$   s      r   Ú__init__z_GdsFile.__init__B   sV   € Ü�<‰<˜7Ò"ÜÐKÓLÐLØ ˆŒØˆŒ
Ü—'‘'˜( E¬B¯K©KÑ$7Ó8ˆŒØ%)ˆŒØ×ÑÕr   r	   Nc                 óz   — | j                   �| j                  «        t        j                  | j                  «       y )N)r-   Úderegister_handler)   Úcloser,   ©r/   s    r   Ú__del__z_GdsFile.__del__K   s(   € Ø�;‰;Ð"Ø×"Ñ"Ô$Ü
�‰�—‘Õr   c                 ó†   — | j                   �J d«       ‚t        j                  j                  | j                  «      | _         y)zpRegisters file descriptor to cuFile Driver.

        This is a wrapper around ``cuFileHandleRegister``.
        Nz4Cannot register a handle that is already registered.)r-   r   r   r   r,   r4   s    r   r.   z_GdsFile.register_handleP   s:   € ð �K‰KÐð	BàAó	BØä—h‘h×3Ñ3°D·G±GÓ<ˆ�r   c                 óŠ   — | j                   €J d«       ‚t        j                  j                  | j                   «       d| _         y)zvDeregisters file descriptor from cuFile Driver.

        This is a wrapper around ``cuFileHandleDeregister``.
        Nz2Cannot deregister a handle that is not registered.)r-   r   r   r   r4   s    r   r2   z_GdsFile.deregister_handleZ   s=   € ð �K‰KÐ#ð	@à?ó	@Ø#ä�‰×'Ñ'¨¯©Ô4Øˆ�r   ÚstorageÚoffsetc                 ó€   — | j                   €J d«       ‚t        j                  j                  | j                   ||«       y)am  Loads data from the file into the storage.

        This is a wrapper around ``cuFileRead``. ``storage.nbytes()`` of data
        will be loaded from the file at ``offset`` into the storage.

        Args:
            storage (Storage): Storage to load data into.
            offset (int, optional): Offset into the file to start loading from. (Default: 0)
        Nz4Cannot load data from a file that is not registered.)r-   r   r   r   ©r/   r8   r9   s      r   Úload_storagez_GdsFile.load_storagee   s:   € ð �K‰KÐ#ð	BàAó	BØ#ä�‰×"Ñ" 4§;¡;°¸Õ@r   c                 ó€   — | j                   €J d«       ‚t        j                  j                  | j                   ||«       y)aU  Saves data from the storage into the file.

        This is a wrapper around ``cuFileWrite``. All bytes of the storage
        will be written to the file at ``offset``.

        Args:
            storage (Storage): Storage to save data from.
            offset (int, optional): Offset into the file to start saving to. (Default: 0)
        Nz2Cannot save data to a file that is not registered.)r-   r   r   r   r;   s      r   Úsave_storagez_GdsFile.save_storaget   s:   € ð �K‰KÐ#ð	@à?ó	@Ø#ä�‰×"Ñ" 4§;¡;°¸Õ@r   )r	   N)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚintr0   r5   r.   r2   r   r<   r>   r   r   r   r"   r"   4   se   „ ñð ð ¨Só óó
=ó	ñA Gð A°Sð AÀó AñA Gð A°Sð AÀô Ar   r"   )r)   r'   Útypingr   r   r   r   Útorch.typesr   r   rC   Ú__annotations__r   Úhasattrr   Ú__dict__r   r   r"   r   r   r   ú<module>rJ      sŠ  ðÜ 	Û 
ß +Ñ +ã Ý ð €ˆˆc‰Ó ð�Cð ˜Hó ñ ˆu�x‰xÐ/Õ0Ù�u—x‘xÐ!9Ô:Ð:Ð:Ù�u—x‘xÐ!7Ô8Ð8Ð8Ù�u—x‘xÐ!9Ô:Ð:Ð:Ù�u—x‘xÐ!4Ô5Ð5Ð5Ù�u—x‘xÐ!4Ô5Ð5Ð5á09Ð:PÓ0Q€E‡H�H×ÑÐ,Ñ-Ù2;Ð<TÓ2U€E‡H�H×ÑÐ.Ñ/Ù09Ð:PÓ0Q€E‡H�H×ÑÐ,Ñ-Ù2;Ð<TÓ2U€E‡H�H×ÑÐ.Ñ/Ù-6Ð7JÓ-K€E‡H�H×ÑÐ)Ñ*Ù-6Ð7JÓ-K€E‡H�H×ÑÐ)Ñ*ð%˜Gð %¨ó %ð'˜gð '¨$ó '÷MAò MAr   