
    {Kg                     @    d Z ddlZddlZddlZddlZddlmZ d Zd Zy)z,Helpers for OpenMP support during the build.    N   )compile_test_programc                      t         j                  dk(  rdgS t         j                  dk(  rdt        j                  dd      v rg S dgS )Nwin32z/openmpdarwinopenmpCPPFLAGS z-fopenmp)sysplatformosgetenv     g/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/sklearn/_build_utils/openmp_helpers.pyget_openmp_flagr      sC    
||w{		!h"))J2K&K 	<r   c                     dt         j                  v ryt        j                  d      } t        j                  dd      }|?|j                         j                  d      }|D cg c]  }|j                  d      r| }}t               }d}	 t        | ||      }|rDd	|d
   v r=t        |d
   j                         j                  d      d         }t        |      |k(  }ndt         j                  v rd}nd}|sKt        j                  d      rt        d      |t        j                  d      }	t        j                  |	       |S c c}w # t        $ r}d}|}Y d}~fd}~ww xY w)z6Check whether OpenMP test code can be compiled and runPYODIDEFz        #include <omp.h>
        #include <stdio.h>
        int main(void) {
        #pragma omp parallel
        printf("nthreads=%d\n", omp_get_num_threads());
        return 0;
        }
        LDFLAGSN )z-Lz
-Wl,-rpathz-lz-Wl,--sysroot=/)extra_preargsextra_postargsz	nthreads=r   =r   PYTHON_CROSSENVTSKLEARN_FAIL_NO_OPENMPz0Failed to build scikit-learn with OpenMP supportas  

                                ***********
                                * WARNING *
                                ***********

                It seems that scikit-learn cannot be built with OpenMP.

                - Make sure you have followed the installation instructions:

                    https://scikit-learn.org/dev/developers/advanced_installation.html

                - If your compiler supports OpenMP but you still see this
                  message, please submit a bug report at:

                    https://github.com/scikit-learn/scikit-learn/issues

                - The build will continue with OpenMP-based parallelism
                  disabled. Note however that some estimators will run in
                  sequential mode instead of leveraging thread-based
                  parallelism.

                                    ***
                )r   environtextwrapdedentr   stripsplit
startswithr   r   intlen	Exceptionwarningswarn)
coder   flagr   openmp_exceptionoutputnthreadsopenmp_supported	exceptionmessages
             r   check_openmp_supportr/   #   s|   BJJ??	
D IIi.M %++-33C8
 &
%LM % 	 
 %&N%%n
 kVAY.6!9??,2237:;H"6{h6"**,  $$ 99-.B#$ ooG4 MM'"K
2  % !$%s   $EA+E 	E#EE#)	__doc__r   r   r   r%   pre_build_helpersr   r   r/   r   r   r   <module>r2      s$    2 
 
   3(\r   