c++cparallel-processingcluster-computingopenacc

Running pgc++ programs on Cluster


I tried to run the below OPenACC program on cluster:

#include <stdio.h>
#include <iostream>
using namespace std;

int main()
{
        #pragma acc parallel loop       
        for (int i=0; i<1000; i++)
        {
                //cout << i << endl;

                printf("%d ", i);
        }


        return 0;

}

The PBS Script for the above code:

#PBS -e errorlog1.err
#PBS -o logfilehello.log
#PBS -q rupesh_gpuq
#PBS -l select=1:ncpus=1:ngpus=1

tpdir=`echo $PBS_JOBID | cut -f 1 -d .`
tempdir=$HOME/scratch/job$tpdir
mkdir -p $tempdir
cd $tempdir
cp -R $PBS_O_WORKDIR/* .


module load nvhpc-compiler

#module load cuda10.1
#module load gcc10.3.0 
#module load nvhpc-21.11
#module load nvhpc-pgicompiler
#module load gcc920

pgc++  sssp.cpp
./a.out > output.txt


rm *.out
mv * $PBS_O_WORKDIR/.
rmdir $tempdir
~                

After submmitting the above job to que, I get the following error log:

"sssp.cpp", line 2: catastrophic error: cannot open source file "iostream"   #include <iostream>
                     ^

1 catastrophic error detected in the compilation of "sssp.cpp". Compilation terminated.

I tried running C programs on pgcc and they work fine. Running c++ programs on pgc++ is throwing error. What could be the reason?


Solution

  • What could be the reason?

    In order to be interoperable with g++, pgc++ (aka nvc++) uses the g++ STL and system header files. Since the location of these headers can vary, on installation a configuration file, "localrc", is created to store these locations.

    What could be happening here is that on install, a single system install was selected and hence the generated localrc is for the system from which the compilers were installed, not the remote system.

    If this is the case, consider re-installing with the "network" option. In this case, the creation of the localrc is delayed until the first compiler invocation with a unique localrc generated for each system.

    Another possibility is that creating of the localrc file failed for some unknown reason. Possibly a permission issue. To check, you can run the 'makelocalrc' utility to see if any errors occurred.

    Note for newer versions of nvc++, we are moving away from using pre-generated config files and instead determining these config items each time the compiler is invoked. The pervious concern being the overhead involved in generating the config, but this has become less of a problem.