Jetson/Installing ArrayFire

Prerequisites for installing ArrayFire for Tegra
Download & install the CUDA Toolkit by following the Installing CUDA instructions, since it is needed by ArrayFire.

Once you have the CUDA Toolkit installed, you can start installing ArrayFire.

Download ArrayFire for Tegra
You can download ArrayFire for Tegra from the download page. This is a prebuilt version of ArrayFire, complete with the library and examples.

Installing ArrayFire for Tegra
Extract the contents of the zip file downloaded to a convenient location. /opt/arrayfire/v2.1 is recommmended.

Now add the following line to your .bashrc file and restart your terminal. export AF_PATH=/opt/arrayfire/v2.1 #(or custom installed location)

Typically, libcuda.so* is located in /usr/lib/arm-linux-gnueabihf/tegra/. Make libcuda.so visible to your library path. sudo ln -s /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so /usr/lib/libcuda.so sudo ln -s /usr/lib/arm-linux-gnueabihf/tegra/libcuda.so.1 /usr/lib/libcuda.so.1

If libcuda.so is not present in /usr/lib/arm-linux-gnueabihf/tegra/ then install mlocate, update its database and search for libcuda.so. sudo apt-get install mlocate sudo updatedb locate libcuda.so and create a symbolic link in /usr/lib/ accordingly.

Verify Installation with Hello World
To run the Hello World example, do the following: cd /examples/helloworld

Build and run: make ./helloworld_cuda

Successful output is shown below.

If unsuccessful, try repeating the installation steps above. Support is also available, if needed.

ArrayFire v2.1 (CUDA, 32-bit Linux, build 24a69a2) License: Standalone (Tegra K1) Addons: MGL16, DLA, SLA ARM 0 : GK20A, 1747 MB, CUDA Compute 3.2 Memory Usage: 40 MB free (1747 MB total) create a 5-by-3 matrix of random floats on the GPU A [5 3] = 0.7402    0.4464     0.7762          0.9210     0.6673     0.2948          0.0390     0.1099     0.7140          0.9690     0.4702     0.3585          0.9251     0.5132     0.6814  element-wise arithmetic B [5 3] = 0.7744    0.5317     0.8006          0.8962     0.7189     0.3905          0.1390     0.2097     0.7549          0.9243     0.5531     0.4509          0.8987     0.5910     0.7299  Fourier transform the result C [5 3] = 3.6327 + 0.0000i      2.6043 + 0.0000i       3.1267 + 0.0000i 0.4689 + 0.4640i      0.3193 + 0.0802i       0.1713 + 0.1441i -0.3491 - 0.7454i     -0.2923 - 0.4018i       0.2667 + 0.4886i -0.3491 + 0.7454i     -0.2923 + 0.4018i       0.2667 - 0.4886i 0.4689 - 0.4640i      0.3193 - 0.0802i       0.1713 - 0.1441i grab last row c [1 3] = 0.4689 - 0.4640i      0.3193 - 0.0802i       0.1713 - 0.1441i zero out every other column negate the first three elements of middle column B [5 3] = 0.0000   -0.5317     0.0000          0.0000    -0.7189     0.0000          0.0000    -0.2097     0.0000          0.0000     0.5531     0.0000          0.0000     0.5910     0.0000  create 2-by-3 matrix from host data D [2 3] = 1.0000    3.0000     5.0000          2.0000     4.0000     6.0000

copy last column onto first D [2 3] = 5.0000    3.0000     5.0000          6.0000     4.0000     6.0000

Congratulations! You are now ready to use ArrayFire!

Do More with ArrayFire
Our documentation page page contains a vast amount of information about the API and examples provided by ArrayFire.

Our blog contains the latest developments with ArrayFire and tips and tricks to get the most out of your code.

If you are doing something really cool with ArrayFire, give us a shout out at technical@arrayfire.com, and we will be more than happy to lend our support.

Uninstalling ArrayFire for Tegra
Simply delete the contents of the installed folder. Remove the line added to your .bashrc file if needed.