#include
<stdio.h>
#include
"localmpi.h"
#include
"extern.h"
int
child_proc()
{
char
processor_name[MPI_MAX_PROCESSOR_NAME];
int
name_length;
char
message[MAX_MSG_LEN + 1];
int
destination;
int
tag = 0;
mpi_err = MPI_Get_processor_name ( processor_name, &name_length );
if
( mpi_err != MPI_SUCCESS )
{
handle_err ( "child_proc" );
fprintf ( stderr, "Error in getting name of processor\n" );
return
( 1 );
}
sprintf ( message, "Greetings from process # %d running on %s", my_rank, processor_name );
destination = MASTER_RANK;
mpi_err = MPI_Send ( message, strlen ( message ) + 1, MPI_CHAR, destination, tag, MPI_COMM_WORLD );
if
( mpi_err != MPI_SUCCESS )
{
handle_err ( "child_proc" );
return
( 1 );
}
return
( 0 );
}