Questions tagged [arrayfire]
ArrayFire is a software library that simplifies GPU computing.
180
questions
1
vote
1
answer
61
views
How to use ArrayFire batched 2D convolution
Reading through ArrayFire documentation, I noticed that the library supports batched operations when using 2D convolution. Therefore, I need to apply N filters to an image using the C++ API.
For easy ...
1
vote
0
answers
107
views
Rust Arrayfire - Using an array to index into another array
For the last three days I've been trying to implement a loss function (cross entropy) in my machine learning project following the book "Neural Networks from Scratch by Harrison Kinsley".
So ...
3
votes
1
answer
51
views
Is it possible to access arrayfire's data memory using CPU backend without data copy?
I wanna use arrayfire in CPU mode (mkl) only to be able to access data without transmission, as it may happen for GPU data.
Is there a way to have direct access to arrayfire's data memory (only CPU ...
1
vote
0
answers
237
views
C++ program crash with no error message only when using a particular library of ArrayFire
I am trying to use the ArrayFire library, everything is working perfectly (see the working example above), but I have a problem only when using a particular library af.lib. The problem is that when my ...
0
votes
1
answer
1k
views
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<T> which represents a matrix. All acceptable types implement the HasAfEnum ...
1
vote
1
answer
74
views
Detecting R Version in Rcpp/arrayfire in makevars
I am new to building R packages so I need some help :) I am using Rcpp/arrayfire and want a line in my makevars file to detect the users R version. Currently I have it set in 4.0, but I anticipate ...
1
vote
0
answers
40
views
Is it possible to mix CPU and GPU computations with ArrayFire?
I have to solve a mathematical problem which can be either dense or sparse for different time values. I would like to use the GPU for the first and the CPU for the second (assuming the switch does not ...
1
vote
0
answers
152
views
Multithreaded fft convolution in arrayfire
I am trying to parallelize fft convolution in arrayfire over multiple CPU threads:
#include <arrayfire.h>
#include <iostream>
#include <omp.h>
using namespace af;
void printarray(...
1
vote
1
answer
73
views
Retrieve multiple ArrayFire subarrays from min/max data points
I have an array with sections of touching values in it. For example:
0 0 1 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 2 2 2 0 0
0 0 0 0 0 0 0 2 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 ...
1
vote
0
answers
51
views
ArrayFire (C++): 'gfor' dim_t parameter variation within loops / PARTIAL unwrap() function
many thanks in advance if anyone is able to help me solve this issue.
I have recently started using the ArrayFire C++ Matrix library and have found it to be fantastic, however I have hit a problem I ...
1
vote
2
answers
153
views
How can I implement Max Pooling in Arrayfire in rust without resorting to writing my own cuda code
I'm trying to figure out how to implement max pooling on Arrayfire. My current best approach involves iterating over each convolved output and apply a function which applies four kernels, [1 0 0 0], [...
0
votes
1
answer
784
views
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<Array<f32>>,
...
1
vote
0
answers
32
views
ArrayFire: Translate a batch of images at the same time
I'm using arrayfire and I need to translate a lot of images at once and store it in a new array. The images are contained in a single array of size (w, h, c, b) and the amount by which each image ...
0
votes
1
answer
89
views
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(...
1
vote
0
answers
31
views
How to free a sparse array?
I'm wondering why arrayfire seems to not free the memory in this example, and how to free memory from a sparse array. Thanks!
// sparse.c
#include <arrayfire.h>
// create sparse array from dense ...
1
vote
0
answers
36
views
Non-blocking data transfer between device and host in ArrayFire
Is it possible to use non-blocking data transfer between host and device in ArrayFire?
Indeed, because of some issues, I want to keep parts of my code in naive C++. So, I want to hide part of the ...
3
votes
1
answer
231
views
How can I have the pixel coordinate X,Y after ArrayFire match_template?
I'm trying to use the matching_template function from the ArrayFire library But I don't know how to find the X and Y coordinates of the best matching value.
I was using the imageproc library to ...
1
vote
0
answers
100
views
Using ArrayFire and Boost Compute in single code
I am trying to run a code which uses functions from both boost compute library and arrayfire library. I am getting the following errors when I try to build the code:
Scanning dependencies of target ...
1
vote
1
answer
169
views
Dispose and delete of arrayfire variables,
I have a af::array variable which is 3000000*3:
int main()
{
// inputArray is the pointer which fills tempArray
af::array tempArray = af::array(af::dim4(3000000,3),inputArray);
tempArray(...
1
vote
0
answers
219
views
Can run ArrayFire on my CPU only, not on the intergrated GPU
I could build all the examples of the ArrayFire project (except the CUDA ones, having an AMD APU). However, just the ones running on the CPU work correctly; the GPU based ones have issues.
Example:
...
0
votes
1
answer
245
views
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 ...
1
vote
0
answers
38
views
ArrayFire af::where time consumption
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 << "...
1
vote
0
answers
78
views
ArrayFire OpenCL Issue
I have installed ArrayFire 3.8.0 using the binary installer as per the instructions mentioned in the documentation. All dependencies were installed before installing it. NVIDIA CUDA Toolkit 11.3 is ...
1
vote
0
answers
106
views
ArrayFire Matrix Multiplication Vectorization
I am using ArrayFire library for signal processing. I am just curious about how to make more efficient my code. I read vectorization guide in docs, but i just ended up using gfor construct. Is it ...
1
vote
1
answer
83
views
ArrayFire's matrix multiplication with integer inputs
I want to perform matrix by vector multiplication but on arrays with integer types to avoid extra conversion (it works fine when both sides are of type f32);
Such operation throws bad type exception ...
2
votes
0
answers
58
views
ArrayFire convolution issue with Cuda backend
I've been having an issue with a certain function call in the
dphaseWeighted = af::convolve(dphaseWeighted, m_slowTimeFilter);
which seem to produce nothing but nan's.
The back ground is we have ...
1
vote
1
answer
103
views
Arrayfire python rowwise addition and multiplication
I'm trying to learn the Arrayfire idioms by translating some vectorised numpy code.
For example, this is valid rowwise addition and multiplication in numpy,
>>> a = np.array([1,2,3])
>>&...
1
vote
1
answer
338
views
Cast ArrayFire Array Data from f64 to f32 in C++
I have an ArrayFire array of dtype=f64 that I need to cast to dtype=f32. I'm not sure how to do this other than converting to a host array and iterating through doing a static_cast. I'm sure there is ...
1
vote
1
answer
13
views
"afcl" namespace missing in ArrayFire 3.7.2
In the official docs there are functions like afcl::getContext. But when I #include <arrayfire.h>, I don't get access to any afcl namespace. How do I access such functions?
1
vote
1
answer
105
views
How do I convert ArrayFire Image to Julia Image?
I want to use the plotting functionality of Plots.jl with an image loaded using the load_image() function of ArrayFire.
What I have is :
AFArray: 1000×300×3 Array{Float32,3}
What I want is :
300×1000 ...
0
votes
0
answers
48
views
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
vote
0
answers
56
views
How to correctly perform atomic operations with ArrayFire?
How can I perform atomic operations like atomicCAS with ArrayFire to avoid locking?
(that is the same across all backends)
1
vote
1
answer
86
views
ArrayFire array calculated data differs over executions although usage of sync and eval methods
I want to convert text data into corresponding values (vectorized), but final data is not filled all the time, it seems that if there is some latency it has time to fill the result array otherwise it ...
1
vote
1
answer
182
views
Set a index value with Arrayfire
I am trying to modify a value in an existing Arrayfire Matrix with a custom value. Below is an example of changing several rows and columns to a specified value (1.0) However I am struggling no doing ...
1
vote
0
answers
67
views
Rust Arrayfire Closure multiplication
I am attempting to multiply an arrayfire Matrix by a matrix of closures. Is there anyway to achieve this without using for loops?
My current code is as follows:
//Initialize the closures and assign to ...
0
votes
1
answer
97
views
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 ...
2
votes
1
answer
250
views
Scatter/Gather like Numpy in ArrayFire
I want to scatter and gather elements from an array X at specific indices along one axis.
So given an array of indices idx, I want to select the idx(0)th element along the 0th column, the idx(1)th ...
1
vote
0
answers
61
views
Expanding arrays of intervals in Arrayfire
I have three Arrayfire arrays that look like this:
Array 1 Array 2 Array 3
20 5 9
3 0 0
9 4 8
0 20 22
... ... ...
Using Arrayfire, I ...
2
votes
1
answer
216
views
Convert af::array to af_array and back
I would like to use the ArrayFire library to run multiple artificial neural networks on the GPU in parallel.
Since I am mainly a C# developer I tried to realize it via SiaNet. But I encountered the ...
1
vote
0
answers
57
views
Coupling arrayfire with boost::odeint
I wrote a function incorporating several calls to 2d-ffts and matrix-vector-multiplications in C++, using arrayfire, such that I can run and compile the program both on the CPU and GPU. Reason for ...
0
votes
1
answer
109
views
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 <arrayfire>
int ...
1
vote
1
answer
81
views
Problem adapting MatchedFilter algorithm for new ArrayFire version
I am trying to adapt the matched filter algorithm (given here) for arrayfire version 3.6.4.
Here is what I ended up with:
#include <arrayfire.h>
using namespace af;
struct SAR_data { //! SAR ...
1
vote
1
answer
138
views
ArrayFire Exception (Input types are not the same)
I am trying to figure out use of arrayfire library and I have written following small code snippet to create a 2D plot like
af::info();
af::Window myWindow(800, 800, "2D Plot example: ArrayFire");...
2
votes
1
answer
386
views
Usage of unified backend in ArrayFire
I'm trying to select my arrayfire backend based on the available backends and their capability (if the backend supports doubles, then use it, else not). Therefore, I created a CMakeLists.txt-file:
...
1
vote
0
answers
92
views
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 ...
1
vote
2
answers
628
views
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 ...
-1
votes
1
answer
364
views
arrayfire, pointers, and c++
I have been trying to procedurally generate an array of arrayfire arrays.
When dealing with other objects in the past I could either so something like:
className * listName = (className*)malloc(...
1
vote
1
answer
218
views
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 ...
1
vote
1
answer
411
views
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,...
4
votes
1
answer
535
views
Arrayfire array from complex host data
I'm having a problem initializing an arrayfire array from host data.
The following code will not link for me:
constexp int mNumEigenInfos = 100;
std::complex<float> mEigenVectors[...