OpenACC parallel kernels not getting generated

亡梦爱人 提交于 2019-12-24 15:09:20

问题


I am developing a code on PGC++ for graphically accelerating the code.

  • I am using OpenBabel which has Eigen dependancy.
  • I have tried using #pragma acc kernel
  • I have tried using #pragma acc routine
  • My compilation command is: "pgc++ -acc -ta=tesla -Minfo=all -I/home/pranav/new_installed/include/openbabel-2.0/ -I/home/pranav/new_installed/include/eigen3/ -L/home/pranav/new_installed/lib/openbabel/ main.cpp /home/pranav/new_installed/lib/libopenbabel.so"

I am getting following error

PGCC-S-0155-Procedures called in a compute region must have acc routine information: OpenBabel::OBMol::SetTorsion(OpenBabel::OBAtom *, OpenBabel::OBAtom *, OpenBabel::OBAtom *, OpenBabel::OBAtom *, double) (main.cpp: 66)
PGCC-S-0155-Accelerator region ignored; see -Minfo messages  (main.cpp)
bondRot::two(std::vector>, OpenBabel::OBMol, int, OpenBabel::OBMol):
     11, include "bondRot.h"
           0, Accelerator region ignored
          66, Accelerator restriction: call to 'OpenBabel::OBMol::SetTorsion(OpenBabel::OBAtom *, OpenBabel::OBAtom *, OpenBabel::OBAtom *, OpenBabel::OBAtom *, double)' with no acc routine information
PGCC/x86 Linux 15.10-0: compilation completed with severe errors

NOTE: line 66 is "mol.SetTorsion(a[0],a[1],a[2],a[3],i*(3.14159265358979323846/180));" in pasted bode below.

my code which is showing this error is as follows:

#pragma acc routine
public:bool two(vector<OBAtom *> a)
{
std::ostringstream bestanglei,bestanglej;
for(unsigned int i=0;i<=360;i=i+res)
{
    for(unsigned int j=0;j<=360;j=j+res)
    {
        mol.SetTorsion(a[0],a[1],a[2],a[3],i*(3.14159265358979323846/180));

        //cout<<i<<"\n";
    }
}
return true;
}

From primary search on google, i got idea that this is error which is occurring because of "back dependency" of mol(OBMol object). If anyone knows the solution for it please help me out.


回答1:


In order to call a routine from within device code, their must be an available device version of the routine. In this case, the compiler can't find one for the "OpenBabel::OBMol::SetTorsion" routine. You'll need to add a "#pragma acc routine" directive in this library routine's prototype and definition, then compile the library with PGI and "-acc". Any routines that SetTorsion might call will need device versions as well.

Alternatively, you can try to inline these routines.

Note that you will have issues trying to write to the I/O stream and files from device code. Only limited support for unformatted stdout is available where the output from all threads are buffered, transferred back to the host, and then printed by the OS.

You'll also have issues with using STL::Vector. Besides not being thread safe, aggregate data types with dynamic data members are not yet supported in OpenACC. There are ways to handle these structures if you're willing to manage the data in the structure itself, or use CUDA Unified Memory (-ta=tesla:managed). If you're interested, I gave a talk on this subject at GTC2015 which you can review at: https://www.youtube.com/watch?v=rWLmZt_u5u4

Hope this helps, Mat



来源:https://stackoverflow.com/questions/35035427/openacc-parallel-kernels-not-getting-generated

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!