您好,我最近在学习cuda/hip编程,在dcu上进行最简单的hello程序编写时,出现如下错误,请问是什么原因?
我的代码:
#include <stdio.h>
#include <hip/hip_runtime.h>
__global__ void kernel(){
printf("hello dcu!\n");
}
int main() {
kernel<<<10,1>>>();
return 0;
}
我加载的环境:
compiler/dtk/22.04.2
compiler/devtoolset/7.3.1
mpi/hpcx/gcc-7.3.1
anaconda3/5.2.0
编译流程:
$ hipcc hellodcu.cpp -o hellodcu
$ ./hellodcu
报错截图:

暂无数据
您好,代码修改如下:
#include <stdio.h>
#include <hip/hip_runtime.h>
__global__ void kernel()
{
printf("hello dcu!\n");
}
int main()
{
kernel<<<1,1>>>();
hipDeviceSynchronize();
return 0;
}
运行之前请先export HIP_KERNEL_PRINTF=1