ML with OpenMPI

Jed Brown jed at 59A2.org
Fri Mar 21 17:09:39 CDT 2008


The MPI standard does not specify that MPI_Comm = int and in fact
OpenMPI uses a pointer value which lets the compiler do slightly more
type checking.  This type checking recently caused me trouble when
building with-download-ml.

There is a line in ml_comm.h which defines their communicator to be an
int when ML_MPI is not defined.  It was not immediately clear why this
is not defined, but result is that the compiler chokes when building
PETSc.  This patch fixes the problem as long as sizeof(int) =
sizeof(MPI_Comm), but this is *not* the case on x86_64 with OpenMPI.
It's not clear to me how much of this is an upstream issue and how much
is a configuration issue.

Jed


diff -r c074838b79ed src/ksp/pc/impls/ml/ml.c
--- a/src/ksp/pc/impls/ml/ml.c  Thu Mar 20 17:04:05 2008 -0500
+++ b/src/ksp/pc/impls/ml/ml.c  Fri Mar 21 22:50:32 2008 +0100
@@ -815,7 +815,7 @@ PetscErrorCode MatWrapML_SHELL(ML_Operat
   
   MLcomm = mlmat->comm;
   ierr = PetscNew(Mat_MLShell,&shellctx);CHKERRQ(ierr);
-  ierr =
MatCreateShell(MLcomm->USR_comm,m,n,PETSC_DETERMINE,PETSC_DETERMINE,shellctx,newmat);CHKERRQ(ierr);
+  ierr =
MatCreateShell((MPI_Comm)MLcomm->USR_comm,m,n,PETSC_DETERMINE,PETSC_DETERMINE,shellctx,newmat);CHKERRQ(ierr);
   ierr =
   MatShellSetOperation(*newmat,MATOP_MULT,(void(*)(void))MatMult_ML);CHKERRQ(ierr);
   ierr =
   MatShellSetOperation(*newmat,MATOP_MULT_ADD,(void(*)(void))MatMultAdd_ML);CHKERRQ(ierr);
   shellctx->A         = *newmat;
@@ -844,7 +844,7 @@ PetscErrorCode MatWrapML_MPIAIJ(ML_Opera
   n = mlmat->invec_leng;
   if (m != n) SETERRQ2(PETSC_ERR_ARG_OUTOFRANGE,"m %d must equal to n
   %d",m,n);

-  ierr = MatCreate(mlmat->comm->USR_comm,&A);CHKERRQ(ierr);
+  ierr = MatCreate((MPI_Comm)mlmat->comm->USR_comm,&A);CHKERRQ(ierr);
   ierr = MatSetSizes(A,m,n,PETSC_DECIDE,PETSC_DECIDE);CHKERRQ(ierr);
   ierr = MatSetType(A,MATMPIAIJ);CHKERRQ(ierr);
   ierr = PetscMalloc3(m,PetscInt,&nnzA,m,PetscInt,&nnzB,m,PetscInt,&nnz);CHKERRQ(ierr);
-------------- 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/20080321/1dc56156/attachment.sig>


More information about the petsc-dev mailing list