我试图运行这段代码,但在intel devcloud中使用以下命令进行编译时:
icpx -qopenmp -fopenmp-targets=spir64 openmp_target_offload_clause_ordering.cpp
export OMP_TARGET_OFFLOAD=MANDATORY它正在显示运行时错误。
#include <stdio.h>
int main() {
double *V = reinterpret_cast<double*>(0xdeadbeef);
printf("pointer=%p\n", V);
#pragma omp target parallel for simd is_device_ptr(V) if(true)
for(int i = 0; i < 1; ++i) {
printf("pointer=%p\n", V);
}
#pragma omp target parallel for simd if(true) is_device_ptr(V)
for(int i = 0; i < 1; ++i) {
printf("pointer=%p\n", V);
}
return 100;
}
发布于 2022-11-14 07:13:26
输入的设备指针无效。在主函数的第一行中,将(0xdeadbeef)替换为(omp_target_alloc(size, 0)),如下所示:
( reinterpret_cast(omp_target_alloc(size,0));
希望这能有所帮助!
https://stackoverflow.com/questions/74387004
复制相似问题