Blame src/mpi/misc/getpname.c

Packit Service c5cf8c
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
Packit Service c5cf8c
/*
Packit Service c5cf8c
 *  (C) 2001 by Argonne National Laboratory.
Packit Service c5cf8c
 *      See COPYRIGHT in top-level directory.
Packit Service c5cf8c
 */
Packit Service c5cf8c
Packit Service c5cf8c
#include "mpiimpl.h"
Packit Service c5cf8c
Packit Service c5cf8c
/* -- Begin Profiling Symbol Block for routine MPI_Get_processor_name */
Packit Service c5cf8c
#if defined(HAVE_PRAGMA_WEAK)
Packit Service c5cf8c
#pragma weak MPI_Get_processor_name = PMPI_Get_processor_name
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
Packit Service c5cf8c
#pragma _HP_SECONDARY_DEF PMPI_Get_processor_name  MPI_Get_processor_name
Packit Service c5cf8c
#elif defined(HAVE_PRAGMA_CRI_DUP)
Packit Service c5cf8c
#pragma _CRI duplicate MPI_Get_processor_name as PMPI_Get_processor_name
Packit Service c5cf8c
#elif defined(HAVE_WEAK_ATTRIBUTE)
Packit Service c5cf8c
int MPI_Get_processor_name(char *name, int *resultlen)
Packit Service c5cf8c
    __attribute__ ((weak, alias("PMPI_Get_processor_name")));
Packit Service c5cf8c
#endif
Packit Service c5cf8c
/* -- End Profiling Symbol Block */
Packit Service c5cf8c
Packit Service c5cf8c
/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
Packit Service c5cf8c
   the MPI routines.  You can use USE_WEAK_SYMBOLS to see if MPICH is
Packit Service c5cf8c
   using weak symbols to implement the MPI routines. */
Packit Service c5cf8c
#ifndef MPICH_MPI_FROM_PMPI
Packit Service c5cf8c
#undef MPI_Get_processor_name
Packit Service c5cf8c
#define MPI_Get_processor_name PMPI_Get_processor_name
Packit Service c5cf8c
Packit Service c5cf8c
/* Any internal routines can go here.  Make them static if possible.  If they
Packit Service c5cf8c
   are used by both the MPI and PMPI versions, use PMPI_LOCAL instead of
Packit Service c5cf8c
   static; this macro expands into "static" if weak symbols are supported and
Packit Service c5cf8c
   into nothing otherwise. */
Packit Service c5cf8c
#endif
Packit Service c5cf8c
Packit Service c5cf8c
#undef FUNCNAME
Packit Service c5cf8c
#define FUNCNAME MPI_Get_processor_name
Packit Service c5cf8c
#undef FCNAME
Packit Service c5cf8c
#define FCNAME MPL_QUOTE(FUNCNAME)
Packit Service c5cf8c
/*@
Packit Service c5cf8c
  MPI_Get_processor_name - Gets the name of the processor
Packit Service c5cf8c
Packit Service c5cf8c
Output Parameters:
Packit Service c5cf8c
+ name - A unique specifier for the actual (as opposed to virtual) node. This
Packit Service c5cf8c
  must be an array of size at least 'MPI_MAX_PROCESSOR_NAME'.
Packit Service c5cf8c
- resultlen - Length (in characters) of the name
Packit Service c5cf8c
Packit Service c5cf8c
  Notes:
Packit Service c5cf8c
  The name returned should identify a particular piece of hardware;
Packit Service c5cf8c
  the exact format is implementation defined.  This name may or may not
Packit Service c5cf8c
  be the same as might be returned by 'gethostname', 'uname', or 'sysinfo'.
Packit Service c5cf8c
Packit Service c5cf8c
.N ThreadSafe
Packit Service c5cf8c
Packit Service c5cf8c
.N Fortran
Packit Service c5cf8c
Packit Service c5cf8c
 In Fortran, the character argument should be declared as a character string
Packit Service c5cf8c
 of 'MPI_MAX_PROCESSOR_NAME' rather than an array of dimension
Packit Service c5cf8c
 'MPI_MAX_PROCESSOR_NAME'.  That is,
Packit Service c5cf8c
.vb
Packit Service c5cf8c
   character*(MPI_MAX_PROCESSOR_NAME) name
Packit Service c5cf8c
.ve
Packit Service c5cf8c
 rather than
Packit Service c5cf8c
.vb
Packit Service c5cf8c
   character name(MPI_MAX_PROCESSOR_NAME)
Packit Service c5cf8c
.ve
Packit Service c5cf8c
 The two
Packit Service c5cf8c
Packit Service c5cf8c
.N FortranString
Packit Service c5cf8c
Packit Service c5cf8c
.N Errors
Packit Service c5cf8c
.N MPI_SUCCESS
Packit Service c5cf8c
@*/
Packit Service c5cf8c
int MPI_Get_processor_name(char *name, int *resultlen)
Packit Service c5cf8c
{
Packit Service c5cf8c
    int mpi_errno = MPI_SUCCESS;
Packit Service c5cf8c
    MPIR_FUNC_TERSE_STATE_DECL(MPID_STATE_MPI_GET_PROCESSOR_NAME);
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_ERRTEST_INITIALIZED_ORDIE();
Packit Service c5cf8c
Packit Service c5cf8c
    MPIR_FUNC_TERSE_ENTER(MPID_STATE_MPI_GET_PROCESSOR_NAME);
Packit Service c5cf8c
Packit Service c5cf8c
    /* Validate parameters and objects (post conversion) */
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
    {
Packit Service c5cf8c
        MPID_BEGIN_ERROR_CHECKS;
Packit Service c5cf8c
        {
Packit Service c5cf8c
            MPIR_ERRTEST_ARGNULL(name, "name", mpi_errno);
Packit Service c5cf8c
            MPIR_ERRTEST_ARGNULL(resultlen, "resultlen", mpi_errno);
Packit Service c5cf8c
        }
Packit Service c5cf8c
        MPID_END_ERROR_CHECKS;
Packit Service c5cf8c
    }
Packit Service c5cf8c
#endif /* HAVE_ERROR_CHECKING */
Packit Service c5cf8c
Packit Service c5cf8c
    /* ... body of routine ...  */
Packit Service c5cf8c
Packit Service c5cf8c
    mpi_errno = MPID_Get_processor_name(name, MPI_MAX_PROCESSOR_NAME, resultlen);
Packit Service c5cf8c
Packit Service c5cf8c
    /* ... end of body of routine ... */
Packit Service c5cf8c
Packit Service c5cf8c
    if (mpi_errno != MPI_SUCCESS)
Packit Service c5cf8c
        goto fn_fail;
Packit Service c5cf8c
Packit Service c5cf8c
  fn_exit:
Packit Service c5cf8c
    MPIR_FUNC_TERSE_EXIT(MPID_STATE_MPI_GET_PROCESSOR_NAME);
Packit Service c5cf8c
    return mpi_errno;
Packit Service c5cf8c
Packit Service c5cf8c
  fn_fail:
Packit Service c5cf8c
    /* --BEGIN ERROR HANDLING-- */
Packit Service c5cf8c
#ifdef HAVE_ERROR_CHECKING
Packit Service c5cf8c
    {
Packit Service c5cf8c
        mpi_errno =
Packit Service c5cf8c
            MPIR_Err_create_code(mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER,
Packit Service c5cf8c
                                 "**mpi_get_processor_name", "**mpi_get_processor_name %p %p", name,
Packit Service c5cf8c
                                 resultlen);
Packit Service c5cf8c
    }
Packit Service c5cf8c
#endif
Packit Service c5cf8c
    mpi_errno = MPIR_Err_return_comm(NULL, FCNAME, mpi_errno);
Packit Service c5cf8c
    goto fn_exit;
Packit Service c5cf8c
    /* --END ERROR HANDLING-- */
Packit Service c5cf8c
}