Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
c5f20409cThis file is pinned to the selected release. Download the original to open it in your design tool.
puts "=========="
puts "0032539: Modeling Algorithms - Parallelize BRepExtrema_DistShapeShape algorithm"
puts "=========="
puts ""
# prepare
restore [locate_data_file 5000-12.brep] s1
restore [locate_data_file BPLSEITLI.brep] s2
# multi-thread
cpulimit 1000
dchrono p reset; dchrono p start;
set pres [distmini res s1 s2 -parallel]
dchrono p stop;
regexp {Elapsed time: +([-0-9.+eE]+) Hours +([-0-9.+eE]+) Minutes +([-0-9.+eE]+) Seconds} [dchrono p show] full p_Hours p_Minutes p_Seconds
set p_Time [expr ${p_Hours}*60.*60. + ${p_Minutes}*60. + ${p_Seconds} ]
puts "multithreaded time: $p_Time"
set pdist [dval res_val]
vclear
vclose ALL
vinit v1/v1
vdisplay -dispMode 1 s1 s2 res
vzoom 2
checkview -screenshot -3d -path ${imagedir}/${test_image}_multi.png
#single-thread
dchrono s reset; dchrono s start;
set cres [distmini res s1 s2]
dchrono s stop;
regexp {Elapsed time: +([-0-9.+eE]+) Hours +([-0-9.+eE]+) Minutes +([-0-9.+eE]+) Seconds} [dchrono s show] full s_Hours s_Minutes s_Seconds
set s_Time [expr ${s_Hours}*60.*60. + ${s_Minutes}*60. + ${s_Seconds} ]
puts "single-threaded time: $s_Time"
set sdist [dval res_val]
vclear
vclose ALL
vinit v2/v2
vdisplay -dispMode 1 s1 s2 res
vzoom 2
checkview -screenshot -3d -path ${imagedir}/${test_image}_single.png
# compare
set ratio [expr ${s_Time}/${p_Time} ]
puts "acceleration in multi-threaded work: $ratio"
if {[string compare $cres $pres] != 0} {
puts "Error: different result between single-thread and multi-thread mode"
}
if {[expr abs(${sdist} - ${pdist})] > 1E-13} {
puts "Error: different distance between single-thread and multi-thread mode"
}