1

I'm trying to compile a dynamic parallelism example on CUDA and when i try to compile it gives and error saying,

kernel launch from __device__ or __global__ functions requires separate compilation modes

Later found that I have to set the --relocatable-device-code flag to true. But, is there a flag to set in order to make the set relocatable-device-code to true in Nsight Eclipse?

3
  • 1
    The defined way to enable this capability for an Nsight EE project is to do so at project creation time. After selecting File...New...CUDA C/C++ Project, you will be presented with the project creation wizard/dialog. Enter a project name and click "Next". You will then be taken to the "Basic settings" dialog page. Here you will see an option "Device linker mode:" and the choices will be "Whole program compilation" (default) or "Separate compilation". If you select "Separate compilation", then your project will be set up for relocatable device code generation. Commented Jul 8, 2016 at 10:42
  • 3
    After a project is created, you can also make this change by going to Project...Properties...Build...Settings. Here you will see a page similar to the one mentioned above in the "Basic settings" dialog page. You can similarly change "Device linker mode:" on this page from "Whole program compilation" to "Separate compilation" in order to turn on generation of relocatable device code, after the project has already been created. Commented Jul 8, 2016 at 10:47
  • What @robertcrovella said Commented Mar 26, 2018 at 22:05

3 Answers 3

1

If you are not using makefile project, you could change the options passed to nvcc of a Nsight project at the following position, starting from the menu.

Project - Properties - Build - Settings - Tool Settings - NVCC Compiler

As Nsight does not provide a rdc option for you to check, you could directly change 'Commnad' from

nvcc

to

nvcc -rdc=true

or change 'Command line pattern' from

${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX} ${OUTPUT} ${INPUTS}

to

${COMMAND} ${FLAGS} -rdc=true ${OUTPUT_FLAG} ${OUTPUT_PREFIX} ${OUTPUT} ${INPUTS}

The second one is better.

You may also want to change this for 'All configurations' rather than 'Debug' or 'Release' only.

EDIT

You should follow @RobertCrovella's instructions in the comment. It is the official way.

Sign up to request clarification or add additional context in comments.

2 Comments

nsight does provide an option to control generation of relocatable device code. You can review my comments under the question for specifics.
@RobertCrovella your are right. Your's should be the correct way. Mine is like a hack.
0

After a project is created, you can also make this change by going to Project...Properties...Build...Settings. Here you will see a page similar to the one mentioned above in the "Basic settings" dialog page. You can similarly change "Device linker mode:" on this page from "Whole program compilation" to "Separate compilation" in order to turn on generation of relocatable device code, after the project has already been created.

Credit goes to @robertcrovella. This was actually the answer I was looking for, so I've made it a separate answer.

Comments

-2

you can use nvcc option "-dc" or "-rdc=true", you can ref this as as sample.

nvlink, relocatable device code and static device libraries

1 Comment

This doesn't answer the question. The OP clearly knows which options are required to generate relocatable device code, and has written so in the question. The question is how to specify them from within Nsight Eclipse. How does this answer that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.