⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 address.c

📁 mpi并行计算的c++代码 可用vc或gcc编译通过 可以用来搭建并行计算试验环境
💻 C
字号:
/* -*- Mode: C; c-basic-offset:4 ; -*- *//* * *  (C) 2001 by Argonne National Laboratory. *      See COPYRIGHT in top-level directory. */#include "mpiimpl.h"/* -- Begin Profiling Symbol Block for routine MPI_Address */#if defined(HAVE_PRAGMA_WEAK)#pragma weak MPI_Address = PMPI_Address#elif defined(HAVE_PRAGMA_HP_SEC_DEF)#pragma _HP_SECONDARY_DEF PMPI_Address  MPI_Address#elif defined(HAVE_PRAGMA_CRI_DUP)#pragma _CRI duplicate MPI_Address as PMPI_Address#endif/* -- End Profiling Symbol Block *//* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build   the MPI routines */#ifndef MPICH_MPI_FROM_PMPI#define MPI_Address PMPI_Address#endif#undef FUNCNAME#define FUNCNAME MPI_Address/*@    MPI_Address - Gets the address of a location in memory  Input Parameter:. location - location in caller memory (choice) Output Parameter:. address - address of location (integer)     Note:    This routine is provided for both the Fortran and C programmers.    On many systems, the address returned by this routine will be the same    as produced by the C '&' operator, but this is not required in C and    may not be true of systems with word- rather than byte-oriented     instructions or systems with segmented address spaces.  .N SignalSafe .N DeprecatedThe replacement for this routine is 'MPI_Get_address'..N Fortran.N Errors.N MPI_SUCCESS.N MPI_ERR_OTHER@*/int MPI_Address( void *location, MPI_Aint *address ){    static const char FCNAME[] = "MPI_Address";    int mpi_errno = MPI_SUCCESS;    MPID_MPI_STATE_DECL(MPID_STATE_MPI_ADDRESS);    MPIR_ERRTEST_INITIALIZED_ORDIE();        MPID_CS_ENTER();    MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ADDRESS);        /* Validate parameters and objects (post conversion) */#   ifdef HAVE_ERROR_CHECKING    {        MPID_BEGIN_ERROR_CHECKS;        {	    MPIR_ERRTEST_ARGNULL(address,"address",mpi_errno);            if (mpi_errno) goto fn_fail;        }        MPID_END_ERROR_CHECKS;    }#   endif /* HAVE_ERROR_CHECKING */    /* ... body of routine ...  */        /* SX_4 needs to set CHAR_PTR_IS_ADDRESS        The reason is that it computes the different in two pointers in       an "int", and addresses typically have the high (bit 31) bit set;       thus the difference, when cast as MPI_Aint (long), is sign-extended,        making the absolute address negative.  Without a copy of the C        standard, I can't tell if this is a compiler bug or a language bug.    */#ifdef CHAR_PTR_IS_ADDRESS    *address = (MPI_Aint) ((char *)location);#else    /* Note that this is the "portable" way to generate an address.       The difference of two pointers is the number of elements       between them, so this gives the number of chars between location       and ptr.  As long as sizeof(char) represents one byte,        of bytes from 0 to location */    *address = (MPI_Aint) ((char *)location - (char *)MPI_BOTTOM);#endif    /* The same code is used in MPI_Get_address */        /* ... end of body of routine ... */  fn_exit:    MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ADDRESS);    MPID_CS_EXIT();    return mpi_errno;  fn_fail:    /* --BEGIN ERROR HANDLING-- */#   ifdef HAVE_ERROR_CHECKING    {	mpi_errno = MPIR_Err_create_code(	    mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, MPI_ERR_OTHER, "**mpi_address",	    "**mpi_address %p %p", location, address);    }#   endif    mpi_errno = MPIR_Err_return_comm( 0, FCNAME, mpi_errno );    goto fn_exit;    /* --END ERROR HANDLING-- */}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -