3

Is it possible to use bitset's functions in OpenACC region? An example code:

#include <string.h>
#include <bitset>

#pragma acc routine seq
int mystrcmp (const char *, const char *);
int main(int argc, char** argv)
{
    long sum = 3, i;
    std::bitset<11> vv;
    char *str;
    char *str2;

    #pragma acc parallel loop reduction(+:sum)
    for(i = 0; i<5000000000; ++i)
    {   
        sum +=i%2;
        if(i == 1){
            mystrcmp(str, str2);
            vv.count();
        }
    }
    return 0;
}
int mystrcmp (const char *s1, const char *s2) {...}

If I compile the code above with pgc++ -fast -acc -Minfo=accel -ta=nvidia:managed -DNDEBUG -pgc++libs -g and similars (LD_LIBRARY_PATH=/opt/pgi/linux86-64/lib), I get the following error: PGCC-S-0155-PGI support procedure called within a compute region: __blt_pgi_popcountl (proba2.cpp: 1288) PGCC-S-0155-Accelerator region ignored; see -Minfo messages (proba2.cpp: 28) main: 28, Accelerator region ignored 1288, Accelerator restriction: unsupported call to support routine '__blt_pgi_popcountl' PGCC/x86 Linux 16.10-0: compilation completed with severe errors, but the code consists of much less lines, than 1288.
I use mystrcmp because the built-in strcmp requires routine seq, but according to the best of my knowledge, that is impossible to solve.
But, if the vv.count() is commented out, then the compilation is success.
I read and searched a lot of about OpenACC and OpenACC problems, but I didn't find a corresponding response to this problem.
What should I do?

fokhagyma
  • 73
  • 1
  • 7

1 Answers1

2

No, sorry, but we (PGI) haven't added runtime support for the "std::bitset" routines. Since this is the first request I seen for the feature, I submitted a new RFE (TPR#23746) and have sent it to our compiler engineers to see what we can do.

Mat Colgrove
  • 5,441
  • 1
  • 10
  • 11
  • Thanks for the reply. I also want to ask that the pgc++ compiler supports the << operator to use parallel regions? because I don't think. – fokhagyma Feb 08 '17 at 09:53
  • Binary shift operators should work fine. Do you have an example of the problem you're seeing? – Mat Colgrove Feb 08 '17 at 17:11
  • Okay. I asked the wrong question. The << like overloaded operators I thought. For example: std::string str = "something"; #pragma acc kernels for (unsigned short int count = 1; count <= size; count++) { std::cout << str; } Then the compiler requires routine information. – fokhagyma Feb 09 '17 at 09:13
  • Formatted I/O is not supported (across all languages) on Tesla devices due to lack of support from the device runtime. In general however, operator overloading works fine. The compiler will auto-generate device routines for operators when the source is visible at compile time such as with templates and user defined classes. Problems would occur if the operator then calls an external routine such as a system call that does not have a device version. – Mat Colgrove Feb 09 '17 at 17:01
  • Thanks, because I don't have enough reputation score to upvote your comment. – fokhagyma Feb 10 '17 at 09:05