2004-01-25 04:51:49 +03:00
|
|
|
/*
|
|
|
|
* $HEADERS$
|
|
|
|
*/
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2004-01-25 04:51:49 +03:00
|
|
|
#include <stdio.h>
|
2004-06-16 06:21:00 +04:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2004-01-25 04:51:49 +03:00
|
|
|
|
|
|
|
#include "mpi.h"
|
2004-03-17 21:45:16 +03:00
|
|
|
#include "mpi/c/bindings.h"
|
2004-06-16 06:21:00 +04:00
|
|
|
#include "runtime/runtime.h"
|
|
|
|
#include "communicator/communicator.h"
|
2004-01-25 04:51:49 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
|
2004-01-25 04:51:49 +03:00
|
|
|
#pragma weak MPI_Get_processor_name = PMPI_Get_processor_name
|
|
|
|
#endif
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#if OMPI_PROFILING_DEFINES
|
2004-04-20 22:50:43 +04:00
|
|
|
#include "mpi/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2004-06-16 06:21:00 +04:00
|
|
|
int MPI_Get_processor_name(char *name, int *resultlen)
|
|
|
|
{
|
|
|
|
char tmp[MPI_MAX_PROCESSOR_NAME];
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if ( MPI_PARAM_CHECK) {
|
|
|
|
if ( ompi_mpi_finalized )
|
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_INTERN,
|
|
|
|
"MPI_Get_processor_name");
|
|
|
|
if ( NULL == name )
|
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
|
|
|
"MPI_Get_processor_name");
|
|
|
|
if ( NULL == resultlen )
|
|
|
|
return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_ARG,
|
|
|
|
"MPI_Get_processor_name");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A simple implementation of this function using gethostname*/
|
|
|
|
gethostname (tmp, MPI_MAX_PROCESSOR_NAME);
|
|
|
|
len = strlen (tmp);
|
|
|
|
strncpy ( name, tmp, len);
|
|
|
|
|
|
|
|
if ( MPI_MAX_PROCESSOR_NAME > len ) {
|
|
|
|
*resultlen = len;
|
|
|
|
name[len] = '\0';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*resultlen = MPI_MAX_PROCESSOR_NAME-1;
|
|
|
|
name[MPI_MAX_PROCESSOR_NAME-1] = '\0';
|
|
|
|
}
|
|
|
|
|
2004-01-25 04:51:49 +03:00
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|