Comparison of MatrixOP and Multithread
maru
Hi,
I have tested a wave assignment of a 1000x1000 2D wave using MatrixOP and Multithread, respectively.
Both operations required similar process time. ~0.13 sec.
I got a bit confused by this result. Is there any difference between these two operations in wave assignment?
Sorry, process time were ~0.013 sec.
June 24, 2019 at 01:50 am - Permalink
Hello Maru,
The only similarity of the two approaches is that you end up with a large output wave...
You are not telling us how you measured the performance time so please include your code.
A multithread assignment splits the execution of the assignment (which you have not actually specified) into as many threads as can be supported by your hardware. MatrixOP wave assignment (I am assuming you used const()) is not multithreaded but it runs efficiently in one thread. Depending on the size of the wave performance may be limited by the time it takes to allocate the wave.
A.G.
June 24, 2019 at 12:24 pm - Permalink
In reply to Hello Maru, The only… by Igor
Thanks! Now, I understand. My code was very complicated and I extracted a part of that. The process time is a bit different now.
For Multithread, it takes ~0.030 sec. For MatrixOP, it takes ~0.017 sec.
Make/O/D/N=(1000,1000,3) vecMap
Make/O/D/N=(1000,1000) scalarMap
Make/O/N=3, avec, bvec, cvec
avec = {1,0,0}
bvec = {0,1,0}
cvec = {0,0,1}
Multithread vecMap = (p-500)*avec[r] + (q-500)*bvec[r] + 1e-3*cvec[r]
variable t0 = StartMSTimer
Multithread scalarMap = sqrt(vecMap[p][q][0]*vecMap[p][q][0] + vecMap[p][q][1]*vecMap[p][q][1] + vecMap[p][q][2]*vecMap[p][q][2])
Print StopMSTimer(t0)*1e-6, "sec"
variable t1 = StartMSTimer
MatrixOP/O scalarMap1 = sqrt(vecMap[][][0]*vecMap[][][0] + vecMap[][][1]*vecMap[][][1] + vecMap[][][2]*vecMap[][][2])
Print StopMSTimer(t1)*1e-6, "sec"
End
June 24, 2019 at 04:29 pm - Permalink
FWIW: in IP9 the following should be more efficient:
MatrixOP/O scalarMap1 = sqrt(sumBeams(vecMap))
June 24, 2019 at 05:31 pm - Permalink
So the teasing about IP9 has started.
Andy
June 24, 2019 at 06:45 pm - Permalink
I've been indulging in teasing for several months now!
June 26, 2019 at 02:13 pm - Permalink