
    7'hb                     |   d dl Z d dlZd dlZd dlZd Zd Z ej                  e      ZdZ	dZ
ej                  j                  e
d      Zeej                  de
 d        e       Z	n-ej                  de d        e       Z	e	j!                  e       d	Z ed
 e	D              Zer*	 ej)                  d       ddl ej)                  d       dZ ed e	D              Zer,es*	 ej)                  d       ddl ej)                  d       dZde	v Zer,es*	 ej)                  d       ddl ej)                  d       dZde	v Zer,es*	 ej)                  d       ddl ej)                  d       dZes(ej)                  d       ddl ej)                  d       yy# e$ r Zej)                  de       d	ZY dZ[dZ[ww xY w# e$ r Zej)                  de       d	ZY dZ[dZ[ww xY w# e$ r Zej)                  de       d	ZY dZ[dZ[ww xY w# e$ r Zej)                  de       d	ZY dZ[dZ[ww xY w)    Nc                 \    | j                  d      D cg c]  }t        |       c}S c c}w )N.)splitint)vxs     S/home/kushmeetdev/Regenta/Chatbot/venv/lib/python3.12/site-packages/faiss/loader.pyVersionr
      s"    GGCL)qCF)))s   )c                     d } ddl }t        |j                        t        d      k\  rddlm} |j                         D ch c]
  \  }}|s	| }}} |        r|j                  d       t        j                  dd      j                  d	      D ]  }|j                  |        |S t        j                         d
k(  r*t        j                  ddg      d   dk(  rdhS t!               S t        j                         dk(  rSddl}t!               }d|j"                  j$                  j&                  j(                  d   j+                  dd      v r|j                  d       d|j"                  j$                  j&                  j(                  d   j+                  dd      v r|j                  d       d|j"                  j$                  j&                  j(                  d   j+                  dd      v r|j                  d        |        r|j                  d       t        j                  dd      j                  d	      D ]  }|j                  |        |S t!               S c c}}w )a  
    Returns the set of supported CPU features, see
    https://github.com/numpy/numpy/blob/master/numpy/core/src/common/npy_cpu_features.h
    for the list of features that this set may contain per architecture.

    Example:
    >>> supported_instruction_sets()  # for x86
    {"SSE2", "AVX2", "AVX512", ...}
    >>> supported_instruction_sets()  # for PPC
    {"VSX", "VSX2", ...}
    >>> supported_instruction_sets()  # for ARM
    {"NEON", "ASIMD", ...}
    c                  P   t        j                         dk7  ryt        j                         dk7  rydd l} t	        | j
                        t	        d      k\  rydd l} d| j                  j                  j                  j                  d   j                  dd      j                         v S )	Naarch64FLinuxr   z2.0sveFeatures )platformmachinesystemnumpyr
   __version__numpy.distutils.cpuinfo	distutilscpuinfocpuinfogetr   )r   s    r	   is_sve_supportedz4supported_instruction_sets.<locals>.is_sve_supported    s    *??'5$$%7&//3388;??
BOUUWWW    r   Nz1.19)__cpu_features__SVEFAISS_DISABLE_CPU_FEATURESr   z, 	
Darwinz/usr/sbin/sysctlzhw.optional.avx2_01AVX2r   avx2flagsavx512AVX512avx512_fp16
AVX512_SPR)r   r
   r   numpy.core._multiarray_umathr   itemsaddosgetenvr   discardr   r   
subprocesscheck_outputr   setr   r   r   r   r   )r   r   r   kr   	supportedfresults           r	   supported_instruction_setsr9      s   "X u  !WV_4A $4#9#9#;A41aqQA	AMM% 7<BB:N 	!Aa 	! H$""$68L#MNrRVYY8O  5L 
	g	%&U__,,0055a8<<WbIIJJvu..2277:>>wKKJJx EOO3377<<Q?CCGRPPJJ|$JJu7<BB:N 	ANN1	5L5 Bs   
IIFAISS_OPT_LEVELzEnvironment variable zK is not set, so let's pick the instruction set according to the current CPUzUsing z as an instruction set.Fc              #   @   K   | ]  }d |j                         v   yw)r+   Nupper.0r   s     r	   	<genexpr>r@   b   s     I1\QWWY.I   z&Loading faiss with AVX512-SPR support.   )*z2Successfully loaded faiss with AVX512-SPR support.Tz7Could not load library with AVX512-SPR support due to:
c              #   @   K   | ]  }d |j                         v   yw)r)   Nr<   r>   s     r	   r@   r@   n   s     A1QWWY&ArA   z"Loading faiss with AVX512 support.z.Successfully loaded faiss with AVX512 support.z3Could not load library with AVX512 support due to:
r%   z Loading faiss with AVX2 support.z,Successfully loaded faiss with AVX2 support.z1Could not load library with AVX2 support due to:
r    zLoading faiss with SVE support.z+Successfully loaded faiss with SVE support.z0Could not load library with SVE support due to:
zLoading faiss.zSuccessfully loaded faiss.)r   r2   loggingr/   r
   r9   	getLogger__name__loggerinstruction_setsopt_env_variable_nameenvironr   	opt_leveldebugr4   r.   loadedanyhas_AVX512_SPRr   swigfaiss_avx512_sprImportErrore
has_AVX512swigfaiss_avx512has_AVX2swigfaiss_avx2has_SVEswigfaiss_sve	swigfaiss r   r	   <module>r\      su      	*?B 
		8	$  * JJNN0$7	
LL()>(? @Q Q R13
LL6)$;<=u#	I8HII<=+HI A0@AA
f89'DE %%F67%BC #
#
656$AB 
KK !
KK,-	 S  NqeTU  J1%PQ  HNO  GuMNs`   ))F &)G )G. 
)H G#F>>GG+G&&G+.H3HHH;H66H;