ó
    EñiÙ  ã                   ó~  • % S SK r S SKrS SKJr  S SKrS SKJr  / SQr\\	   \
S'   S\	S\4S jr\" \R                  S	5      (       GdZ  \" \R                  S
5      (       a  \" S5      e\" \R                  S5      (       a  \" S5      e\" \R                  S5      (       a  \" S5      e\" \R                  S5      (       a  \" S5      e\" \R                  S5      (       a  \" S5      e\" S	5      \R                  R                  S	'   \" S
5      \R                  R                  S
'   \" S5      \R                  R                  S'   \" S5      \R                  R                  S'   \" S5      \R                  R                  S'   \" S5      \R                  R                  S'   S\SS4S jrS\SS4S jr " S S5      rg)é    N)ÚCallable)ÚStorage)Úgds_register_bufferÚgds_deregister_bufferÚGdsFileÚ__all__ÚnameÚreturnc                 ó   ^ • U 4S jnU$ )Nc                  ó"   >• [        ST S35      e)Nz	torch._C.z" is not supported on this platform)ÚRuntimeError)ÚargsÚkwargsr	   s     €ÚK/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/cuda/gds.pyÚfnÚ_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_bufferz?_gds_deregister_buffer exists but _gds_register_buffer does notÚ_gds_register_handlez=_gds_register_handle exists but _gds_register_buffer does notÚ_gds_deregister_handlez?_gds_deregister_handle exists but _gds_register_buffer does notÚ_gds_load_storagez:_gds_load_storage exists but _gds_register_buffer does notÚ_gds_save_storagez:_gds_save_storage exists but _gds_register_buffer does notÚsc                 óB   • [         R                  R                  U 5        g)a  Registers a storage on a CUDA device as a cufile buffer.

Example::

    >>> # xdoctest: +SKIP("gds filesystem requirements")
    >>> src = torch.randn(1024, device="cuda")
    >>> s = src.untyped_storage()
    >>> gds_register_buffer(s)

Args:
    s (Storage): Buffer to register.
N)ÚtorchÚ_Cr   ©r   s    r   r   r   5   s   € ô 
‡H�H×!Ñ! !Õ$r   c                 óB   • [         R                  R                  U 5        g)aS  Deregisters a previously registered storage on a CUDA device as a cufile buffer.

Example::

    >>> # xdoctest: +SKIP("gds filesystem requirements")
    >>> src = torch.randn(1024, device="cuda")
    >>> s = src.untyped_storage()
    >>> gds_register_buffer(s)
    >>> gds_deregister_buffer(s)

Args:
    s (Storage): Buffer to register.
N)r   r   r   r    s    r   r   r   E   s   € ô 
‡H�H×#Ñ# AÕ&r   c                   ó|   • \ rS rSrSrS\S\4S jrSS jrSS	 jr	SS
 jr
SS\S\SS4S jjrSS\S\SS4S jjrSrg)r   éV   a7  Wrapper around cuFile.

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

See the `cufile docs <https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html#cufile-io-api>`_
for more details.

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.

Example::

    >>> # xdoctest: +SKIP("gds filesystem requirements")
    >>> src1 = torch.randn(1024, device="cuda")
    >>> src2 = torch.randn(2, 1024, device="cuda")
    >>> file = torch.cuda.gds.GdsFile(f, os.O_CREAT | os.O_RDWR)
    >>> file.save_storage(src1.untyped_storage(), offset=0)
    >>> file.save_storage(src2.untyped_storage(), offset=src1.nbytes)
    >>> dest1 = torch.empty(1024, device="cuda")
    >>> dest2 = torch.empty(2, 1024, device="cuda")
    >>> file.load_storage(dest1.untyped_storage(), offset=0)
    >>> file.load_storage(dest2.untyped_storage(), offset=src1.nbytes)
    >>> torch.equal(src1, dest1)
    True
    >>> torch.equal(src2, dest2)
    True

ÚfilenameÚflagsc                 óà   • [         R                  S:X  a  [        S5      eXl        X l        [
        R                  " X[
        R                  -  5      U l        S U l	        U R                  5         g )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__ÚGdsFile.__init__v   sP   € Ü�<‰<˜7Ó"ÜÐKÓLÐLØ ŒØŒ
Ü—'’'˜(¬B¯K©KÑ$7Ó8ˆŒØ"&ˆŒØ×ÑÕr   r
   Nc                 ó~   • U R                   b  U R                  5         [        R                  " U R                  5        g )N)r.   Úderegister_handler*   Úcloser-   ©r0   s    r   Ú__del__ÚGdsFile.__del__   s(   € Ø�;‰;Ñ"Ø×"Ñ"Ô$Ü
�Š�—‘Õr   c                 ó�   • U R                   b  [        S5      e[        R                  R	                  U R
                  5      U l         g)z`Registers file descriptor to cuFile Driver.

This is a wrapper around ``cuFileHandleRegister``.
Nz4Cannot register a handle that is already registered.)r.   ÚAssertionErrorr   r   r   r-   r6   s    r   r/   ÚGdsFile.register_handle„   s4   € ð
 �;‰;Ñ"Ü Ð!WÓXÐXÜ—h‘h×3Ñ3°D·G±GÓ<ˆ�r   c                 ó”   • U R                   c  [        S5      e[        R                  R	                  U R                   5        SU l         g)zfDeregisters file descriptor from cuFile Driver.

This is a wrapper around ``cuFileHandleDeregister``.
Nz2Cannot deregister a handle that is not registered.)r.   r:   r   r   r   r6   s    r   r4   ÚGdsFile.deregister_handle�   s7   € ð
 �;‰;ÑÜ Ð!UÓVÐVÜ�‰×'Ñ'¨¯©Ô4Øˆ�r   ÚstorageÚoffsetc                 óˆ   • U R                   c  [        S5      e[        R                  R	                  U R                   X5        g)a=  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   ©r0   r>   r?   s      r   Úload_storageÚGdsFile.load_storage—   s2   € ð �;‰;ÑÜ Ð!WÓXÐXÜ�‰×"Ñ" 4§;¡;°Õ@r   c                 óˆ   • U R                   c  [        S5      e[        R                  R	                  U R                   X5        g)a%  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   rA   s      r   Úsave_storageÚGdsFile.save_storage¥   s2   € ð �;‰;ÑÜ Ð!UÓVÐVÜ�‰×"Ñ" 4§;¡;°Õ@r   )r-   r$   r%   r.   )r
   N)r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚstrÚintr1   r7   r/   r4   r   rB   rE   Ú__static_attributes__r   r   r   r   r   V   sk   † ñð> ð ¨Sô ôô
=ôñA Gð A°Sð AÀõ AñA Gð A°Sð AÀ÷ Að Ar   r   )r*   r(   Úcollections.abcr   r   Útorch.typesr   r   ÚlistrL   Ú__annotations__r   Úhasattrr   r:   Ú__dict__r   r   r   r   r   r   Ú<module>rU      s×  ðÜ 	Û 
Ý $ã Ý ò€ˆˆc‰ó ð�Cð ˜Hô ñ ˆu�x‰xÐ/×0Ò0Ùˆu�x‰xÐ1×2Ñ2ÙØMó
ð 	
ñ ˆu�x‰xÐ/×0Ñ0ÙØKó
ð 	
ñ ˆu�x‰xÐ1×2Ñ2ÙØMó
ð 	
ñ ˆu�x‰xÐ,×-Ñ-ÙØHó
ð 	
ñ ˆu�x‰xÐ,×-Ñ-ÙØHó
ð 	
ñ 1:Ð: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×ÑÐ)Ñ*ð%˜7ð % tô %ð '˜Wð '¨ô '÷"[Aò [Ar   