NVC++ STL algorithms for GPU: Parallel backend must be specified

Hello everyone,

I have been trying to compile STL algorithms with NVC++.
Right now I am getting the error:

"/usr/include/c++/13/pstl/pstl_config.h", line 20: catastrophic error: #error directive: "A parallel backend must be specified"
  #    error "A parallel backend must be specified"
       ^

1 catastrophic error detected in the compilation of "example.cpp".

From the following compilation command line:

nvc++ -std=c++23 -stdpar=gpu -I/usr/include/c++/13/ example.cpp

example.cpp is the Example from cppreference.

This same example compiles no problem when I run:

g++-13 -std=c++23 -I/usr/include/c++/13/ example.cpp

So it seems the problem is related to the NVC++ handling of the STL algorithms with parallel execution policy.

Did anybody run into this kind of problem before? I would greatly appreciate any help I could get.

I am using GNU tooling 13.1.0 and nvc++ 24.3-0.

While I’m not able to recreate this error, I am able to compile the code by configuring nvc++ to use the GNU 13.1 toolchain via the “–gcc-toolchain” option. By default, nvc++ will use the system GNU install, so unfortunately just setting the include path isn’t enough.

 % nvc++ -std=c++23 example.cpp  -w -stdpar=gpu --gcc-toolchain=/home/sw/thirdparty/gcc/gcc-13.1.0/Linux_x86_64/ -V24.3
%

Given you’re using “g++13”, I presume the GNU 13.1 is co-installed and not the default GNU install?

In this case, the “–gcc-toolchain” option wont work given it would still pick-up the default install. So instead, let have you try creating a compiler config file via the command:

makelocalrc -d . -x -gcc /path/to/gcc-13 -gpp /path/to/g++-13 -g77 /path/to/gfortran

This will create a “localrc” file, which you can move and/or rename to something more descriptive.

Then set the environment variable “NVLOCALRC=</path/to/localrc” to point to this file.

1 Like

It worked!

My problem was that I did not set the NVLOCALRC env variable.

Thanks for the help.

Excellent!

FYI, if you want to make this the default config for this system and not have to remember setting NVLOCALRC, you can copy the localrc file to “~/.config/NVIDIA/nvhpc/24.3/localrc.”. Changing “sysname” to the name of the system.

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