Unsupported call to support routine 'strlen'


I get the in the subject mentioned error, when I compile the following code (snippets with pragmas).

#pragma acc routine seq
    int getNumberOfFactors(IndexType varIndex)
      return gm_.numberOfFactors(varIndex);

#pragma acc parallel loop copy(weights_[0:gm_.numberOfVariables()])
        for (auto varIndex=0;varIndex<gm_.numberOfVariables();++varIndex)
            switch (variant_)
                case 0:
		    weights_[varIndex] = 1./getNumberOfFactors(varIndex);
                case 1:
		    weights_[varIndex] = 1./(getNumberOfFactors(varIndex)+1.);

gm_ is an object of the OpenGM-framework. Neither my code nor the gm_.numberOfFactors() function are calling strlen(). I hope someone can help me.

Thanks a lot.

Beneath the whole errorcode:

std::char_traits<char>::assign(char &, const char &):
     11, include "simplediscretespace.hxx"
           5, include "opengm.hxx"
                5, include "stdexcept"
                    39, include "string"
                         42, include "char_traits.h"
                             247, Generating implicit acc routine seq
                                  Generating Tesla code
     14, include "diffusion.hxx"
PGCC-S-0000-Internal compiler error. Call in OpenACC region to support routine - strlen (/home/zihforschung/scads/Masterarbeit/tests/diffusion.cc: 263)
std::char_traits<char>::length(const char *):
     11, include "simplediscretespace.hxx"
           5, include "opengm.hxx"
                5, include "stdexcept"
                    39, include "string"
                         42, include "char_traits.h"
                             263, Generating implicit acc routine seq
                                  Accelerator restriction: unsupported call to support routine 'strlen'
     14, include "diffusion.hxx"
PGCC/x86 Linux 15.5-0: compilation completed with severe errors

Hi bnau,

While your functions may not call strlen directly, someplace down the call tree it is getting called.

I just downloaded OpenGM and see that getNumberOfFactors does have an OPENGM_ASSERT in it which is defined as:

#ifdef NDEBUG
#  define OPENGM_ASSERT(expression)
#  define OPENGM_ASSERT(expression) if(!(expression)) { \
   std::stringstream s; \
   s << "OpenGM assertion " << #expression \
   << " failed in file " << __FILE__ \
   << ", line " << __LINE__ << std::endl; \
   throw std::runtime_error(s.str()); \

Given std::stringstream uses a char_traits type, this is most likely where strlen is coming from.

Can you try compiling with “-DNDEBUG”, which will disable these asserts, to see if this works around the error?

Note that all but the simplest non-formatted I/O is not supported on GPUs.

Hope this helps,

Hello Mat,

I tested to compile with the -DNDEBUG flag and it worked.

Thanks for the fast reply!