1

Lots of questions out there on trying to get NVCC to use the intel compiler. It doesn't work, I get that.

The most common answer that people give is to compile the device code into a library using NVCC/cl.exe and then compile the host code separately and link them. I'm attempting this, but am getting nowhere.

In VS2012 I have created a solution with 2 projects - one CUDA, the other a console application.

I have set the CUDA project to compile with VS2012 into a static library. It compiles no problem.

I have set the console application to intel 14.0 and to compile as an exe. I have also added the correct path to "Additional Library Dependencies" and have told the compiler about the CUDA library through "Additional Dependencies" (where I also told it about cudart_static.lib).

Build dependency is also set to compile the CUDA project first.

However, this setup is no good. Gives me an error which even google is at a loss for:

Error   5   error MSB4057: The target "ComputeLegacyManifestEmbedding" does not exist in the project.   C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\Win32\PlatformToolsets\Intel C++ Compiler XE 14.0\Toolset.targets  1162    7   rxnCalc_cpp

To verify that the linking is ok, if I set both projects to compile via VS2012 I get no problems.

OS - Windows 7 64bit (32bit application though)

Platform - VS2012

Cuda Toolkit - 6.0

Cuda Compute Version - 5.0 (and compiled as such)

So, am I just wasting my time or is there something I'm missing? It seems I have gone through a hundred posts, but I have yet to see a single success. Lots of people anxious to tell you that this is what you should do, but no one to tell you how to do it!

  • I would compile the CUDA based library into a dynamic library (DLL) instead of a static library. In Windows, a static library is not linked with its dependencies, so when you link the static library into you app, you will have to also link your app with CUDA, to fill the static library's dependency on CUDA. If you create a DLL, CUDA is completely hidden from your app. – Roger Dahl May 05 '14 at 03:01
  • Using a DLL worked. Not sure why a static library wouldn't, I did tell the compiler about CUDA; guess it didn't believe me :) – PointerFail May 05 '14 at 03:37
  • 1
    @PointerFail: Could you add that solution as an answer?(It is perfectly OK to answer your own questions) Later you can accept that answer, which will get the question off the unanswered question list and make it easier for the next person with the same problem to find by search. Thanks – talonmies May 05 '14 at 09:18

1 Answers1

2

For everyone out there using windows and trying to get CUDA and the intel compiler to co-operate, see my initial question on how I set up the solution.

To get it to work, as per Roger Dahl's suggestion, I changed the CUDA project to a DLL.

This involved the following modifications:

  1. Change CUDA project to dll

  2. Add __declspec(dllexport) to CUDA wrapper function

  3. Point console linker to the DLL lib file

This works and I am now able to utilize all intel compiler optimizations.

However, please note, I did need to set the intel compiler to only do single file IPO. Multi file IPO will cause errors, this was somewhat expected.

Hope this helps others in the same boat.