ArrayFireライブラリを利用して次のテストコードを使用しています。
void test_seq(const array& input, array& output, const int N)
{
array test = seq(0,N-1);
output = input;
}
(for the moment `array test` has no role)
double2* test_CPU; test_CPU=(double2*)malloc(10*sizeof(double2));
for (int k=0; k<10; k++) { test_CPU[k].x=2.; test_CPU[k].y=1.; }
array test_GPU(10, test_CPU);
array test_GPU_output = constant(0.,10, c64);
test_seq(test_GPU,test_GPU_output,10);
print(test_GPU_output);
try {
double2 *CPU_test = test_GPU_output.host<double2>();
printf("%f %f\n",CPU_test[0].x,CPU_test[0].y);
} catch (af::exception& e) {
fprintf(stderr, "%s\n", e.what());
}
そして、すべてが正しくコンパイルされ、実行されます。
ただし、上記の関数を次のように変更します
void test_seq(const array& input, array& output, const int N)
{
array test = seq(0,N-1);
output = input * test;
}
次のランタイムエラーメッセージが表示されます
src / gena / gtypes.cpp:112:エラー:タイプcuComplexの配列からcuDoubleComplexを要求しました
反対側で、私が行を変更した場合
double2 *CPU_test = test_GPU_output.host<double2>();
に
float2 *CPU_test = test_GPU_output.host<float2>();
すべてが再び正常に実行されます。の使用に関連してfloat2への降格があるようですseq
。上記の問題は、次のようなものを使用しても解消seq(0,N-1,f64)
されません(ArrayFireで許可されているかどうかさえわかりません)。
double2
処理を継続し、降格を回避するにはどうすればよいfloat2
ですか?