OpenACC-缺少结束数据区域块

时间:2018-11-15 19:09:38

标签: c++ typedef openacc

编译时出现错误“缺少结束数据区域块”

pgc ++ -mp -ta = tesla:cuda9.1 -Minfo = accel fig.cpp mesh.cpp main.cpp

我有这个程序,我使用的是PGI 18.4

//////////////////figure.h
#include <iostream>
class figure;
typedef double(figure::*FuncPtr)(double, double);
class figure
{
    public:
    figure(void);
    ~figure(void);
    #pragma acc routine seq
    double sum(double u, double v);
};
//////////////////figure.cpp
#include "figure.h"
figure::figure(void)
{
    #pragma acc enter data create(this)
}
figure::~figure(void)
{
    #pragma acc exit data delete(this)
}
double figure::sum(double u, double v)
{
return u + v;   
}
//////////////////mesh.h
#include "figure.h"
class Mesh{
public:
    double u,v;
    figure* m_Figure;
    #pragma acc routine seq
    void SetFun(void);
    void get();
    Mesh();
    ~Mesh();
};
//////////////////mesh.cpp
#include "mesh.h"
FuncPtr X;
#pragma omp threadprivate(X)
Mesh::Mesh(void)
{
    #pragma acc enter data create(this)
    #pragma acc enter data create(m_Figure[0:1])
}
Mesh::~Mesh(void)
{   
    #pragma acc exit data delete(m_Figure[0:1])
    #pragma acc exit data delete(this)
}
void Mesh::SetFun(void)
{
X = &figure::sum;
}
void Mesh::get(void)
{   
    int N = 5;
    Mesh ObjNew;
    ObjNew.u = 23;
    ObjNew.v = 48;
    ObjNew.SetFun();
    std::cout << (m_Figure->*X)(ObjNew.u,ObjNew.v) << std::endl;
    #pragma acc parallel loop copyin(N) copy(ObjNew,m_Figure[0:1]) private(X)
    {
        for (int i = 0; i < N; i++)
        {
            ObjNew.SetFun();
            (m_Figure->*X)(i*i,i);
        }
    }
}
//////////////////main.cpp
#include "mesh.h"
int main(){
    Mesh Obj;
    Obj.get();
    return 0;
}

那么typedef的问题呢?也许还有其他东西? 我还尝试使用-Minfo = all选项进行编译,但对问题没有任何新认识。

0 个答案:

没有答案