ceres multi-threading runs slower on Android

瀏覽次數:251 次
跳到第一則未讀訊息

Frank Young

未讀,
2018年1月5日 清晨5:08:272018/1/5
收件者:Ceres Solver
Hi guys,

I pulled ceres solver to the latest version (Dec 11 11:11:07, updated by Alex Stewart), which includes TBB module. I found the case run slower with multi-threading enabling. Some tests are as follow(Number of iterations: 50), and more details can be found in the attached file.

CERES_NO_THREADS defined
---------------------------------------------------
  Residual evaluation                0.013869
  Jacobian evaluation                0.054759
  Linear solver                      0.096086
Minimizer                            0.189615

openmp + num_threads = 1
---------------------------------------------------
  Residual evaluation                0.021007
  Jacobian evaluation                0.063633
  Linear solver                      0.202915
Minimizer                            0.318207


openmp + num_threads = 4
---------------------------------------------------
  Residual evaluation                0.023179
  Jacobian evaluation                0.072973
  Linear solver                      0.192077
Minimizer                            0.319461


tbb + num_threads = 1
---------------------------------------------------
  Residual evaluation                0.052823
  Jacobian evaluation                0.088980
  Linear solver                      0.209207
Minimizer                            0.382557


tbb + num_threads = 4
---------------------------------------------------
  Residual evaluation                0.059175
  Jacobian evaluation                0.094217
  Linear solver                      0.196872
Minimizer                            0.380875


It looks odd. I expect CERES_HAVE_THREAD + num_threads=1 have the same behaviour and performance with the CERES_NO_THREADS case. But the result gave me a surprise. 

Frank

multi-threading.txt

Sameer Agarwal

未讀,
2018年1月5日 清晨5:56:552018/1/5
收件者:ceres-...@googlegroups.com、vi...@google.com
Frank, 
We had observed some slow down due to TBB initialization overhead that +Michael Vitus had fixed recently. What version of TBB are you using, it is possible that the TBB initialization overhead is still killing you.
Sameer


--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/f16e3abe-3b24-4437-9a85-4a54ef75a599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Vitus

未讀,
2018年1月5日 中午12:30:302018/1/5
收件者:Ceres Solver
He is also seeing a slow down when using openmp with 1 thread (but TBB is even slower).  Some openmp implementations have a fast path for 1 thread, but I am not sure how to check for that. If it does have the fast path, then you should be getting the exact same timing results.

Are you consistently seeing ceres no threads take 0.19 seconds or did you just get lucky?  

Mike

Frank Young

未讀,
2018年1月5日 晚上8:13:162018/1/5
收件者:Ceres Solver
Sameer,

I found TBB used is 4.4.6 incorrectly.  Sorry for the mistake, I would try 2018_U2 as soon as possible.

在 2018年1月5日星期五 UTC+8下午6:56:55,Sameer Agarwal写道:

Frank Young

未讀,
2018年1月6日 上午9:56:582018/1/6
收件者:Ceres Solver
Mike,

I am sure CERES with no threads takes 0.19~0.2 seconds consistently, and the time goes up to >0.3 seconds once enabling openmp+num_threads(1). (enn, let's talk about OpenMP and skip TBB here because of using incorrect version)

I compiled my project with clang 3.8 and android_ndk_r15c.

Frank

在 2018年1月6日星期六 UTC+8上午1:30:30,Mike Vitus写道:

Sameer Agarwal

未讀,
2018年1月6日 上午10:02:082018/1/6
收件者:ceres-...@googlegroups.com
Frank my guess is that your problem is small enough that the openmp overhead is overwhelming it.
Sameer


回覆所有人
回覆作者
轉寄
0 則新訊息