Nvc++: error: Undefined reference to memcmp after std::array::operator== on GPU

Hello,

Compiling the code below using nvc++ -stdpar -std=c++17 with version 21.3 of the HPC SDK produces an nvlink error regarding an undefined reference to memcmp.

#include <array>
#include <algorithm>
#include <execution>

int main(int argc, char *argv[])
{
  using namespace std;
  const auto pol = execution::par_unseq;
  vector<array<size_t,1>> v(1024);

  for_each(pol, v.begin(), v.end(), [=](array<size_t,1> &a){ a == a; });

  return 0;
}

I am using Ubuntu 20.10. The link error is:

nvlink error   : Undefined reference to 'memcmp' in '/tmp/nvc++hH5fvhEttmGU.o'
pgacclnk: child process exit status 2: /opt/nvidia/hpc_sdk_multi/Linux_x86_64/21.3/compilers/bin/tools/nvdd

Thanks,
Paul

Thanks Paul.

It looks like the array’s operator== uses "lexicographical_compare” which has an inlined “memcmp” embedded in it.

I filed an issue report, TPR #29962, and we’ll have our team see what we can do to add support for this.

-Mat

1 Like

Hi Paul,

Engineering just let me know that this issue was fixed in the 21.9 release.

-Mat

That is quite timely. Thanks, I see the fix here too.
Paul

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.