Frage

I'm trying my hand at using the relocatable-device-code flag. I have a large project that would be easier to maintain with small blocks of code.

I was able to get the project to compile. When trying to run it, I get a hard crash. When using the debugger:

(gdb) where
#0  0x0000000000000001 in ?? ()
#1  0x00007fffffffe39c in ?? ()
#2  0x0000000000000000 in ?? ()

I've never seen a stack trace like that! I then reduced the amount of code until I came down to a singularity: main.cu file contains only

#include <iostream>

int main(void) {
    std::cout << "hello, world" << std::endl;
    return 0;
}

Which still fails. I'm using the following flags to compile my main.cu file.

nvcc    -shared -rdc=true -arch=sm_20 -Xcompiler -fPIC -g -G

Do these make sense? Why the segmentation fault for such a simple progam?

War es hilfreich?

Lösung

Remove the -shared switch. That option is not applicable when you are trying to generate an executable.

From the documentation:

Generate a shared library during linking. Note: when other linker options are required for controlling dll generation, use option -Xlinker.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top