kunzmi / managedCuda

ManagedCUDA aims an easy integration of NVidia's CUDA in .net applications written in C#, Visual Basic or any other .net language.
Other
440 stars 79 forks source link

Update csproj to make these projects are able to be built in ARM64 sy… #113

Closed zhongkaifu closed 1 year ago

zhongkaifu commented 1 year ago

Update these csproj files to make projects are able to be built in ARM64 systems.

kunzmi commented 1 year ago

Hi, Thanks for reporting! You're right, compiling for x64 only dates from the old days when one had to handle x86 and x64 platforms which had different library names... As x86 is gone and with the .net features for P/Invoke to switch library names at runtime, AnyCPU should now be enough for all libraries.

I changed it now for all libraries including the solution file why I won't merge your PR though.

Can I ask on what platform you're running CUDA with ARM64? Is it one of the Jetson boards? Would be interesting to test compatibility a bit further (checking if all the API structures are really the same for all C++ compilers on Windows/Linux/x64/Arm64).

Cheers, Michael

zhongkaifu commented 1 year ago

Hi @kunzmi ,

Thank you for updates. ManagedCuda is really great! :)

My project "Seq2SeqSharp"(https://github.com/zhongkaifu/Seq2SeqSharp) depends on ManagedCuda, and it's running on Nvidia Jetson Nano (ARM64), and I do find one compatible issue in CudaContext.cs. After I comment a few code out, then it works very well. Here is the code change: https://github.com/zhongkaifu/managedCuda/commit/02f55878a2b384d7c050cfbc220a47b388f8191c

Nvidia Jetson Nano is running on Cuda 10.2, and it cannot be upgraded to a newer Cuda version. Maybe this is the reason why I got this compatible problem.

Thanks Zhongkai Fu

kunzmi commented 1 year ago

Indeed, the commented code was introduced in later Cuda-versions, using it with an older Cuda version throws an error.

I decided against additional versioning inside ManagedCuda (meaning that one could use multiple versions of native Cuda with one version of ManagedCuda) as it would be too much effort to maintain. Thus, with the current version of ManagedCuda, only the latest Cuda version is supported.

On the other hand, the existing API didn't change much, it was mostly just extended with new features, so it should be save and run just fine with the code commented out.

zhongkaifu commented 1 year ago

Thanks @kunzmi . That totally make sense to me. :)

Thanks Zhongkai Fu