Ich versuche nvcc
zu verwenden folgenden Multi-Thread-Programm zu erstellen, die von "gcc -pthread a.c
", bevor gebaut ist:Unterstützt nvcc intern die Option "-pthread"?
$ cat a.c
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
void *myThreadFun(void *vargp)
{
printf("myThreadFun \n");
return NULL;
}
int main()
{
pthread_t tid;
printf("Before Thread\n");
pthread_create(&tid, NULL, myThreadFun, NULL);
pthread_join(tid, NULL);
printf("After Thread\n");
exit(0);
}
"nvcc -pthread a.c
" Execute:
nvcc
unterstützt Aufbau multi-
$ nvcc -pthread a.c
nvcc fatal : Unknown option 'pthread'
Thread-Programm ohne Verwendung der -pthread
Option. Und mein Test scheint auch recht:
$ nvcc a.c
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
$ ldd a.out
linux-vdso.so.1 (0x00007ffcff79e000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fd4f5a43000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fd4f5825000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fd4f5621000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fd4f5299000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fd4f4f86000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fd4f4d6f000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fd4f49cb000)
/lib64/ld-linux-x86-64.so.2 (0x00007fd4f5c4b000)
Aber ich kann nicht den Beweis von nvcc
offiziellen document finden. Kann jemand helfen, es zu bestätigen?
nvcc ist kein Compiler und nvcc ist nicht, dass Code – talonmies
@talonmies Kompilieren Ich weiß nvcc ist die Hülle der CUDA-Suite kompilieren. Könnten Sie Ihre Kommentare ausarbeiten? Danke! –