1

I have an af::array for which i want to find the non zero location (2048*2048).

af::timer start1 = af::timer::start();
af::array index = af::where(mat); // for the first time
cout << "elapsed time (ms): " << af::timer::stop(start1)*1000 <<" ms"<<endl;
start1 = af::timer::start();
index = af::where(mat); //for the second time
cout << "elapsed time (ms): " << af::timer::stop(start1)*1000 <<" ms"<<endl;

First iteration:

elapsed time (ms) : 1.8792 ms
elapsed time (ms) : 0.7094 ms

Second iteration:

elapsed time (ms) : 16.8074 ms
elapsed time (ms) : 0.4738 ms

Third iteration

elpased time (ms) : 17.3236 ms
elpased time (ms) : 0.4543 ms

Why are the times is so inconsistent?

talonmies
  • 70,661
  • 34
  • 192
  • 269
Avinash
  • 11
  • 1
  • What you posted clearly isn't the exact output of that code you showed, but I have edited it for readability – talonmies Jul 06 '21 at 08:33
  • Hey, I have answered your queries in our google-forums conversation already https://groups.google.com/g/arrayfire-users/c/47RYzDQpzc4/m/NvsPYbUYAwAJ please have a look. – pradeep Jul 07 '21 at 04:13
  • Yes. This was simultaneously posted in both groups. Thanks. – Avinash Jul 08 '21 at 07:14

0 Answers0