Questions tagged [arrayfire]

ArrayFire is a software library that simplifies GPU computing.

From the github page:

ArrayFire is a high performance software library for parallel computing with an easy-to-use API. Its array based function set makes parallel programming simple.

ArrayFire's multiple backends (CUDA, OpenCL and native CPU) make it platform independent and highly portable.

A few lines of code in ArrayFire can replace dozens of lines of parallel computing code, saving you valuable time and lowering development costs.

Useful Links:

182 questions
0
votes
1 answer

Access the value of an enum variant

I am working on some language bindings to Arrayfire using the arrayfire-rust crate. Arrayfire has a typed struct Array which represents a matrix. All acceptable types implement the HasAfEnum trait. This trait has a number of associated types,…
Benjamin Philip
  • 178
  • 1
  • 11
0
votes
1 answer

Adam Optimizer is apparently not converging

I am trying to write a neural network in rust + arrayfire, and while gradient descent works, ADAM does not. fn back_propagate( &mut self, signals: &Vec>, labels: &Array, learning_rate_alpha: f64, batch_size: i32, )…
0
votes
1 answer

Optimize member function selection at runtime on CPU/GPU

I have the following piece of code that needs to optimized (and be later ported to the GPU through SYCL or ArrayFire): struct Item { float value; int f; float Func(float); float Func1(float); float Func2(float); float…
Pietro
  • 12,086
  • 26
  • 100
  • 193
0
votes
1 answer

Cannot disable CUDA build and the process stops

Trying to build ArrayFire examples, everything goes well until I get to the CUDA ones. They are supposed to be skipped, since I have an AMD processor/GPU. However, during the build process, the CUDA section is built anyway, failing for obvious…
Pietro
  • 12,086
  • 26
  • 100
  • 193
0
votes
0 answers

How to address not a full span of ArrayFire within gFor

If I use A(i, span) = A(i, span) + 1; within gfor it works. But what if I want to use a limited range instead of a full span of a dimension: gfor(seq i, A.elements()) { A(i, span) = A(i, span) + 1; // this works A(i, i+3) =…
Mehran Khazaeizadeh
  • 1,021
  • 1
  • 7
  • 13
0
votes
1 answer

Retrieving data from af::array via host() results in wrong data

When trying to retrieve data from an af::array (arrayfire) from the device via host(), my output data on the host is wrong (i.e. wrong values). For testing that, I wrote a small code sample (based on…
arc_lupus
  • 3,942
  • 5
  • 45
  • 81
0
votes
1 answer

Create 2d array from a division of two 1d-arrays in arrayfire

I have two 1d-arrays in arrayfire, x and y. I would like to divide them through each other, and create a 2d-array from the result, i.e. as shown in the following code: #include int main(void){ const size_t x_len = 1024, y_len =…
arc_lupus
  • 3,942
  • 5
  • 45
  • 81
0
votes
1 answer

RcppArrayFire passing a matrix row as af::array input

In this simple example I would like to subset a matrix by row and pass it to another cpp function; the example demonstrates this works by passing an input array to the other function first. #include "RcppArrayFire.h" using namespace…
skatz
  • 115
  • 7
0
votes
1 answer

torch.squeeze and torch.unsqueeze equivalent in Flashlight (arrayfire)

I'm porting PyTorch code to Flashlight code. What is an Arrayfire or Flashlight function equivalent for squeeze and unsqueeze in Pytorch? processed_query = self.query_layer(query.unsqueeze(1)) energies = energies.squeeze(-1) How to convert this to…
minty99
  • 327
  • 1
  • 2
  • 9
0
votes
1 answer

Intel MKL FATAL ERROR: Cannot load libmkl_mc3.so or libmkl_def.so

I'm trying to use Arrayfire's implementation of LU and got: Intel MKL FATAL ERROR: Cannot load libmkl_mc3.so or libmkl_def.so. I tried lot of things to solve the issues (like libraries paths and other stuff). Nothing worked for me. Also, I tried…
Mwattad
  • 3
  • 2
0
votes
1 answer

Arrayfire: How do I sample an array by elements of another array?

I'm new to Arrayfire and searching for a method like 2D texture sampling. float uvInit[] = { 0, 0, 1, 1, 1, 0, 0, 1 }; array uv = array(4, 2, uvInit, f32); float texInit[] = { 1, 2, 3, 4 }; array tex = array(2, 2, texInit, f32); array color =…
karatoga
  • 513
  • 4
  • 14
0
votes
1 answer

Confusion over Nvidia GPU packages in Julia, CuArrays and ArrayFire

I recently looked into the usage of GPU computation, where the usage of package seemed to be confusing. For example, CuArrays and ArrayFire seemed to be doing the same thing, where ArrayFire seemed to be the "official" package on Nvidia developers'…
J C
  • 181
  • 7
0
votes
0 answers

Julia: calling a ArrayFire customized function that use customized kernels, ArgumentError: cannot convert NULL to string

I have a customized kernel and his respective customized ArrayFire function, I wanna call this function from Julia, but when I do that with relative large arrays I get: ArgumentError: cannot convert NULL to string, I know this can be limited…
4lrdyD
  • 433
  • 2
  • 10
0
votes
1 answer

Convert af::array to QVector

I am looking for a way to convert a image, which is represented (because I used ArrayFire function loadimage()) as af::array to QVector. Any advice on how can I do this? Thank you!
0
votes
1 answer

ArrayFire.jl and chol

I have installed Julia-1.0.0 on a windows 10 box, and then installed ArrayFire.jl. It seems to work (random numbers get generated, and LU factorization seems to work fine). However, chol is claimed to be undefined: julia> cholesky_fact= chol(a *…
Igor Rivin
  • 4,632
  • 2
  • 23
  • 35