1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00
occt/tests/perf/modalg/bug32539_2
2023-11-03 14:21:37 +00:00

56 lines
1.6 KiB
Plaintext

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"
}