[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ML with OpenMPI




I have pushed this fix to petsc-dev

   Thank you for figuring this out,

   Barry

On Mar 25, 2008, at 2:38 AM, Jed Brown wrote:
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