@@ -154,20 +154,41 @@ def check_for_build_information(itk_src):
154154 has_itkbuildinformation = True
155155 return has_itkbuildinformation
156156
157+ # 2075084be6f9988b1ae2231bca607830fe6d772b is sha1 that rename NumberOfThreads into NumberOfWorkUnits in filters
158+ # Author: Dzenan Zukic <[email protected] > 159+ # Date: Tue Jul 17 19:30:02 2018
160+ # so all ancestors need to prevent the benchmarking from using
161+ def check_for_NumberOfThreads (itk_src ):
162+ os .chdir (itk_src )
163+ try :
164+ cmd = ['git' , 'merge-base' ,
165+ '--is-ancestor' , 'HEAD' ,
166+ '2075084be6f9988b1ae2231bca607830fe6d772b' ]
167+ has_itkNumberOfThreads = not bool (subprocess .check_call ( cmd ) )
168+ except subprocess .CalledProcessError :
169+ has_itkNumberOfThreads = False
170+ return has_itkNumberOfThreads
171+
157172def build_benchmarks (benchmark_src , benchmark_bin ,
158173 itk_bin ,
159- itk_has_buildinformation ):
174+ itk_has_buildinformation ,
175+ itk_has_NumberOfThreads ):
160176 os .chdir (benchmark_bin )
161177 if itk_has_buildinformation :
162178 build_information_arg = '-DITK_HAS_INFORMATION_H:BOOL=ON'
163179 else :
164180 build_information_arg = '-DITK_HAS_INFORMATION_H:BOOL=OFF'
181+ if itk_has_NumberOfThreads :
182+ NumberOfThreads_arg = '-DITK_USES_NUMBEROFTHREADS:BOOL=ON'
183+ else :
184+ NumberOfThreads_arg = '-DITK_USES_NUMBEROFTHREADS:BOOL=OFF'
165185 subprocess .check_call (['cmake' ,
166186 '-G' , 'Ninja' ,
167187 '-DCMAKE_BUILD_TYPE:STRING=Release' ,
168188 '-DCMAKE_CXX_STANDARD:STRING=11' ,
169189 '-DITK_DIR:PATH=' + itk_bin ,
170190 build_information_arg ,
191+ NumberOfThreads_arg ,
171192 benchmark_src ])
172193 subprocess .check_call (['ninja' ])
173194
@@ -328,10 +349,11 @@ def has_sha(filepath):
328349 build_itk (args .src , args .bin )
329350
330351 itk_has_buildinformation = check_for_build_information (args .src )
352+ itk_has_NumberOfThreads = check_for_NumberOfThreads (args .src )
331353
332354 print ('\n Building benchmarks...' )
333355 build_benchmarks (benchmark_src , args .benchmark_bin , args .bin ,
334- itk_has_buildinformation )
356+ itk_has_buildinformation , itk_has_NumberOfThreads )
335357
336358 print ('\n Running benchmarks...' )
337359 run_benchmarks (args .benchmark_bin , itk_information )
0 commit comments