Making columwise operations faster?
ysspatil
make/o/n=(1000,16) w1= gnoise(1) ,w2 = gnoise(1)
Each column of each wave refer to data from a single experiment, and the column index is a different iteration of the same experiment.
i.e. w1[][k] and w2[][k] refer to two outputs of a single experiment, where k indexes the iteration of the experiment.
I want to construct a wave as follows
duplicate/o w1 w3
w3[][]=w1[p][q]*w2[999-p][q]
Is there a way to make the construction of w3 faster?
Each column is independent, so can we use multiple cores or processes (or anything else) to speed up the construction of w3?
make/o/n=(1000,16) w1= gnoise(1) ,w2 = gnoise(1)
duplicate/o w1 w3
Variable start = StopMSTimer(-2)
w3[][]=w1[p][q]*w2[999-p][q]
print (StopMSTimer(-2)-start)
End
Function test_MT()
make/o/n=(1000,16) w1= gnoise(1) ,w2 = gnoise(1)
duplicate/o w1 w3
Variable start = StopMSTimer(-2)
MultiThread w3[][]=w1[p][q]*w2[999-p][q]
print (StopMSTimer(-2)-start)
End
When executed on the command line using the same Windows machine with a quad core processor:
•test() 3180.63 •test_MT() 763.69
November 24, 2016 at 07:34 am - Permalink
make/o/n=(1000,16) w1= gnoise(1) ,w2 = gnoise(1)
duplicate/o w2 w4
Variable start = StopMSTimer(-2)
Reverse w4
MatrixOp/o w3 = w1 * w4
print (StopMSTimer(-2)-start)
End
On my machine
1452.05
•test_MT()
839.983
•test_RV()
172.87
November 24, 2016 at 02:30 pm - Permalink
MatrixOP reverseCols
, i.e.make/o/n=(1000,16) w1= gnoise(1) ,w2 = gnoise(1)
Variable start = StopMSTimer(-2)
MatrixOp/o w3 = w1 * reverseCols(w2)
print (StopMSTimer(-2)-start)
End
•test()
1082.05
•test_MT()
492.495
•test_RV()
169.394
•test_RV2()
79.089
November 24, 2016 at 11:45 pm - Permalink