ML with OpenMPI

Jed Brown jed at 59A2.org
Tue Mar 25 02:38:37 CDT 2008


On Sat 2008-03-22 10:19, Lisandro Dalcin wrote:
> Give a try. When using MPICH2, PETSc just passes
> "--with-mpi=PATH_TO_MPI" and ML get it right. Perhaps ML have some
> trouble with OpenMPI, I've never tried. If you built OpenMPI yourself
> and with shared libs, do not forget to define LD_LIBRARY_PATH to point
> to the dir with the OpenMPI libs. If not, some configure test of ML
> could fail, and then MPI is assumed to be absent.

It turns out I was chasing this in entirely the wrong direction.  ML was
configured just fine and was correctly using MPI, but we had not defined
HAVE_CONFIG_H so ml_common.h was not setting all the variables that depend on
ml_config.h.  In particular, ml_config.h sets HAVE_MPI correctly, but the
following is in ml_config.h:

#ifdef HAVE_CONFIG_H
...
#ifdef HAVE_MPI
#ifndef ML_MPI
#define ML_MPI
#endif
#endif
...
#endif /*ifdef HAVE_CONFIG_H*/

Indeed, adding -DHAVE_CONFIG_H to CFLAGS in src/ksp/pc/impls/ml/makefile fixes
the problem (and the manual include of ml_config.h in ml.c becomes unnecessary).
That is, the patch below makes everything work correctly.

Jed


diff -r 2ae11e456aa7 src/ksp/pc/impls/ml/makefile
--- a/src/ksp/pc/impls/ml/makefile      Fri Mar 21 17:33:24 2008 -0500
+++ b/src/ksp/pc/impls/ml/makefile      Tue Mar 25 08:35:12 2008 +0100
@@ -5,7 +5,7 @@
 
 ALL: lib
 
-CFLAGS   = ${ML_INCLUDE}
+CFLAGS   = ${ML_INCLUDE} -DHAVE_CONFIG_H
 FFLAGS   =
 SOURCEC  = ml.c
 SOURCEF  =
diff -r 2ae11e456aa7 src/ksp/pc/impls/ml/ml.c
--- a/src/ksp/pc/impls/ml/ml.c  Fri Mar 21 17:33:24 2008 -0500
+++ b/src/ksp/pc/impls/ml/ml.c  Tue Mar 25 08:35:12 2008 +0100
@@ -10,7 +10,6 @@
 
 #include <math.h>
 EXTERN_C_BEGIN
-#include "ml_config.h"
 #include "ml_include.h"
 EXTERN_C_END
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20080325/525e21f4/attachment.sig>


More information about the petsc-dev mailing list