代码之家  ›  专栏  ›  技术社区  ›  JimBamFeng

PGI 18.1 vs PGI 18.4

  •  0
  • JimBamFeng  · 技术社区  · 7 年前

    PGi版本18.1到18.4是否有关于 #pragma routine seq,我的代码在版本18.1中运行良好,但在使用较新版本时出现错误。我使用数学库生成内核。

    使用名称空间std; #布拉格行政协调程序 双myfunc(双x) { 返回(晶圆厂(x)); }

    例程指令的默认并行性是(或曾经是)顺序的。 i、 e.#pragma acc routine等同于#pragma acc routine seq

    这在版本18.1中运行良好。 但我认为新版本可能会有一些变化,因为当我用18.4版本编译时,它会给出一个错误,抱怨数学库函数。

    奇怪的是,这也会导致错误

    #包括cmath

    #包括“openacc.h”

    使用名称空间std;

    #pragma acc routine seq
    double sine( double x )
    {
        return ( sin( x ) );
    } 
    

    给出编译错误,但当我将数学库更改为math时。h、 为什么任何人都不能完美地解释pgc+?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Mat Colgrove    7 年前

    你的实际错误是什么?我在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 code
    
    推荐文章