<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
My name is Marcelo Guterres and I am PhD student in Brazil.<br>
<br>
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".<br>
<br>
My question is about the PETSc following functions:<br>
<br>
<i><font color="#333399"> -> Ierr = MPI_Comm_rank
(MPI_COMM_WORLD, & rank); CHKERRQ (ierr);<br>
-> Ierr = MPI_Comm_size (MPI_COMM_WORLD, & size);
CHKERRQ (ierr);</font></i><br>
<br>
<br>
For example, using only MPI:<br>
<br>
----------------------------------------------------------------------------------------------<br>
<br>
<font color="#ff0000">// Program hello word using MPI<br>
<br>
#include <iostream><br>
using namespace std;<br>
#include <mpi.h><br>
<br>
int main(int argc, char *argv[])<br>
<br>
{<br>
int size, rank;<br>
MPI_Init(&argc, &argv);<br>
MPI_Comm_size(MPI_COMM_WORLD,&size);<br>
MPI_Comm_rank(MPI_COMM_WORLD,&rank);<br>
<br>
cout << "hello. I am process " << rank << "
of " << size << endl;<br>
<br>
if ( rank == 0)<br>
{<br>
cout << "\nFinish !!" << endl;<br>
}<br>
<br>
MPI_Finalize();<br>
}<br>
</font><br>
<br>
<br>
<b>**** running the command has the following output:</b><br>
<br>
[guterres@stratus hello]$ mpirun -np 3 ./hello<br>
<br>
hello. I am process 1 of 3<br>
hello. I am process 0 of 3<br>
<br>
Finish !!<br>
hello. I am process 2 of 3<br>
<br>
<br>
CONCLUSION: int size = 3;<br>
<br>
----------------------------------------------------------------------------------------------<br>
<br>
<br>
using only the PETSC<br>
<br>
----------------------------------------------------------------------------------------------<br>
<br>
<br>
<font color="#ff0000">static char help[] ="\n\n hello word PETSC
!!";<br>
#include <iostream><br>
#include <petscsys.h><br>
using namespace std;<br>
<br>
int main( int argc, char *argv[] )<br>
{<br>
PetscErrorCode ierr;<br>
<br>
PetscMPIInt size, <br>
rank;<br>
<br>
ierr = PetscInitialize(&argc,&argv,(char
*)0,help);CHKERRQ(ierr);<br>
ierr = MPI_Comm_rank(MPI_COMM_WORLD,&rank); CHKERRQ(ierr);<br>
ierr = MPI_Comm_size(MPI_COMM_WORLD,&size); CHKERRQ(ierr);<br>
<br>
cout << "hello. I am process " << rank << "
of " << size << endl;<br>
<br>
if ( rank == 0)<br>
{<br>
cout << "\nfinish !!" << endl;<br>
}<br>
<br>
<br>
ierr = PetscFinalize( ); CHKERRQ(ierr);<br>
return 0;<br>
}</font><br>
<br>
<br>
<b>**** running the command has the following output:</b><br>
<br>
<br>
[guterres@stratus hello_petsc]$ mpirun -np 3 ./hello<br>
<br>
hello. I am process 0 of 1<br>
finish !!<br>
<br>
hello. I am process 0 of 1<br>
finish !!<br>
<br>
hello. I am process 0 of 1<br>
finish !!<br>
<br>
<br>
----------------------------------------------------------------------------------------------<br>
<br>
<br>
<font color="#993399"><b>MY QUESTION IS:</b></font><br>
<br>
<br>
THE OUTPUT OF THE PROGRAM WITH PETSC CORRECT???<br>
<br>
the variable value PetscMPIInt size = np ??<br>
<br>
The correct output should not be:<br>
<br>
<br>
<font color="#ff0000">[guterres@stratus hello_petsc]$ mpirun -np 3
./hello<br>
<br>
hello. I am process 0 of 3<br>
<br>
hello. I am process 1 of 3<br>
<br>
hello. I am process 2 of 3<br>
<br>
finish !!</font><br>
<br>
CONCLUSION: PetscMPIInt size = 3 ??<br>
<br>
<br>
Thank you for your attention and excuse my writing in English.<br>
<br>
<br>
Marcelo Guterres
</body>
</html>