Why is my code running slower than Armadillo.

58 views
Skip to first unread message

Carlos

unread,
Nov 28, 2023, 10:15:08 AM11/28/23
to ArrayFire Users
Kind regards.

I am porting a library from Armadillo to ArrayFire, I have extracted and attached the part of the code that is slower.

ArrayFire took: 0.19118 seconds
Armadillo took: 0.008117 seconds

Currently, I am lost as to why the ArrayFire version is slower, if you have any suggestion thanks in advance.

af::info:
ArrayFire v3.9.0 (CPU, 64-bit Linux, build b59a1ae53)
[0] Intel: 12th Gen Intel(R) Core(TM) i7-12700KF


code.cpp

John Melonakos

unread,
Nov 28, 2023, 1:55:22 PM11/28/23
to ArrayFire Users
Hi Carlos,

As a data-parallel library, ArrayFire aims to perform well on larger data sizes. In this code, the matrices are 7x3, which is very small.

Also, you are using the ArrayFire CPU backend. The CPU backend is not optimized and is available primarily for compatibility purposes. The GPU backends are where we have spent our time optimizing the library.

To improve ArrayFire's relative performance, try much larger data sizes (e.g., 1024x1024) and compare the performance on a GPU versus Armadillo on the CPU.

Good luck,

John
Reply all
Reply to author
Forward
0 new messages