i7 versus CUDA; CPU slow down Need help

Guys,

We have written an application that would show CUDA speedups over the screen (by graphs, printing numbers etc.).

We tested this on a new I7 (4 cores, 2 threads each) board. Things go on well for some 10 mins after which the algorithms slow down heavily on the CPU side - showing bloated up speedup on the screen.

The board has 2 GPUs (8800GTX + TESLA C1060) and our C++ library is multi-GPU capable.

I have the following questions:

These algorithms have long been tested under C++ environment properly. However, this GUI app is in C# and is in .NET run time environment.
Will that make any differnce? I am using DLLImports to call my C++ functions and class members from C#

I tried re-compiling my C++ library with with /clr added to XCompiler. However, NVCC aborts abruptly.
My application requires managed code to call unmanaged code. The vice-versa part is NOT needed. In this context,
is /clr still necessary?

I think this might have to do with Garbage collection of C# – although this is just an intuitive wild guess. I have active references to all objects in the system and so the GC should not pose much of a problem.

Overheating of board due to GPUs is another thing though the motherboard has this extra fan on the side to circulate air.

Appreciate any inputs on this.

Best Regards,
Sarnath

How did you implement GC for your C# classes? Did you make sure to implement both Dispose() and a finalizer for your classes that are using DllImport methods? If not, you’ll eventually get memory leaks in the program, which could be why it works for a while, then crashes. That would also explain why the library worked before, but is crashing with the .NET GUI.

Thanks,

btw, I ran my app on another I7 board that had 8 threads of 3.2GHz each and everything worked normally. Although it crashed after 1.5 hours – but no slowdowns or degraded performance.

Now, after seein your reply – I think I could look @ this problem with more perspective… Read on…

I have not implemented GC. I thought it was done automatically (based on some kinda reference counting) by the .NET framework.

I have no disposable/finalizer classes for my C# classes and neither for the C# bridge class that imports the DLL functions.

Hmm… I am pretty much new to C# and the .NET framework… but I am very convinced that I won’t touch C++ again except for Winux support! (That too, I think some1 talked about Mono framework for Linux that would enable C# apps to be ported easily to Linux). I need to check.

I will look into the web on these issues.

Best Regards

Sarnath

Sarnath, check out this link, it should help you get started on your GC code:
http://msdn.microsoft.com/en-us/library/b1yfkh5e.aspx

In C#, only managed types are garbage collected. When you do any interop stuff where you’re accessing unmanaged code (e.g. CUDA driver, allocated memory on the device, etc.) you need to implement garbage collection by adding a finalizer to your object (a ‘destructor’ in C++) and implementing the IDisposable interface (which has only one method, Dispose()). That page I linked to has a good overview on some best practices, etc.

Also, if you’re trying to make a cross-platform C#/CUDA library, all you need to do is to check for what system you’re on from the Environment.OSVersion property, then call the appropriate platform’s driver through DllImport().

Thank you very much! I think this will give some perspective!

In fact, I was using a CHash bridge class to cover the underlying C++ library. And every member of that CHash bridge class was static.

I think I just need to declare the class as “Static” and thats all.

I make sure I destroy objects that are created in C++ and the number of my C# objects are constant. So, making the intervening class ‘static’ would help.

Anyway, I will read through the link and see what I can do.

Thanks for all your help!

Best Regards,

Sarnath