arrayfire

Retrieving values from arrayfire array as standard types and serialization

不想你离开。 提交于 2021-02-07 13:37:52
问题 I recently saw arrayfire demonstrated at GTC and I thought I would try it. Here are some questions I have run into while trying to use it. I am running Visual Studio 2013 on a Windows 7 system with OpenCL from the AMD App SDK 2.9-1. The biggest frustration is that I cannot view the state of array objects in the debugger to see what data is in it. I must rely on the af_print statement. That is very annoying. Is there any way to configure the debugger to let me see the data in the array without

Retrieving values from arrayfire array as standard types and serialization

白昼怎懂夜的黑 提交于 2021-02-07 13:37:45
问题 I recently saw arrayfire demonstrated at GTC and I thought I would try it. Here are some questions I have run into while trying to use it. I am running Visual Studio 2013 on a Windows 7 system with OpenCL from the AMD App SDK 2.9-1. The biggest frustration is that I cannot view the state of array objects in the debugger to see what data is in it. I must rely on the af_print statement. That is very annoying. Is there any way to configure the debugger to let me see the data in the array without

Rcpp: cannot open shared object file

落花浮王杯 提交于 2020-01-25 03:59:27
问题 I'm trying to develop an R package, which makes use of Arrayfire, thanks to Rcpp library. I've started writing a sample code (let's name it hello_world.cpp ) which looks like this: #include <arrayfire.h> // [[Rcpp::export]] bool test_array_fire(){ af::randu(1, 4); return true; } Then, I tried to compile it using a sourceCpp function Rcpp::sourceCpp('src/hello_world.cpp') My first suprise was the fact I had to set some flags manually ( sourceCpp seems to ignore Makevars config when compiling a

af::array::device doesn't work with complex arrays

£可爱£侵袭症+ 提交于 2020-01-17 18:24:12
问题 I just want to "use" a complex af::array for a Cuda kernel. Unfortunately, the transformation which is described in the af documentation (http://arrayfire.org/docs/interop_cuda.htm) doesn't work here: #include <arrayfire.h> #include <af/cuda.h> #include <thrust/complex.h> #include <cuComplex.h> using namespace af; typedef thrust::complex<double> D2; void test(){ randomEngine en = randomEngine(); dim4 dims(4, 4); array a = randn(dims, c64, en); // array a = randn(dims, f64, en); a.eval(); D2

Runtime linking R-extension on MacOS

吃可爱长大的小学妹 提交于 2019-12-23 01:54:41
问题 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 <arrayfire.h> #include <stdio.h> int main() { unsigned int count; af_get_backend_count(&count); printf("backends: %d\n", count); return 0; } gives $ /usr/local/clang4/bin/clang -laf -o minimal minimal.c $ ./minimal backends: 2 Now I want to do the equivalent thing in R. I have #include <arrayfire.h> #include <Rinternals

Acessing a value on an ArrayFire array

旧巷老猫 提交于 2019-12-11 04:29:40
问题 I had a af::array and need to acess the value in a row, like z(8), e.g. But, when i try to do this, in a loop with a incremental i, the compiler returns cannot convert from 'af::array::array_proxy' to 'double' Someone knows how can I acess the value inside the array? Thanks. 回答1: Take a look at scalar in the arrayfire documentation here. For your use case, you can access the element like this : float val = z(8).scalar<float>(); Could you talk about why you need to do this? In many cases,

Arrayfire error with conditionals

不想你离开。 提交于 2019-12-11 02:27:00
问题 I am trying to saturate my arrays in ArrayFire. I want all values greater than 0.75 to saturate to 1.0 and all less than 0.25 to saturate to 0.0. I am using the following expressions. a(a > 0.75) = 1.0; a(a < 0.25) = 0.0; Here is is an af::array type. It works for a while but as soon as I get an array where there are no values greater than 0.75 I get the following exception. terminate called after throwing an instance of 'af::exception' what(): ArrayFire Exception (Invalid input size:203): In

SVD speed in CPU and GPU

試著忘記壹切 提交于 2019-11-30 15:09:38
问题 I'm testing svd in Matlab R2014a and it seems that there is no CPU vs GPU speedup. I'm using a GTX 460 card and a Core 2 duo E8500 . Here is my code: %test SVD n=10000; %host Mh= rand(n,1000); tic %[Uh,Sh,Vh]= svd(Mh); svd(Mh); toc %device Md = gpuArray.rand(n,1000); tic %[Ud,Sd,Vd]= svd(Md); svd(Md); toc Also, the run times are different from run to run, but the CPU and GPU versions are about the same. Why there is no speedup? Here are some tests for i=1:10 clear; m= 10000; n= 100; %host Mh=