Rish
Rish

Reputation: 569

How to change compiler of OpenMPI

I have OpenMPI which is using gcc to compile. I need to cross compile from an x86_64 host architecture to an aarch64 target architecture. Instead of using gcc to compile, I want to use aarch64-linux-gnu-gcc to cross compile.

Anyone know how to change the compiler from gcc to aarch64-linux-gnu-gcc?

Thanks in advance.

Upvotes: 3

Views: 2835

Answers (1)

Steffen Seckler
Steffen Seckler

Reputation: 191

openmpi allows using their mpi-wrappers (i.e., mpicc, mpic++, ...) with a different compiler by specifying:

OMPI_CC=COMPILER_NAME_OR_PATH
OMPI_CXX=COMPILER_NAME_OR_PATH

e.g.,

OMPI_CC=clang
OMPI_CXX=clang++

or

OMPI_CC=/usr/bin/gcc-11
OMPI_CXX=/usr/bin/g++-11

In some cases, you might need to export these variables by prepending the export keyword.

Upvotes: 5

Related Questions