3131# third item is status - B
3232print ('DAAL version:' , get_daal_version ())
3333
34- exdir = os .path .dirname (os .path .realpath (__file__ ))
34+ runner_path = os .path .realpath (__file__ )
35+ runner_dir = os .path .dirname (runner_path )
36+ examples_rootdir = jp (
37+ os .path .dirname (os .path .abspath (os .path .join (runner_path ,
38+ os .pardir ))),
39+ 'examples' )
3540
3641IS_WIN = False
3742IS_MAC = False
5257assert 8 * struct .calcsize ('P' ) in [32 , 64 ]
5358
5459if 8 * struct .calcsize ('P' ) == 32 :
55- logdir = jp (exdir , '_results' , 'ia32' )
60+ logdir = jp (runner_dir , '_results' , 'ia32' )
5661else :
57- logdir = jp (exdir , '_results' , 'intel64' )
62+ logdir = jp (runner_dir , '_results' , 'intel64' )
63+
64+ ex_log_dirs = [
65+ (jp (examples_rootdir , 'daal4py' ), jp (logdir , 'daal4py' )),
66+ (jp (examples_rootdir , 'sklearnex' ), jp (logdir , 'sklearnex' ))]
5867
5968availabe_devices = []
6069
7382 except RuntimeError :
7483 gpu_available = False
7584 availabe_devices .append ("cpu" )
76- #validate that host and cpu devices avaialbe for logging reasons. Examples and
77- #vaidaton logic assumes that host and cpu devices are always available
85+ # validate that host and cpu devices avaialbe for logging reasons. Examples and
86+ # vaidaton logic assumes that host and cpu devices are always available
7887 print ('Sycl gpu device: {}' .format (gpu_available ))
7988
8089
@@ -129,14 +138,20 @@ def check_library(rule):
129138req_version ['decision_forest_classification_default_dense_batch.py' ] = (2023 , 'P' , 1 )
130139req_version ['decision_forest_classification_traverse_batch.py' ] = (2023 , 'P' , 1 )
131140req_version ['decision_forest_regression_hist_batch.py' ] = (2021 , 'P' , 200 )
141+ req_version ['basic_statistics_spmd.py' ] = (2023 , 'P' , 1 )
142+ req_version ['linear_regression_spmd.py' ] = (2023 , 'P' , 1 )
132143
133144req_device = defaultdict (lambda : [])
145+ req_device ['basic_statistics_spmd.py' ] = ["gpu" ]
146+ req_device ['linear_regression_spmd.py' ] = ["gpu" ]
134147req_device ['sycl/gradient_boosted_regression_batch.py' ] = ["gpu" ]
135148
136149req_library = defaultdict (lambda : [])
150+ req_library ['basic_statistics_spmd.py' ] = ['dpctl' , 'mpi4py' ]
137151req_library ['gbt_cls_model_create_from_lightgbm_batch.py' ] = ['lightgbm' ]
138152req_library ['gbt_cls_model_create_from_xgboost_batch.py' ] = ['xgboost' ]
139153req_library ['gbt_cls_model_create_from_catboost_batch.py' ] = ['catboost' ]
154+ req_library ['linear_regression_spmd.py' ] = ['dpctl' , 'mpi4py' ]
140155
141156req_os = defaultdict (lambda : [])
142157
@@ -148,7 +163,8 @@ def get_exe_cmd(ex, nodist, nostream):
148163 if not check_version (req_version ["sycl/" + os .path .basename (ex )],
149164 get_daal_version ()):
150165 return None
151- if not check_device (req_device ["sycl/" + os .path .basename (ex )], availabe_devices ):
166+ if not check_device (
167+ req_device ["sycl/" + os .path .basename (ex )], availabe_devices ):
152168 return None
153169 if not check_os (req_os ["sycl/" + os .path .basename (ex )], system_os ):
154170 return None
@@ -158,6 +174,14 @@ def get_exe_cmd(ex, nodist, nostream):
158174 return None
159175 if not check_library (req_library [os .path .basename (ex )]):
160176 return None
177+ if os .path .dirname (ex ).endswith ("sklearnex" ) and not nodist and \
178+ ex .endswith ('spmd.py' ):
179+ if not check_device (req_device [os .path .basename (ex )], availabe_devices ):
180+ return None
181+ if not check_version (req_version [os .path .basename (ex )], get_daal_version ()):
182+ return None
183+ if not check_library (req_library [os .path .basename (ex )]):
184+ return None
161185 if any (ex .endswith (x ) for x in ['batch.py' , 'stream.py' ]):
162186 return '"' + sys .executable + '" "' + ex + '"'
163187 if not nostream and ex .endswith ('streaming.py' ):
@@ -169,7 +193,7 @@ def get_exe_cmd(ex, nodist, nostream):
169193 return None
170194
171195
172- def run_all ( nodist = False , nostream = False ):
196+ def run ( exdir , logdir , nodist = False , nostream = False ):
173197 success = 0
174198 n = 0
175199 if not os .path .exists (logdir ):
@@ -184,7 +208,8 @@ def run_all(nodist=False, nostream=False):
184208 logfn = jp (logdir , script .replace ('.py' , '.res' ))
185209 with open (logfn , 'w' ) as logfile :
186210 print ('\n ##### ' + jp (dirpath , script ))
187- execute_string = get_exe_cmd (jp (dirpath , script ), nodist , nostream )
211+ execute_string = get_exe_cmd (jp (dirpath , script ),
212+ nodist , nostream )
188213 if execute_string :
189214 os .chdir (dirpath )
190215 proc = subprocess .Popen (
@@ -201,20 +226,32 @@ def run_all(nodist=False, nostream=False):
201226 print (out )
202227 print (
203228 strftime ("%H:%M:%S" , gmtime ()) + '\t FAILED'
204- '\t ' + script + '\t with errno\t ' + str (proc .returncode )
229+ '\t ' + script + '\t with errno'
230+ '\t ' + str (proc .returncode )
205231 )
206232 else :
207233 success += 1
208- print (strftime ("%H:%M:%S" , gmtime ()) + '\t PASSED\t ' + script )
234+ print (strftime ("%H:%M:%S" , gmtime ()) + '\t '
235+ 'PASSED\t ' + script )
209236 else :
210237 success += 1
211238 print (strftime ("%H:%M:%S" , gmtime ()) + '\t SKIPPED\t ' + script )
239+ return success , n
240+
212241
213- if success != n :
214- print ('{}/{} examples passed/skipped, {} failed' .format (success , n , n - success ))
242+ def run_all (nodist = False , nostream = False ):
243+ success = 0
244+ num = 0
245+ for edir , ldir in ex_log_dirs :
246+ s , n = run (edir , ldir , nodist , nostream )
247+ success += s
248+ num += n
249+ if success != num :
250+ print ('{}/{} examples passed/skipped, '
251+ '{} failed' .format (success , num , num - success ))
215252 print ('Error(s) occured. Logs can be found in ' + logdir )
216253 return 4711
217- print ('{}/{} examples passed/skipped' .format (success , n ))
254+ print ('{}/{} examples passed/skipped' .format (success , num ))
218255 return 0
219256
220257
0 commit comments