我正在尝试使用 fortran 函数ISHFT(I, SHIFT)
在 CUDA 内核中进行一些位移。这会将整数向右移动位I
。SHIFT
问题是如果我为 SHIFT 参数传递一个变量,则 ISHFT 在内核上不起作用。这是我的代码的内核部分:
attributes(global) subroutine cuda_bitshift(shift)
integer, intent(in), value :: shift
I = ishft(I,shift)
end subroutine cuda_bitshift
这I
是一个设备整数,shift
是一个传递给内核的参数cuda_bitshift
,值为 1。
当我尝试编译这个(使用pgf90 test.cuf
)时,它说:
PGF90-S-0000-Internal compiler error. unexpected runtime function call 0 (test.cuf: 14)
0 inform, 0 warnings, 1 severes, 0 fatal for cuda_bitshift
/tmp/pgcudafor20YgIPXBfH0R.gpu(10): error: expected an expression
1 error detected in the compilation of "/tmp/pgnvdW1YgqoRn5Yjn.nv0".
PGF90-F-0000-Internal compiler error. pgnvd job exited with nonzero status code 0 (test.cuf: 14)
PGF90/x86-64 Linux 10.8-0: compilation aborted
但是,如果我将第二个参数替换为ishft
1 而不是变量,它会起作用shift
。此外,如果我可以使用带移位的算术,例如,I = I + shift
效果很好。
这与不能在 CUDA 上运行的内在函数有关,还是我做错了什么?