ML with OpenMPI

2008-03-21 Thread Barry Smith

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




configuring with --prefix

2008-03-21 Thread Lisandro Dalcin
I got this error at configuration time:

You do not have write access to create install directory given with
--prefix=/usr/local/petsc/dev/linux-gnu perhaps use --with-sudo=sudo
also

Then I've added, the sudo stuff and worked. However, after the
configuation, the dir was not created. So the question is: in which
scenario PETSc does need access to the install dir at configuration
time?


-- 
Lisandro Dalc?n
---
Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC)
Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC)
Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET)
PTLC - G?emes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594




ML with OpenMPI

2008-03-21 Thread Lisandro Dalcin
Mmm... I believe this is a configuration issue... if ML_MPI were
defined, then ML_USR_COMM should be MPI_Comm. But the problem is
perhaps on the ML side, not the PETSc side.

ml_common.h #define ML_MPI if macro HAVE_MPI is defined. In turn
HAVE_MPI is at ml_config.h, and that file is surelly generated by ML
configure script. For some reason ML's configure failed to found MPI
with the command line stuff PETSc pass to it.  Look at the
'config.log' file inside the ml-5.0 dir to find what happened.



On 3/21/08, Jed Brown jed at 59a2.org 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);




-- 
Lisandro Dalc?n
---
Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC)
Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC)
Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET)
PTLC - G?emes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594




configuring with --prefix

2008-03-21 Thread Barry Smith

On Mar 21, 2008, at 5:32 PM, Matthew Knepley wrote:

 On Fri, Mar 21, 2008 at 4:53 PM, Lisandro Dalcin dalcinl at gmail.com  
 wrote:
 I got this error at configuration time:

 You do not have write access to create install directory given with
 --prefix=/usr/local/petsc/dev/linux-gnu perhaps use --with-sudo=sudo
 also

 Then I've added, the sudo stuff and worked. However, after the
 configuation, the dir was not created. So the question is: in which
 scenario PETSc does need access to the install dir at configuration
 time?

 PETSc does not NEED access until install time, however it is  
 checking because
 people often screw this up.

Also the eventual plan is that each external package will get  
installed directly
to the prefix location (instead of being installed first in the petsc  
location and
then copied over to the prefix location).

This is a little funky to think config/configure.py is doing an  
install; but it
is doing the install of the external packages you requested.

Barry



  Matt

 --
 Lisandro Dalc?n
 ---
 Centro Internacional de M?todos Computacionales en Ingenier?a (CIMEC)
 Instituto de Desarrollo Tecnol?gico para la Industria Qu?mica (INTEC)
 Consejo Nacional de Investigaciones Cient?ficas y T?cnicas (CONICET)
 PTLC - G?emes 3450, (3000) Santa Fe, Argentina
 Tel/Fax: +54-(0)342-451.1594





 -- 
 What most experimenters take for granted before they begin their
 experiments is infinitely more interesting than any results to which
 their experiments lead.
 -- Norbert Wiener