我可以在 OpenACC 中使用 std::bitset 的函数吗?

Can I use std::bitset's functions with OpenACC?

本文关键字:bitset 函数 std OpenACC 我可以      更新时间:2023-10-16

是否可以在OpenACC区域使用bitset的函数?示例代码:

#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) {...}

如果我使用 pgc++ -fast -acc -Minfo=accel -ta=nvidia:managed -DNDEBUG -pgc++libs -g 和类似代码(LD_LIBRARY_PATH=/opt/pgi/linux86-64/lib(编译上面的代码,我会收到以下错误: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 ,但代码包含的行比 1288 少得多。
我使用 mystrcmp 是因为内置的 strcmp 需要 routine seq ,但据我所知,这是不可能解决的。
但是,如果vv.count()被注释掉,则编译成功。
我阅读并搜索了很多关于OpenACC和OpenACC问题的信息,但我没有找到对这个问题的相应回应。
我该怎么办?

不,抱歉,但我们(PGI(尚未添加对"std::bitset"例程的运行时支持。 由于这是我看到的第一个功能请求,我提交了一个新的 RFE (TPR#23746(,并将其发送给我们的编译器工程师,看看我们能做什么。