o cAM@sddlZddlZddlZddlZzddlmZWnddZYdZdZGdddeZ d d Z d d Z d dZ gdZ gdZgdZgdZgdZgdZddgZgdZgdZddeDZddeDZgdZgdZddZd d!Zd"d#Zd$d%Zd&Zd'd(Zgd)Z gd*Z!gd+Z"e"ddd,Z#gd-Z$gd.Z%gd/Z&gd0Z'e'ddd,Z(gd+d1gd2Z)gd3d1gd2Z*d4d5Z+d6d7Z,dS)8N)mingw32cOsdS)N)argskwargsrr9/usr/lib/python3/dist-packages/numpy/core/setup_common.py sri c@s eZdZdS)MismatchCAPIWarningN)__name__ __module__ __qualname__rrrrr 3sr cCsFddlm}|d}|durtd||dj}t|dkr!dSd S) z7Return True if a released version of numpy is detected.r) LooseVersionz../_version.pyNzCould not get version)vstringFT)distutils.versionr get_version ValueErrorversionlen)configr vpvrrr is_released6s    rcCsVtjd|ztd}td}||j}|}Wtjd=ntjd=w|||fS)z Return current C API checksum and the recorded checksum. Return current C API checksum and the recorded checksum for the given version of the C API version. rgenapi numpy_api)syspathinsert __import__ fullapi_hashfull_apiget_versions_hash) apiversion codegen_dirmr curapi_hash apis_hashrrrget_api_versionsBs    r'cCs@t||\}}||ksd}tj|||||tftdddSdS)z@Emits a MismatchCAPIWarning if the C API version needs updating.aAPI mismatch detected, the C API version numbers have to be updated. Current C api version is %d, with checksum %s, but recorded checksum for C API version %d in core/codegen_dir/cversions.txt is %s. If functions were added in the C API, you have to update C_API_VERSION in %s.) stacklevelN)r'warningswarn__file__r )r"r#r%api_hashmsgrrrcheck_api_versionWs r/)sincostansinhcoshtanhfabsfloorceilsqrtlog10logexpasinacosatanfmodmodffrexpldexp)expm1log1pacoshasinhatanhrinttruncexp2log2hypotatan2powcopysign nextafterftellofseekostrtollstrtoullcbrt strtold_l fallocate backtracemadvise) xmmintrin.h emmintrin.h immintrin.hz features.hz xlocale.hzdlfcn.hz sys/mman.h))__builtin_isnan5.)__builtin_isinfr_)__builtin_isfiniter_)__builtin_bswap325u)__builtin_bswap64rc)__builtin_expectz5, 0)__builtin_mul_overflowz 5, 5, (int*)5) _m_from_int640r\) _mm_load_psz (float*)0r[) _mm_prefetchz(float*)0, _MM_HINT_NTAr[) _mm_load_pdz (double*)0r\)__builtin_prefetchz(float*)0, 0, 3)__asm__ volatilez"vpand %xmm1, %xmm2, %xmm3"stdio.hLINK_AVX)rmz"vpand %ymm1, %ymm2, %ymm3"rn LINK_AVX2)rmz"vpaddd %zmm1, %zmm2, %zmm3"rn LINK_AVX512F)rmz"vfpclasspd $0x40, %zmm15, %k6\n" "vmovdqu8 %xmm0, %xmm1\n" "vpbroadcastmb2q %k0, %xmm0\n"rnLINK_AVX512_SKX)rmz"xgetbv"rnXGETBV))z)__attribute__((optimize("unroll-loops")))attribute_optimize_unroll_loops)z__attribute__((optimize("O3")))attribute_optimize_opt_3)z__attribute__((nonnull (1)))attribute_nonnull)z__attribute__((target ("avx")))attribute_target_avx)z __attribute__((target ("avx2")))attribute_target_avx2)z#__attribute__((target ("avx512f")))attribute_target_avx512f)G__attribute__((target ("avx512f,avx512dq,avx512bw,avx512vl,avx512cd")))attribute_target_avx512_skx))z#__attribute__((target("avx2,fma")))%attribute_target_avx2_with_intrinsicszk__m256 temp = _mm256_set1_ps(1.0); temp = _mm256_fmadd_ps(temp, temp, temp)r])z"__attribute__((target("avx512f")))(attribute_target_avx512f_with_intrinsicsz7__m512i temp = _mm512_castps_si512(_mm512_set1_ps(1.0))r])rz+attribute_target_avx512_skx_with_intrinsicsa"__mmask8 temp = _mm512_fpclass_pd_mask(_mm512_set1_pd(1.0), 0x01); __m512i unused_temp = _mm512_castps_si512(_mm512_set1_ps(1.0)); _mm_mask_storeu_epi8(NULL, 0xFF, _mm_broadcastmb_epi64(temp))r]__threadz__declspec(thread)) rDrErFrHrGrMrPrRrS)#r0r1r2r3r4r5r6r7r8rIrJr9r:r;rEr<rDr=r>r?rGrFrHrMrNrOr@rArBrCrKrLrPrQrVcCg|]}|dqS)fr.0rrrr rcCr)lrrrrrrr)zcomplex doublez complex floatzcomplex long double)cabscacoscacoshcargcasincasinhcatancatanhccosccoshcexpcimagclogconjcpowcprojcrealcsincsinhcsqrtctanctanhcCs d|S)NzHAVE_%s)upper)namerrr fname2defs rcC|dd}|S)N replacersymboldefinerrrsym2def rcCr)Nr_rrrrrtype2defrrc CsJ|tddi}tjdkr'ts'z |jjdWn2tt fy&Yn(wtjdkrN|jj drNd|jj vrN|jj dd}|jj|||||d d ||ddd \}}zGztt|}|WW|St y| d d }|d7}||ddd \}}|jd|j|gdttd}|YW|Sw|w)Ntypez long doublewin32z/GLintelz-ipoz -iporz -shared)compiler compiler_so compiler_cxx linker_exe linker_socstructzvolatile structz)int main(void) { return foo.before[0]; } _configtest)_check_compilerLONG_DOUBLE_REPRESENTATION_SRCrplatformrrcompile_optionsremoveAttributeErrorr compiler_type startswithcc_exerset_executables_compilelong_double_representationpyod_clean temp_filesappendlink_executable)cmdbody newcompilersrcobjltyperrr check_long_double_representationsH           raA /* "before" is 16 bytes to ensure there's no padding between it and "x". * We're not expecting any "long double" bigger than 16 bytes or with * alignment requirements stricter than 16 bytes. */ typedef %(type)s test_type; struct { char before[16]; test_type x; char after[8]; } foo = { { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' }, -123456789.0, { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' } }; cCsg}t|d}dd|D}Wdn1swYtdt|dD]'}dtt|ddg}|d d|||dD|d |q(|S) aPython implementation of the od UNIX utility (od -b, more exactly). Parameters ---------- filename : str name of the file to get the dump from. Returns ------- out : seq list of lines of od output Notes ----- We only implement enough to get the necessary information for long double representation, this is not intended as a compatible replacement for od. rbcSsg|] }t|ddqS)r(N)oct)rorrrrLszpyod..Nrz%07dr(cSsg|]}dt|qS)z%03d)int)rrrrrrOsr) openreadrangerrrextendrjoin)filenameoutfidyo2ilinerrrr8s  r)000rrrrrrr001043105147211253315357)376334272230166124062020)301235157064rrrr) rrrr240242171353031300rr)rrrrrrrrrrrrrrrr) rrrrrrrrrrrr)rr326363r100rrrrrrrrrrr)rrrrrrrrcCsdgd}d}|D]}|ddD]}|d|||ddtkrt|}|ddtddkrQ|ddtkrDd S|ddtkrPd Sq|dd td dkr|d dtkrid S|d dt krud S|d dt krdS|d dt krdS|d dt krdSq|ddtkr|ddt krdS|ddtkrdSqq |durtd|td|)zSGiven a binary dump as given by GNU od -b, look for long double representation.r Nri INTEL_EXTENDED_12_BYTES_LEMOTOROLA_EXTENDED_12_BYTES_BErINTEL_EXTENDED_16_BYTES_LE IEEE_QUAD_BE IEEE_QUAD_LEIBM_DOUBLE_DOUBLE_LEIBM_DOUBLE_DOUBLE_BErIEEE_DOUBLE_LEIEEE_DOUBLE_BEzUnrecognized format (%s)zCould not lock sequences (%s))splitpopr _AFTER_SEQcopy _BEFORE_SEQ_INTEL_EXTENDED_12B_MOTOROLA_EXTENDED_12B_INTEL_EXTENDED_16B_IEEE_QUAD_PREC_BE_IEEE_QUAD_PREC_LE_IBM_DOUBLE_DOUBLE_LE_IBM_DOUBLE_DOUBLE_BE_IEEE_DOUBLE_LE_IEEE_DOUBLE_BEr)linesrsawrwrrrrhsH    $  rcCs>||tddd}|sdS|tddd}| S)a On our arm CI, this fails with an internal compilation error The failure looks like the following, and can be reproduced on ARM64 GCC 5.4: : In function 'right_shift': :4:20: internal compiler error: in expand_shift_1, at expmed.c:2349 ip1[i] = ip1[i] >> in2; ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Compiler returned: 1 This function returns True if this compiler bug is present, and we need to turn off optimization for the function zF __attribute__((optimize("O3"))) void right_shift() {} NFao typedef long the_type; /* fails also for unsigned and long long */ __attribute__((optimize("O3"))) void right_shift(the_type in2, the_type *ip1, int n) { for (int i = 0; i < n; i++) { if (in2 < (the_type)sizeof(the_type) * 8) { ip1[i] = ip1[i] >> in2; } } } )r try_compiletextwrapdedent)r has_optimizeno_errrrr-check_for_right_shift_internal_compiler_errors    r")-rr*rrnumpy.distutils.misc_utilr C_ABI_VERSION C_API_VERSIONWarningr rr'r/MANDATORY_FUNCSOPTIONAL_STDFUNCSOPTIONAL_HEADERSOPTIONAL_INTRINSICSOPTIONAL_FUNCTION_ATTRIBUTES,OPTIONAL_FUNCTION_ATTRIBUTES_WITH_INTRINSICSOPTIONAL_VARIABLE_ATTRIBUTESOPTIONAL_STDFUNCS_MAYBE C99_FUNCSC99_FUNCS_SINGLEC99_FUNCS_EXTENDEDC99_COMPLEX_TYPESC99_COMPLEX_FUNCSrrrrrrrrrrrrrrrrrrr"rrrrsd  / ;