[petsc-users] question of a Brazilian student about the use of "PETSC" in a cluster
Barry Smith
bsmith at mcs.anl.gov
Thu Dec 13 07:23:59 CST 2012
> Marcelo,
There is something wrong with the PETSc install. Are you absolutely sure that PETSc was ./configure with the same MPI as as the mpirun that you use to launch the program?
You can send configure.log to petsc-maint at mcs.anl.gov if you cannot figure it out on your own.
Barry
On Dec 13, 2012, at 4:55 AM, Marcelo Guterres <m.guterres at gmail.com> wrote:
> Hello,
>
> My name is Marcelo Guterres and I am PhD student in Brazil.
>
> I use the PETSC in a cluster with 11 computers, each with 8 processors "Xeon 2.8GHz", "16GB RAM" and "4 HD SAS" from "146GB".
>
> My question is about the PETSc following functions:
>
> -> Ierr = MPI_Comm_rank (MPI_COMM_WORLD, & rank); CHKERRQ (ierr);
> -> Ierr = MPI_Comm_size (MPI_COMM_WORLD, & size); CHKERRQ (ierr);
>
>
> For example, using only MPI:
>
> ----------------------------------------------------------------------------------------------
>
> // Program hello word using MPI
>
> #include <iostream>
> using namespace std;
> #include <mpi.h>
>
> int main(int argc, char *argv[])
>
> {
> int size, rank;
> MPI_Init(&argc, &argv);
> MPI_Comm_size(MPI_COMM_WORLD,&size);
> MPI_Comm_rank(MPI_COMM_WORLD,&rank);
>
> cout << "hello. I am process " << rank << " of " << size << endl;
>
> if ( rank == 0)
> {
> cout << "\nFinish !!" << endl;
> }
>
> MPI_Finalize();
> }
>
>
>
> **** running the command has the following output:
>
> [guterres at stratus hello]$ mpirun -np 3 ./hello
>
> hello. I am process 1 of 3
> hello. I am process 0 of 3
>
> Finish !!
> hello. I am process 2 of 3
>
>
> CONCLUSION: int size = 3;
>
> ----------------------------------------------------------------------------------------------
>
>
> using only the PETSC
>
> ----------------------------------------------------------------------------------------------
>
>
> static char help[] ="\n\n hello word PETSC !!";
> #include <iostream>
> #include <petscsys.h>
> using namespace std;
>
> int main( int argc, char *argv[] )
> {
> PetscErrorCode ierr;
>
> PetscMPIInt size,
> rank;
>
> ierr = PetscInitialize(&argc,&argv,(char *)0,help);CHKERRQ(ierr);
> ierr = MPI_Comm_rank(MPI_COMM_WORLD,&rank); CHKERRQ(ierr);
> ierr = MPI_Comm_size(MPI_COMM_WORLD,&size); CHKERRQ(ierr);
>
> cout << "hello. I am process " << rank << " of " << size << endl;
>
> if ( rank == 0)
> {
> cout << "\nfinish !!" << endl;
> }
>
>
> ierr = PetscFinalize( ); CHKERRQ(ierr);
> return 0;
> }
>
>
> **** running the command has the following output:
>
>
> [guterres at stratus hello_petsc]$ mpirun -np 3 ./hello
>
> hello. I am process 0 of 1
> finish !!
>
> hello. I am process 0 of 1
> finish !!
>
> hello. I am process 0 of 1
> finish !!
>
>
> ----------------------------------------------------------------------------------------------
>
>
> MY QUESTION IS:
>
>
> THE OUTPUT OF THE PROGRAM WITH PETSC CORRECT???
>
> the variable value PetscMPIInt size = np ??
>
> The correct output should not be:
>
>
> [guterres at stratus hello_petsc]$ mpirun -np 3 ./hello
>
> hello. I am process 0 of 3
>
> hello. I am process 1 of 3
>
> hello. I am process 2 of 3
>
> finish !!
>
> CONCLUSION: PetscMPIInt size = 3 ??
>
>
> Thank you for your attention and excuse my writing in English.
>
>
> Marcelo Guterres
More information about the petsc-users
mailing list