[OMPI users] how to identify openmpi in configure script

2007-06-05 Thread Lie-Quan Lee

I am a project written in C/C++ but used 3rd-party libraries written in
Fortran. In the linking stage, I use mpic++ andl need to put -lmpi_f90
-lmpi_f77 into the link flags.
I am wondering if anyone has already had a way to identify openmpi in
configure script using autoconf macro. By identifying openmpi in the
configure, I will be able to handle those libraries. Thanks.

--
Best regards,
Rich Lee
Stanford Linear Accelerator Center


Re: [OMPI users] how to identify openmpi in configure script

2007-06-05 Thread Lie-Quan Lee

this is neat but it will need to identify whether the MPI implementation is
openmpi. -- Not all the implementations accept --showme flag.

--Rich

On 6/5/07, Nuno Sucena Almeida  wrote:


Hi,
there's an autoconf macro you can find at

http://autoconf-archive.cryp.to/acx_mpi.html

it might be useful to you. I prefer to use it just to test the
existence of
MPI and then inside configure.ac something like (ugly):

(...)
MPI_CXXLIBS=`mpicxx --showme:link`
MPI_CXXFLAGS=`mpicxx --showme:compile`
AC_SUBST(MPI_CXXLIBS)
AC_SUBST(MPI_CXXFLAGS)
(...)
This is for C++, mind you, and then use these variables inside the
Makefile.am's which works fine for me, both for building libraries and
programs. Of course if mpicxx doesn't have the --showme you are out of
luck
with this approach.
Another alternative would be to just use the macro and then define
C/C++
compilers to point to the ones found by it, although I could never have it
working perfectly when I use it along with libtool.
If anyone has a better alternative, I would be glad to hear it!

Nuno

On Tuesday 05 June 2007 13:59, Lie-Quan Lee wrote:
> I am wondering if anyone has already had a way to identify openmpi in
> configure script using autoconf macro. By identifying openmpi in the
> configure, I will be able to handle those libraries. Thanks.

--
http://aeminium.org/slug/
___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users





--
Best regards,
Rich


Re: [OMPI users] how to identify openmpi in configure script

2007-06-05 Thread Lie-Quan Lee

I was thinking of this way. Is macro OPEN_MPI always defined in the openmpi
release? I search through FAQ and other docs and cannot confirm it. Or there
is another macro which is unique to openmpi?

--Rich

On 6/5/07, Anthony Chan  wrote:



Never tried this myself, but this test could work

AC_COMPILE_IFELSE( [
AC_LANG_PROGRAM( [
#include "mpi.h"
], [
#if defined( OPEN_MPI )
return 0;
#else
#error
#endif
 ] )
], [
mpi_is_openmpi=yes
], [
mpi_is_openmpi=no
] )

A.Chan


On Tue, 5 Jun 2007, Lie-Quan Lee wrote:

> I am a project written in C/C++ but used 3rd-party libraries written in
> Fortran. In the linking stage, I use mpic++ andl need to put -lmpi_f90
> -lmpi_f77 into the link flags.
> I am wondering if anyone has already had a way to identify openmpi in
> configure script using autoconf macro. By identifying openmpi in the
> configure, I will be able to handle those libraries. Thanks.
>
> --
> Best regards,
> Rich Lee
> Stanford Linear Accelerator Center
>
___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users





--
Best regards,
Rich


Re: [OMPI users] how to identify openmpi in configure script

2007-06-05 Thread Lie-Quan Lee

Using the OPEN_MPI #define is probably the safest bet to identify the
MPI as Open MPI, which then opens the door to using mpi --
showme to find the proper linker flags.  I would *NOT* recommend hard-
coding specific flags just because you know that you're linking
against Open MPI (because we can/have changed the flags behind the
scenes).



I think one of the possible solutions would be, in the next MPI standard
(will it come very soon?, or not?), specify the library (libraries) for
mixed language linking.

--
Best regards,
Rich


Re: [OMPI users] how to identify openmpi in configure script

2007-06-05 Thread Lie-Quan Lee


On Jun 5, 2007, at 6:46 PM, Jeff Squyres wrote:


On Jun 5, 2007, at 4:51 PM, Lie-Quan Lee wrote:


Using the OPEN_MPI #define is probably the safest bet to identify the
MPI as Open MPI, which then opens the door to using mpi --
showme to find the proper linker flags.  I would *NOT* recommend  
hard-

coding specific flags just because you know that you're linking
against Open MPI (because we can/have changed the flags behind the
scenes).

I think one of the possible solutions would be, in the next MPI
standard (will it come very soon?, or not?),


I would like to hope that MPI 2.1 comes out someday in the not-
distant future, but I'm guessing that it'll take quite a while.


specify the library (libraries) for mixed language linking.


MPI has traditionally shied away from specifying this kind of thing,
instead leaving it to be an implementation-specific detail.


it is a quite of headache for each compiler/platform to deal with  
mixed language
issues.  I have to compile my application on IBM visual age compiler,  
Pathscale, Cray X1E compiler,

intel/openmpi, intel/mpich, PGI compiler ...
And of course, openmpi 1.1 is different on this comparing with  
openmpi 1.2.2 (-lmpi_f77 is new to 1.2.2 version). :-)


You are right. MPI forum most like will not take care of this. I just  
made a wish ... :-)




What, exactly, do you need to do?  Do you need to link an application



that uses all 4 of the MPI language bindings?

Anthony Chan's macro works fine to identify the openmpi (Thanks a  
lot!). After that I use mpif90 -showme:link to find out the flags and  
put them into LDFLAGS in my application. -- That is all I needed.
Thanks.


best,
Rich Lee
Stanford Linear Accelerator Center


Re: [OMPI users] how to identify openmpi in configure script

2007-06-06 Thread Lie-Quan Lee

Hi Jeff,

Thanks for willing to put more thought on it. Here is my simplified  
story. I have an accelerator physics code, Omega3P that is to perform  
complex eigenmode analysis. The algorithm for solving eigensystems  
makes use of a 3rd-party  sparse direct solver called MUMPS (http:// 
graal.ens-lyon.fr/MUMPS/). Omega3P is written in C++ with MPI. MUMPS  
is written in Fortran 95 with MPI fortran binding. And MUMPS requires  
ScaLAPACK and BLACS. (sometime the vendor provides a scientific  
library that includes BLACS and ScaLAPACK).  They are both written in  
Fortran 77 with MPI Fortran binding.


I often need to compile them in various computer platforms with  
different compilers for variety of reasons.
As I mentioned before, I use C++ compiler to link the final  
executable. That will require MPI Fortran libraries and general  
Fortran libraries.


What I did to solve the above problem is, I have a configure script  
in which I will detect the compiler and the platform, based on that I  
will add compiler and platform specific flags for the Fortran related  
stuff (libraries and library path). This does well until it hit next  
new platform/compiler...


Some compilers made the above job slightly easier. For example in  
Pathscale compiler collection, it provides -lpathfortran for all what  
I need to link the executable using c++ compiler with fortran  
compiled libraries. So is IBM visual age compiler set if the wraper  
compilers (mpcc_r, mpf90_r) are used. The library name (-lxlf90_r) is  
different, though.



best regards,
Rich Lee


On Jun 6, 2007, at 4:16 AM, Jeff Squyres wrote:


On Jun 5, 2007, at 11:17 PM, Lie-Quan Lee wrote:


it is a quite of headache for each compiler/platform to deal with
mixed language
issues.  I have to compile my application on IBM visual age compiler,
Pathscale, Cray X1E compiler,
intel/openmpi, intel/mpich, PGI compiler ...
And of course, openmpi 1.1 is different on this comparing with
openmpi 1.2.2 (-lmpi_f77 is new to 1.2.2 version). :-)



You are right. MPI forum most like will not take care of this. I just
made a wish ... :-)


Understood; I know it's a pain.  :-(

What I want to understand, however, is what you need to do.  It seems
like your needs are a bit different than those of the mainstream --
is there a way that we can support you directly instead of forcing
you to a) identify openmpi, b) call mpi --showme:link to get the
relevant flags, and c) stitch them together in the manner that you  
need?


We take great pains to ensure that the mpi wrapper compilers
"just work" for all the common cases in order to avoid all the "you
must identify which MPI you are using" kinds of games.  Your case
sounds somewhat unusual, but perhaps there's a way we can get the
information to you in a more direct manner...?

--
Jeff Squyres
Cisco Systems

___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users