关于# PGi例程seq,从18.1版到18.4版有什么变化吗?我的代码在18.1版上运行得很好,但当我使用较新的版本时,会出现错误。我使用数学库生成内核。
使用命名空间std;#杂注acc例程double myfunc(double x) { return(fabs(x));}
例程指令的默认并行度是(或was)顺序的。即#杂注acc例程等同于#杂注acc例程seq
这在版本18.1中运行良好。但我认为新版本可能会有一些变化,因为当我使用18.4版本编译时,它给出了一个错误,抱怨数学库函数。
奇怪的是,也会导致错误
#include cmath
#include "openacc.h“
使用命名空间std;
#pragma acc routine seq
double sine( double x )
{
return ( sin( x ) );
} 给出了编译错误,但当我将数学库更改为math.h时,它完全没有问题,有人能解释为什么不能与pgc++一起工作吗?
发布于 2018-10-30 00:30:45
你得到的实际错误是什么?对于PGI 18.1和18.4,我都得到了相同的错误:
% pgc++ -c test1.cpp -ta=tesla -Minfo=accel -w -V18.1
PGCC-S-1000-Call in OpenACC region to procedure 'sin' which has no acc routine information (test1.cpp: 10)
PGCC-S-0155-Compiler failed to translate accelerator region (see -Minfo messages) (test1.cpp: 10)
sine(double):
10, Generating acc routine seq
Generating Tesla code
11, Accelerator restriction: call to 'sin' with no acc routine information这里的解决方案是包含PGI头文件"accelmath.h“,以获取C99数学内部函数的设备版本。
% diff test1.cpp test2.cpp
4a5
> #include "accelmath.h"
% pgc++ -c test2.cpp -ta=tesla -Minfo=accel -w -V18.1
sine(double):
12, Generating acc routine seq
Generating Tesla code
% pgc++ -c test2.cpp -ta=tesla -Minfo=accel -w -V18.4
sine(double):
12, Generating acc routine seq
Generating Tesla codehttps://stackoverflow.com/questions/52993007
复制相似问题