Retrieving values ​​from arrayfire as standard types and serialization

I recently saw a massive fire demonstrated at the GTC, and I thought I'd give it a try. Here are some questions I came up with when trying to use it. I am running Visual Studio 2013 on Windows 7 with OpenCL from an AMD App SDK 2.9-1 application.

  • The biggest disappointment is that I cannot view the state of array objects in the debugger to see what data is in it. I have to rely on af_print statement. This is very annoying. Is there a way to configure the debugger so that I can see the data in the array without printing it?

  • As soon as I get my data in an array, how can I return the values ​​as standard data types. An example is shown below. I am trying to return element 5.0 as double. The line in the example does not work, and I cannot apply it to standard types. The only thing I can assign is another array. How can I get my data back?

    array test = constant(0, dim4(10, 2));
    test(span, 1) = 10.5;
    double val = test(5, 0);  //This does not compile. 
  1. Is there an easy way to serialize / deserialize an array to disk? I have not seen a way to do this, and since I cannot get the values ​​as standard types, I'm not sure how to store them.

  2. , , , , . , 52 "af_print (rainfall)". , 8, . , opencl . . , , ?

+4
1

:

  • ArrayFire , VS ( , NSight ). , ( 2).

  • host() . :

    // Type 1
    array a = randu(3, f32);
    float *host_a = a.host<float>();        // must call array::free() later
    printf("host_a[2] = %f\n", host_a[2]);  // last element
    af::freeHost(host_a);
    
    // Type 2
    array a = randu(3, f32);
    float *host_a = new float[3];
    a.host(host_a);
    printf("host_a[2] = %f\n", host_a[2]);  // last element
    delete [] host_a;
    
  • < ( ostream) dim4. std::cout << array << std::endl; . fstream.

  • . . github.

- Edit-- 4. , , https://github.com/arrayfire/arrayfire/pull/531. .

2: af:: af:: freeHost , ArrayFire.

+4

All Articles