CUDA with MinGW How to get CUDA running under MinGW?

I am working on a scientific project at the University of Innsbruck. Therefor i am creating 3d volumetric imaging tools with the QT-Framework. Since i only use the open source distribution of QT, i have to rely on MinGW for Windows to compile my software.

So how can I compile cuda binaries, libs, … with the MinGW environment eg. without Microsoft Visual Studio.

Is there any tutorial available for nvcc makefiles to execute in a console under Windows XP?

Thanks, GG

1 Like

The linux makefiles are probably a good place to start.

I tried that and the problem is twofold:

  1. the CUDA libs are for VS - I don’t know how to link these in MinGW g++
  2. there is no switch in nvcc to set the system compiler - there is only a parameter to tell nvcc where it is. So nvcc insists on using cl on XP.

If someone comes up with a solution to this, I’d like to hear because I also have QT4 GUIs that would be nice to run on XP too. Thanks.

Peter

Is it a hopeless task to get QT4 to compile with cl then? I was thinking he was still planning on using cl, just from mingw or cygwin.

The following page would seem to suggest it is possible…

http://www.trolltech.com/developer/notes/s…rted_platforms/

Haven’t tried that. There is a VS version of QT4 but it is not free (unlike the MinGW version). I would be a bit surprised if Trolltech would allow you to compile it from source yourself when they want to sell it.

Peter

Ah, sorry my fault. It is the other way around. Quote Trolltech:

That is good news. So we only need a CUDA version for MinGW. That should be a snap to do for NVIDIA given that they already have the GCC machinery working in the Linux version.

@NVIDIA: will we be able to switch nvcc on XP to use MinGW gcc ?

Peter

Quite a while back I remember I once got Intel’s C++ compiler to link with libraries created with the minGW gcc…so I imagine it would be theoretically possible with microsoft’s as well.

I don’t remember exactly what I did, but I believe I used Intel as the linker and passed the minGW libraries AND the Intel/microsoft libraries themselves explicity. The order in which the libraries were passed mattered a great deal, I think it was Intel first.

It might be worth trying if you can’t wait or if for some reason gcc under minGW won’t work with CUDA.

It’s pretty easy to compile the free open source Qt4 code with Visual Studio 2005:

http://qtnode.net/wiki/Qt4_with_Visual_Studio

Anything new to the topic? I’ve converted MSVC DLLs to MinGW DLLs with import libraries earlier, this should work for CUDA libs as well.

But what about nvcc invoking cl directly? New solutions?

Is there anybody who has succeeded in using MINGW gnu compilers and CUDA together?

NOTE:

While looking through the NVCC manual I see that there are a couple of compiler flags that say they are to be used on MINGW or CYGWIN. So I am sure someone at NVIDIA has implemented these …

Would you please care to let the rest of us know how to use MINGW?

Hi!

Is it’s planned to add support of MinGW in next version of nvcc? Any news about this?

For some projects, usage of VS 2005 is not a best choice… It will be hard to integrate CUDA code in some GNU projects running in Windows.

Thanks!


AG

There are no current plans to support mingw.

It’s now 2015. How about now?

Now it is 2016. So how about now? I cannot even use my Zed on Windows, because of the crappy VS dependancy. Why is there this technical limitation? If you already support GCC on Linux, then what is the technical reason not to support it on windows?

There are at least 2 general reasons, maybe 3

  1. CUDA uses a fairly tight integration with the host compiler. For example data structure alignment in memory must match, for every possible/conceivable arrangement of data types and qualifiers. Also, object file formats must be completely compatible. So there is actual technical effort to create the interface in the first place. If you want to see all the moving parts in the CUDA compilation process, run nvcc with the --verbose switch.

  2. Any interface must be validated. There is a QA effort/cost involved. Adding an additional configuration adds an additional dimension to the QA matrix, so the cost to add one major new dimension (like a compiler supported) can be considerable in terms of effort to validate the interface.

  3. The premier compiler on Windows is the one that is provided by the Windows vendor, namely Microsoft. Large commercial codebases get developed on this platform. So it will be the first choice of supported compilers on windows. In order to support other compilers, there would have to be significant market demand, as evidenced by actual usage for large industrial/commercial/enterprise codebases.

The situation is not likely to change in the near future. If there is enough evidence of need and demand, I’m sure NVIDIA would respond, however a constant theme internally is to look for ways to reduce the support matrix, not increase it. This is so that limited resources can be focused where they will provide the most benefit.

There are no technical issues that absolutely prevent the support of additional compilers. But there are definitely resource limitations, and support for a new compiler platform on windows would require a significant expenditure of resource and effort. The fact that it does not exist today indicates so far that the cost/benefit scenario is not compelling.

My comments above apply to the NVIDIA-provided toolchain, of course. There exist other toolchains that target CUDA GPUs, my comments don’t apply to those toolchains or efforts.

now msvc includes clang frontend, you may try it. there is also intel compiler. both ways you should get support of all gcc extensions, while being obj-file/ABI compatible with msvc

  1. This would be a problem if Nvidia didn’t support GCC at all. It does support it. Just not officially on Windows. I think there would be close to zero technical changes necessary to support MinGW.

2, 3) Can be basically summarized to not enough resources. For a company as big as Nvidia it shouldn’t be that big of an issue. I guess laziness is also a valid excuse these days. Less and less people are using VC these days though, because of the platform limiting factor.

I also actually only need to link a compiled CUDA library. For my GPGPU needs I happily use OpenCL. Doesn’t help that Nvidia hasn’t release the OpenCL driver for Jetson’s though, contrary what they promised. :(

I will have to work around it I guess. I’ll won’t use CUDA on Windows and only enable it on Linux.

msvc and mingw-gcc libraries are incompatible. overall, you have the way of using dll, or using the runtime api (or driver api?), i.e. low-level one

MinGW64 support would be really great! Thanks to MSYS2, a full Cuda build environment would be set up in ~20 minutes, and allows to build ~1000 standard libraries on Windows.

Is there any progress regarding CUDA with MinGW? If I paid money, can I get some support from Nvidia?