OpenACC:错误 "unsupported statement type: opcode=JSRA"
OpenACC: error "unsupported statement type: opcode=JSRA"
我正在尝试并行化此循环,但函数 fRSolver (&sw, ts->cmax);
有问题
#pragma acc parallel loop collapse(2) present(d, sw, ts)
for (k = KBEG; k <= KEND; k++){
for (j = JBEG; j <= JEND; j++){
.
.
.
#pragma acc routine(fRSolver) vector
d->fRSolver (&sw, ts->cmax);
}}
我收到这个错误:
139, Accelerator region ignored
141, Accelerator restriction: loop contains unsupported statement type
175, Accelerator restriction: unsupported statement type: opcode=JSRA
d 是 D 型变量:
typedef struct D_{
.
.
.
void (*fRSolver) (const Sw *, double *);
}D;
fRSolver
是一个指向函数的指针 void HSolver (const Sw *sw, double *cmax)
有没有一种方法可以在不改变调用函数 HSolver
的方式的情况下加速这个循环?
Is there a way I can accelerate this loop without changing the way the
function HSolver is called?
不,抱歉。设备代码中不支持函数指针和间接函数调用。这需要后期绑定(即函数解析在运行时完成),我们目前没有办法在设备上解析函数地址。 C++ 虚函数和 Fortran 类型绑定过程也会出现同样的问题。
它肯定在我们想要支持的列表中,并且希望在某个时候会支持,但到目前为止已被证明是一个重大挑战。您需要修改代码,让 fRSolver 成为直接调用,在 link 时间解析。
我正在尝试并行化此循环,但函数 fRSolver (&sw, ts->cmax);
#pragma acc parallel loop collapse(2) present(d, sw, ts)
for (k = KBEG; k <= KEND; k++){
for (j = JBEG; j <= JEND; j++){
.
.
.
#pragma acc routine(fRSolver) vector
d->fRSolver (&sw, ts->cmax);
}}
我收到这个错误:
139, Accelerator region ignored
141, Accelerator restriction: loop contains unsupported statement type
175, Accelerator restriction: unsupported statement type: opcode=JSRA
d 是 D 型变量:
typedef struct D_{
.
.
.
void (*fRSolver) (const Sw *, double *);
}D;
fRSolver
是一个指向函数的指针 void HSolver (const Sw *sw, double *cmax)
有没有一种方法可以在不改变调用函数 HSolver
的方式的情况下加速这个循环?
Is there a way I can accelerate this loop without changing the way the function HSolver is called?
不,抱歉。设备代码中不支持函数指针和间接函数调用。这需要后期绑定(即函数解析在运行时完成),我们目前没有办法在设备上解析函数地址。 C++ 虚函数和 Fortran 类型绑定过程也会出现同样的问题。
它肯定在我们想要支持的列表中,并且希望在某个时候会支持,但到目前为止已被证明是一个重大挑战。您需要修改代码,让 fRSolver 成为直接调用,在 link 时间解析。