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
449 stars 80 forks source link

Added OpTensor for cuDNN. #25

Closed mrakgr closed 8 years ago

mrakgr commented 8 years ago

I made the OpTensor functions for the cuDNN wrapper. I should have done this 4 month ago, but I missed it by accident it seems. Well, here it is now.

Also I've noticed you did not accept the changes to the descriptions of amin, amax and such. The ones about the C vs Fortran notation. It should be C indexing notation by default. You can find the correct description in one of the previous commits on my fork.

kunzmi commented 8 years ago

I'm currently very busy with other projects... Once I'm done with the Cuda 8 update I will have a look at it! Thanks for the contribution, Michael

kunzmi commented 8 years ago

I merged it to master and also changed the CudaBLAS comments for AMIN/AMAX. Please check it... If everything is fine, I'll update the NuGet package.

Thanks, Michael

mrakgr commented 8 years ago

It might be partly my fault since I had difficulties with cloning the repo, but it would be good if you could undo the changes on the comments in the latest commit as now it says Fortran notation instead of the C notation. I fixed that 4 months ago and it does not seem to have been applied and then I lost the changes in the latest commit it seems. I had it right in the old one. For comparison, this is what you have currently.

Edit: Looking at previous commits, I see that it was correct before the latest. I have no idea why I thought the changes weren't accepted. My bad.

kunzmi commented 8 years ago

Now I'm confused: you say the actual indexing is C-style 0 based, right? I'm wondering, as e.g. on page 22 in the CUBLAS manual (chapter 2.5.2. cublasIamin()) it sounds more like FORTRAN indexing, with 0 as an error marker... Quick check with some code:

CudaBlas blas = new CudaBlas(PointerMode.Host);

float[] data = new float[] { 2, 20, 5, 1, 10 };
CudaDeviceVariable<float> d_data = data;

int res = blas.Min(d_data, 1 ); //res = 4

MessageBox.Show(res.ToString());

blas.Dispose();
//again but with device pointers...
blas = new CudaBlas(PointerMode.Device);
CudaDeviceVariable<int> d_res = new CudaDeviceVariable<int>(1);
blas.Min(d_data, 1, d_res);

res = d_res; //res = 4
MessageBox.Show(res.ToString());

reveals: FORTRAN-indexing starting at 1, isn't it?

mrakgr commented 8 years ago

Er, yes it does. Memory is a fickle thing. Once again, sorry about that.