ISHFT(I, SHIFT)
Fortran 関数を使用して、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
はデバイス整数で、値 1 でshift
カーネルに渡される引数です。cuda_bitshift
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
ただし、2 番目の引数 inを variable ではなく 1に置き換えると機能しますshift
。また、たとえば、シフトで算術を使用できる場合は、正常にI = I + shift
機能します。
これは組み込み関数が CUDA で動作しないことに関係していますか、それとも何か間違っていますか?