OpenACC, MPI, OpenMP

I have two programs in C++.
one of them MPI + OPENACC (1)

the other MPI+PENACC+OPENMP (2)

I am working on Ubuntu 20.04.4
NVC
First I try : (1)

mpic++ -Minfo=accel -fast -acc -ta=tesla mpi_isend_error_4_tested.cpp

g++: error: unrecognized command line option ‘-Minfo=accel’
g++: error: unrecognized command line option ‘-fast’; did you mean ‘-Ofast’?
g++: error: unrecognized command line option ‘-acc’
g++: error: unrecognized command line option ‘-ta=tesla’

What is the correct compile statment to run:
(1) MPI + OPENACC

(2) MPI+PENACC+OPENMP

Hi Huda22,

Looks like your mpic++ is configured for use with the g++ compiler. You need to use one that’s configured for use with nvc++.

We do ship several MPI with the NVHPC SDK, located under “<nvhpc_base_install>/Linux_x86_64//comm_libs”, which you can use.

-Mat

Thank you very much for the quick reply

This environment is new to me and I don’t have a background so Ubuntu is new to me

I tried to cancel the existing version through the following instructions and re-download it again, but to no avail

Can someone help me on how to configure MPI to work with NVC

sudo apt autoremove mpi

sudo apt-get install libopenmpi-dev
sudo apt-get install mpi

the same problem arise

mpic++ -I/opt/nvidia/hpc_sdk/Linux_x86_64/21.11/comm_libs/mpi/include -L/opt/nvidia/hpc_sdk/Linux_x86_64/21.11/comm_libs/mpi/lib -Minfo=accel -fast -acc -ta=tesla mpi_test.cpp -o tt 
g++: error: unrecognized command line option ‘-Minfo=accel’
g++: error: unrecognized command line option ‘-fast’; did you mean ‘-Ofast’?
g++: error: unrecognized command line option ‘-acc’
g++: error: unrecognized command line option ‘-ta=tesla’

You need to either set your PATH to include the MPI bin directory that ships with the NV HPC SDK, or build you’re own MPI with nvc++. Some MPI implementations allow you to change which compiler to use, for example with OpenMPI you’d set this via the OMPI_CXX environment variable (see: FAQ: Compiling MPI applications). However, the mpi drivers will still add implicit flags so this doesn’t always work well.

To change your environment variables on Linux, it will depend on which shell you’re using. For Bash and it’s derivatives you’d use the “export” command, while for Csh, you’d use ‘setenv’.

For example:

export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/21.11/comm_libs/mpi/bin:$PATH

You’ll also want to set the LD_LIBRARY_PATH so the correct runtime libraries are used:

export LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/21.11/comm_libs/mpi/lib:$LD_LIBRARY_PATH

Hope this helps,
Mat

1 Like

Thank you so much
It works

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