@@ -152,20 +152,42 @@ 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+ print ("HERE!!!!" )
181+ NumberOfThreads_arg = '-DITK_USES_NUMEROFTHREADS:BOOL=ON'
182+ else :
183+ NumberOfThreads_arg = '-DITK_USES_NUMEROFTHREADS:BOOL=OFF'
163184 subprocess .check_call (['cmake' ,
164185 '-G' , 'Ninja' ,
165186 '-DCMAKE_BUILD_TYPE:STRING=Release' ,
166187 '-DCMAKE_CXX_STANDARD:STRING=11' ,
167188 '-DITK_DIR:PATH=' + itk_bin ,
168189 build_information_arg ,
190+ NumberOfThreads_arg ,
169191 benchmark_src ])
170192 subprocess .check_call (['ninja' ])
171193
@@ -314,10 +336,11 @@ def has_sha(filepath):
314336 build_itk (args .src , args .bin )
315337
316338 itk_has_buildinformation = check_for_build_information (args .src )
339+ itk_has_NumberOfThreads = check_for_NumberOfThreads (args .src )
317340
318341 print ('\n Building benchmarks...' )
319342 build_benchmarks (benchmark_src , args .benchmark_bin , args .bin ,
320- itk_has_buildinformation )
343+ itk_has_buildinformation , itk_has_NumberOfThreads )
321344
322345 print ('\n Running benchmarks...' )
323346 run_benchmarks (args .benchmark_bin , itk_information )
0 commit comments