
    IЦiV                     F   % S SK r S SKrS SKJrJrJr  S SKrS SKJr  / r	\\
   \S'   S\
S\4S jr\" \R                  S5      (       Gd<  \" \R                  S	5      (       a   e\" \R                  S
5      (       a   e\" \R                  S5      (       a   e\" \R                  S5      (       a   e\" \R                  S5      (       a   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ListOptional)Storage__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     M/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/torch/cuda/gds.pyfn_dummy_fn.<locals>.fn   s    Ytf,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    [         R                  R                  U 5        gz@Registers a buffer.

Args:
    s (Storage): Buffer to register.
N)torch_Cr   r   s    r   r   r   "   s     
HH!!!$r   c                 B    [         R                  R                  U 5        gr   )r   r   r   r    s    r   r   r   +   s     
HH##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)_GdsFile4   a  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                     [         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__B   sP    <<7"KLL 
''(BKK$78%)r   r	   Nc                 ~    U R                   b  U R                  5         [        R                  " U R                  5        g )N)r/   deregister_handler+   closer.   r1   s    r   __del___GdsFile.__del__K   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/   r   r   r   r.   r7   s    r   r0   _GdsFile.register_handleP   s:     KK	BA	Bhh33DGG<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   r7   s    r   r5   _GdsFile.deregister_handleZ   s=     KK#	@?	@#''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   r1   r>   r?   s      r   load_storage_GdsFile.load_storagee   s8     KK#	BA	B#""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   rA   s      r   save_storage_GdsFile.save_storaget   s8     KK#	@?	@#""4;;@r   )r.   r%   r&   r/   )r	   N)r   )__name__
__module____qualname____firstlineno____doc__strintr2   r8   r0   r5   r   rB   rE   __static_attributes__r   r   r   r#   r#   4   sk     S 
=	AG AS A AAG AS A A Ar   r#   )r+   r)   typingr   r   r   r   torch.typesr   r   rL   __annotations__r   hasattrr   __dict__r   r   r#   r   r   r   <module>rT      s   	 
 + +   c C H  uxx/00uxx!9::::uxx!78888uxx!9::::uxx!45555uxx!4555509:P0QEHH,-2;<T2UEHH./09:P0QEHH,-2;<T2UEHH./-67J-KEHH)*-67J-KEHH)*%G % %'g '$ 'MA MAr   