Closed royalstream closed 8 years ago
Thank royalstream. It works cool. I also noticed another issue, before issuing a post I want to have your suggestion: is it possible to divide an array with a double?
One more time thanks for your contributions
@altaybrusan you're welcome. I've found no way to scale an array by a scalar using the C API (which is what arrayfire-dotnet wraps) All the arithmetic operations are between two arrays. Looking at the C++ code for the *= and /= operators (when used with a scalar) it seems like internally what they do is creating a temporary constant array of the same size and then performing the operation as usual (see the ASSIGN_TYPE macro in their array.cpp). I could add this functionality as a separate PR (after they accept this one). But in the meantime you could do the same by hand.
Ye,Thats what I have done
I also noticed there is no function for loading files,such as af_load_image_memory available in the wrapper! Any idea if is going to be implemented near soon or not?
I'm not sure if its just my system, but I'm running into a Backend Mismatch error for OpenCL (works fine for CUDA and CPU). I'm trying to investigate what the cause is.
The ArrayFire OpenCL examples work fine though.
Edit: It looks like its setting the CUDA Backend for OpenCL too. Backtrace:
Testing OPENCL Backend
ArrayFire v3.3.0 (CUDA, 64-bit Windows, build 5842ed2)
Platform: CUDA Toolkit 7.5, Driver: CUDA Driver Version: 8000
[0] GeForce GTX 770, 2048 MB, CUDA Compute 3.0
3
ArrayFire.ArrayFireException: 503
at ArrayFire.Internal.VERIFY(af_err err) in d:\workspace\arrayfire-dotnet\Wrapper\Internal.cs:line 169
at ArrayFire.Array.op_Addition(Array lhs, Array rhs) in d:\workspace\arrayfire-dotnet\Wrapper\Array.cs:line 143
at CSharpTesting.Program.TestBackend() in d:\workspace\arrayfire-dotnet\Examples\Unified\CSharp\Program.cs:line 17
at CSharpTesting.Program.Main(String[] args) in d:\workspace\arrayfire-dotnet\Examples\Unified\CSharp\Program.cs:line 47
The helloworld C# example is running into vshost.exe has stopped working
. Would you know anything about this?
Quick question: If I'm using the Unified Backend, how could I be doing something wrong for OpenCL but right for CUDA? Could it be related to multiple OpenCL devices on the same machine? I remember that being an issue.
Yeah I'm not entirely sure either. I tried looking at the code but found nothing obvious...im going to try and test it on another machine.
Do you get the error if you run the OpenCL without running the CPU and CUDA tests? That is, please comment out the first two tests.
Yes I tested OpenCL only, and that failed too. I tested the helloworld examples too by calling CPU/CUDA/OpenCL all independently. OpenCL still ran into the same error.
In my computer it runs perfectly, as long as I only run OpenCL without CUDA or CPU before it and as long as I don't use DEBUGGING.
Are you using the code from my new PR or the previous version? I don't think this PR is related, both should behave in the same way.
Here are further observations:
afcuda.dll
to afcuda.dll.bak
Well, my bad I think my last point can be ignored.
This is what I've found on my system:
Do you get the same behavior?
Maybe we should continue this conversation here
What about this PR? can it be merged?
Can you make the changes to the helloworld example (use Backend.DEFAULT
) and print device info?
Also, the vshost.exe failure happens in debug mode. It looks like it may have to do with the build options.
Once these two action items are done, I'll merge it.
The vshost one can be fixed by checking the Project Properties -> Debug -> Enable Native Code Debugging
box in the C# and ArrayFire DLL projects.
I had to edit the csproj by hand because using the checkbox was saving the changes in the csproj.user file. In any event, the changes are done.
Summary:
The HelloWorld examples have a few new lines showing the indexing functionality for both C# and F#
Array.cs: has a new indexing operator [] Util.cs: new Seq() and Span members Data.cs: new Copy() method (which was missing)
Inside the Interop folder there's a new file (AFIndex.cs) and there's a new class af_seq.
AutoGenTool changes can be pretty much ignored since they are only for development purposes (code/interop generation).