@@ -152,20 +152,41 @@ def check_for_build_information(itk_src):
152152 has_itkbuildinformation = True
153153 return has_itkbuildinformation
154154
155+ # 2075084be6f9988b1ae2231bca607830fe6d772b is sha1 that rename NumberOfThreads into NumberOfWorkUnits in filters
156+ # Author: Dzenan Zukic <[email protected] > 157+ # Date: Tue Jul 17 19:30:02 2018
158+ # so all ancestors need to prevent the benchmarking from using
159+ def check_for_NumberOfThreads (itk_src ):
160+ os .chdir (itk_src )
161+ try :
162+ cmd = ['git' , 'merge-base' ,
163+ '--is-ancestor' , 'HEAD' ,
164+ '2075084be6f9988b1ae2231bca607830fe6d772b' ]
165+ has_itkNumberOfThreads = not bool (subprocess .check_call ( cmd ) )
166+ except subprocess .CalledProcessError :
167+ has_itkNumberOfThreads = False
168+ return has_itkNumberOfThreads
169+
155170def build_benchmarks (benchmark_src , benchmark_bin ,
156171 itk_bin ,
157- itk_has_buildinformation ):
172+ itk_has_buildinformation ,
173+ itk_has_NumberOfThreads ):
158174 os .chdir (benchmark_bin )
159175 if itk_has_buildinformation :
160176 build_information_arg = '-DITK_HAS_INFORMATION_H:BOOL=ON'
161177 else :
162178 build_information_arg = '-DITK_HAS_INFORMATION_H:BOOL=OFF'
179+ if itk_has_NumberOfThreads :
180+ NumberOfThreads_arg = '-DITK_USES_NUMEROFTHREADS:BOOL=ON'
181+ else :
182+ NumberOfThreads_arg = '-DITK_USES_NUMEROFTHREADS:BOOL=OFF'
163183 subprocess .check_call (['cmake' ,
164184 '-G' , 'Ninja' ,
165185 '-DCMAKE_BUILD_TYPE:STRING=Release' ,
166186 '-DCMAKE_CXX_STANDARD:STRING=11' ,
167187 '-DITK_DIR:PATH=' + itk_bin ,
168188 build_information_arg ,
189+ NumberOfThreads_arg ,
169190 benchmark_src ])
170191 subprocess .check_call (['ninja' ])
171192
@@ -314,10 +335,11 @@ def has_sha(filepath):
314335 build_itk (args .src , args .bin )
315336
316337 itk_has_buildinformation = check_for_build_information (args .src )
338+ itk_has_NumberOfThreads = check_for_NumberOfThreads (args .src )
317339
318340 print ('\n Building benchmarks...' )
319341 build_benchmarks (benchmark_src , args .benchmark_bin , args .bin ,
320- itk_has_buildinformation )
342+ itk_has_buildinformation , itk_has_NumberOfThreads )
321343
322344 print ('\n Running benchmarks...' )
323345 run_benchmarks (args .benchmark_bin , itk_information )
0 commit comments