Discussion:
[OMPI users] Using mpicc to cross-compile MPI applications
Graham Holland
2017-03-03 01:23:52 UTC
Permalink
Hello,

I am using OpenMPI version 1.10.2 on an arm development board and have
successfully cross-compiled the OpenMPI libraries and am able to use
them with simple MPI applications.

My question is, what is the best approach for cross-compiling more
complex MPI applications which use mpicc to determine compiler flags?
The mpicc that is built is an ARM executable and obviously cannot
be run on my host.

An example of such an application is MPPTEST, which uses mpicc from
within its Makefile: ftp://ftp.mcs.anl.gov/pub/mpi/tools/perftest.tar.gz

I have read in the FAQ about overriding the compiler wrapper default
flags using environment variables, so one possibility is to use my
host mpicc with these set appropriately.

I am wondering however if there is better way?

Thank you,

Graham
Gilles Gouaillardet
2017-03-03 01:39:34 UTC
Permalink
Graham,


you can configure Open MPI with '--enable-script-wrapper-compilers'

that will make wrappers as scripts instead of binaries.


Cheers,


Gilles
Post by Graham Holland
Hello,
I am using OpenMPI version 1.10.2 on an arm development board and have
successfully cross-compiled the OpenMPI libraries and am able to use
them with simple MPI applications.
My question is, what is the best approach for cross-compiling more
complex MPI applications which use mpicc to determine compiler flags?
The mpicc that is built is an ARM executable and obviously cannot
be run on my host.
An example of such an application is MPPTEST, which uses mpicc from
within its Makefile: ftp://ftp.mcs.anl.gov/pub/mpi/tools/perftest.tar.gz
I have read in the FAQ about overriding the compiler wrapper default
flags using environment variables, so one possibility is to use my
host mpicc with these set appropriately.
I am wondering however if there is better way?
Thank you,
Graham
_______________________________________________
users mailing list
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Graham Holland
2017-03-03 22:37:15 UTC
Permalink
Hi Gilles,

Thanks for the quick response. I tried your suggestion of setting
the --enable-script-wrapper-compilers option to configure and ran
into the following bug (as I am on version 1.10.2):

https://www.mail-archive.com/***@lists.open-mpi.org/msg30166.html

I applied the patch found in your message above, and now have a
working mpicc perl script. However, this is the output of mpicc --showme:

arm-linux-gnueabihf-gcc -I/usr/include -pthread -L/usr/lib -Wl,-rpath
-Wl,/usr/lib -Wl,--enable-new-dtags -lmpi -lm -ldl -lutil

As you can see the include and library paths refer to my host, instead
of my cross-compiler's sysroot as I might have expected. Do you know
why this is the case?

I noticed in the generated ompi_wrapper_script that the variables,
includedir and libdir are set as follows:

my $includedir = "/usr/include";
my $libdir = "/usr/lib";

Which I assume are generated from ompi_wrapper_script.in from the
following:

my $includedir = "@OMPI_WRAPPER_INCLUDEDIR@";
my $libdir = "@OMPI_WRAPPER_LIBDIR@";

Is there a way to fix this? I *think* what I need is for the -I
and -L options to use paths from $SYSROOT/usr/include and
$SYSROOT/usr/lib while the linker rpath option should use
/usr/lib

Please let me know if you need more information about my setup
and thanks for your help so far.

Cheers,
Graham
Post by Gilles Gouaillardet
Graham,
you can configure Open MPI with '--enable-script-wrapper-compilers'
that will make wrappers as scripts instead of binaries.
Cheers,
Gilles
Post by Graham Holland
Hello,
I am using OpenMPI version 1.10.2 on an arm development board and have
successfully cross-compiled the OpenMPI libraries and am able to use
them with simple MPI applications.
My question is, what is the best approach for cross-compiling more
complex MPI applications which use mpicc to determine compiler flags?
The mpicc that is built is an ARM executable and obviously cannot
be run on my host.
An example of such an application is MPPTEST, which uses mpicc from
within its Makefile: ftp://ftp.mcs.anl.gov/pub/mpi/tools/perftest.tar.gz
I have read in the FAQ about overriding the compiler wrapper default
flags using environment variables, so one possibility is to use my
host mpicc with these set appropriately.
I am wondering however if there is better way?
Thank you,
Graham
_______________________________________________
users mailing list
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
_______________________________________________
users mailing list
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Loading...