我安装了gcc-7
,gcc-8
和gcc-7-offload-nvptx
gcc-8-offload-nvptx
我尝试使用这两种方法来编译一个带有卸载的简单 OpenMP 代码:
#include <omp.h>
#include <stdio.h>
int main(){
#pragma omp target
#pragma omp teams distribute parallel for
for (int i=0; i<omp_get_num_threads(); i++)
printf("%d in %d of %d\n",i,omp_get_thread_num(), omp_get_num_threads());
}
使用以下行(gcc-7
也使用):
gcc-8 code.c -fopenmp -foffload=nvptx-none
但它没有编译,给出以下错误:
/tmp/ccKESWcF.o: In function "main":
teste.c:(.text+0x50): undefined reference to "GOMP_target_ext"
/tmp/cc0iOH1Y.target.o: In function "init":
ccPXyu6Y.c:(.text+0x1d): undefined reference to "GOMP_offload_register_ver"
/tmp/cc0iOH1Y.target.o: In function "fini":
ccPXyu6Y.c:(.text+0x41): undefined reference to "GOMP_offload_unregister_ver"
collect2: error: ld returned 1 exit status
一些线索?