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
1
vote
0 answers

How to handle large batched multiplication in array fire

i'm new to arrayfire and i'm currently having some problems. I'm currently doing a large batch of matrix multiplications like something below but I run out of memory. Could someone show me an example code to deal with this issue? int n = 60; …
lzw12345
  • 21
  • 2
1
vote
2 answers

array synchronization and multithreading

I have a multithreaded application where I'm doing the following: Thread1: Reads data from a camera and stores it in ArrayFire array (CUDA backend). Thread2: Use ArrayFire to calculate certain results from the camera's data. Thread3: Send the…
parti82
  • 165
  • 5
1
vote
1 answer

Arrayfire Vectorization

I'm trying to speed up the following calculations but have not been able to reach the desired speed. Im sure the issue is with my code and not physical limitations of the GPU. I have a matrix V that is 10,000 x 6 x 6. And another matrix P that is 6…
AAG
  • 235
  • 1
  • 11
1
vote
1 answer

Alternating Error: "Invalid dimension for argument 0"

In converting the example below to a gfor loop. I encountered an error of the type "Invalid dimension for argument 0", the full error message below. However, the error occurs, then the function runs, then the same error. This pattern repeats. I…
skatz
  • 115
  • 7
1
vote
1 answer

af::array conversion to float or double

I have been experimenting with the RcppArrayFire Package, mostly rewriting some cost functions from RcppArmadillo and can't seem to get over "no viable conversion from 'af::array' to 'float'. I have also been getting some backend errors, the…
skatz
  • 115
  • 7
1
vote
2 answers

How to do grouped MAX in ArrayFire?

Is there such a thing like af::array groupedMax= af::Max(myValues, fromIndices, toIndices); For example, myValues= {random values} fromIndices = {2, 7, 5} toIndices = {10, 9, 12} The result should be groupedMax[0] will be max between myValues[2]…
BoBoDev
  • 847
  • 1
  • 8
  • 17
1
vote
0 answers

about array reshape in ArrayFire

Now I'm using ArrayFire and met up with something strange. For example: A dim is 257 x 1 x 1 x 1 af::floor(A) dim is 1 x 1 x 1 x 257 2*A dim is 1 x 1 x 1 x 257 A-1 dim is 1 x 1 x 1 x 257 A-af::constant(1,A.dims()) is 257 x 1 x 1 x 257 where A is…
Dana Mark
  • 45
  • 7
1
vote
1 answer

ArrayFire CPU, will it run out of memory due to late GC?

I am not entirely sure how ArrayFire manages memory on the RAM when using CPU mode. Based on task manager observation, it appears the device memory on RAM is not released right away, it looks like there is a GC stage. Is this true? What happen if I…
BoBoDev
  • 847
  • 1
  • 8
  • 17
1
vote
0 answers

Problem about value assignment in Arrayfire

I'm using Arrayfire and Flashlight evaluating a network. auto tmp = output(af::seq(2, 10), af::span, af::span, af::span); auto softmax_tmp = fl::softmax(tmp, 0); output(af::seq(2,10),af::span,af::span,af::span)=softmax_tmp; output is a tensor with…
Dana Mark
  • 45
  • 7
1
vote
1 answer

How to properly use pinned memory in ArrayFire?

When using pinned memory in ArrayFire I get slow performance. I've tried various methods of creating pinned memory and creating arrays from it, eg. cudaMallocHost. Using cudaMallocHost w/ cudaMemcpy ways pretty fast (several hundred usec.), but then…
ZRP
  • 35
  • 4
1
vote
0 answers

ArrayFire af::eval() premature data type mismatch error

This code is giving me datatype mismatch error. const double dd = 0.225; af::array aa = af::constant(111, 10, f32) + dd; af::array bb = af::constant(111, 10, f64) + dd; af::eval(aa, bb); Both aa and bb should be f64 because both add a double value.…
BoBoDev
  • 847
  • 1
  • 8
  • 17
1
vote
2 answers

ArrayFire: function with an OpenCL kernel called from main function

the function is the following (extracted from http://arrayfire.org/docs/interop_opencl.htm) unique main function int main() { size_t length = 10; // Create ArrayFire array objects: af::array A = af::randu(length, f32); af::array B =…
4lrdyD
  • 433
  • 2
  • 10
1
vote
1 answer

Can I use broadcasting in ArrayFire?

Can I do something like this: auto minEl = min(a); a -= minEl; ? I get an unknown af::exception when I do that. For now, I'm doing this: auto minEl = *min(a).host(); a -= minEl; But of course, it does an unnecessary download. I borrow the…
Stefan Monov
  • 11,332
  • 10
  • 63
  • 120
1
vote
0 answers

Broadcasting with ArrayFire.jl

I'm trying to broadcast a simple conditional function on an AFArray type. using ArrayFire f = x -> x > .5 ? "foo" : "bar" a = rand(Float32, 10, 10) b = rand(AFArray{Float32}, 10, 10) display( f.(a) ) # This one works... display( f.(b) ) # ...this…
Le Minaw
  • 835
  • 7
  • 17
1
vote
0 answers

Runtime linking R-extension on MacOS

I have installed the ArrayFire library using the binary installer for MacOS which puts the libraries into /usr/local/lib. I can compile and run simple examples, e.g. #include #include int main() { unsigned int count; …
Ralf Stubner
  • 26,263
  • 3
  • 40
  • 75