ML with OpenMPI

Barry Smith bsmith at mcs.anl.gov
Fri Mar 21 17:14:37 CDT 2008


   Jed,

    You can take a look at config/PETSc/packages/ml.py; essentially we
call their configure with a given set of compilers (and MPI  
information).
So I would say you have to report the bug to those folks; their  
configure
should handle that issue, shouldn't it.


    Barry



On Mar 21, 2008, at 5:09 PM, Jed Brown wrote:

> 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);




More information about the petsc-dev mailing list