ompi_dll.c

来自「MPI stands for the Message Passing Inter」· C语言 代码 · 共 1,498 行 · 第 1/5 页

C
1,498
字号
/* -*- Mode: C; c-basic-offset:4 ; -*- *//********************************************************************** * Copyright (C) 2000-2004 by Etnus, LLC. * Copyright (C) 1999 by Etnus, Inc. * Copyright (C) 1997-1998 Dolphin Interconnect Solutions Inc. * * Permission is hereby granted to use, reproduce, prepare derivative * works, and to redistribute to others. * *				  DISCLAIMER * * Neither Dolphin Interconnect Solutions, Etnus LLC, nor any of their * employees, makes any warranty express or implied, or assumes any * legal liability or responsibility for the accuracy, completeness, * or usefulness of any information, apparatus, product, or process * disclosed, or represents that its use would not infringe privately * owned rights. * * This code was written by * James Cownie: Dolphin Interconnect Solutions. <jcownie@dolphinics.com> *               Etnus LLC <jcownie@etnus.com> **********************************************************************//* Update log * * Jul 12 2001 FNW: Add a meaningful ID to the communicator name, and switch *                  to using the recv_context as the unique_id field. * Mar  6 2001 JHC: Add mqs_get_comm_group to allow a debugger to acquire *                  processes less eagerly. * Dec 13 2000 JHC: totalview/2514: Modify image_has_queues to return *                  a silent FALSE if none of the expected data is *                  present. This way you won't get complaints when *                  you try this on non MPICH processes. * Sep  8 2000 JVD: #include <string.h> to silence Linux Alpha compiler warnings. * Mar 21 2000 JHC: Add the new entrypoint mqs_dll_taddr_width * Nov 26 1998 JHC: Fix the problem that we weren't handling *                  MPIR_Ignore_queues properly. * Oct 22 1998 JHC: Fix a zero allocation problem * Aug 19 1998 JHC: Fix some problems in our use of target_to_host on *                  big endian machines. * May 28 1998 JHC: Use the extra information we can return to say *                  explicitly that sends are only showing non-blocking ops * May 19 1998 JHC: Changed the names of the structs and added casts *                  where needed to reflect the change to the way we handle *                  type safety across the interface. * Oct 27 1997 JHC: Created by exploding db_message_state_mpich.cxx *//** * Right now there is no MPI2 support */#define FOR_MPI2  0/*    The following was added by William Gropp to improve the portability    to systems with non-ANSI C compilers  */#include "ompi_config.h"#ifdef HAVE_NO_C_CONST#define const#endif#if defined(HAVE_STRING_H)#include <string.h>#endif  /* defined(HAVE_STRING_H) */#if defined(HAVE_STDLIB_H)#include <stdlib.h>#endif  /* defined(HAVE_STDLIB_H) */#include "ompi/mca/pml/base/pml_base_request.h"#include "mpi_interface.h"#include "ompi_dll_defs.h"/*    End of inclusion *//* Essential macros for C */#ifndef NULL#define NULL ((void *)0)#endif#ifndef TRUE#define TRUE (0==0)#endif#ifndef FALSE#define FALSE (0==1)#endif#ifdef OLD_STYLE_CPP_CONCAT#define concat(a,b) a/**/b#define stringize(a) "a"#else#define concat(a,b) a##b#define stringize(a) #a#endif#define OPAL_ALIGN(x,a,t) (((x)+((t)(a)-1)) & ~(((t)(a)-1)))/** * The internal debugging interface. */#define VERBOSE_GENERAL  0x00000001#define VERBOSE_GROUP    0x00000002#define VERBOSE_COMM     0x00000004#define VERBOSE_LISTS    0x00000008#define VERBOSE_REQ      0x00000010#define VERBOSE_REQ_DUMP 0x00000020#define VERBOSE 0x00000000#if VERBOSE#define DEBUG(LEVEL, WHAT) if(LEVEL & VERBOSE) { printf WHAT; }#else#define DEBUG(LEVEL,WHAT)#endif  /* VERBOSE *//**********************************************************************//* Set up the basic callbacks into the debugger, also work out  * one crucial piece of info about the machine we're running on. */static const mqs_basic_callbacks *mqs_basic_entrypoints;static int host_is_big_endian;/* Temporary workaround for making Totalview to load these symbols in the library * when this is compiled with the Sun Studio C compiler */#if defined(__SUNPRO_C)bool opal_uses_threads;bool opal_mutex_check_locks;volatile int32_t opal_progress_thread_count;int opal_progress_spin_count;#endifvoid mqs_setup_basic_callbacks (const mqs_basic_callbacks * cb){  int t = 1;  host_is_big_endian    = (*(char *)&t) != 1;  mqs_basic_entrypoints = cb;} /* mqs_setup_callbacks *//**********************************************************************//* Macros to make it transparent that we're calling the TV functions * through function pointers. */#define mqs_malloc           (mqs_basic_entrypoints->mqs_malloc_fp)#define mqs_free             (mqs_basic_entrypoints->mqs_free_fp)#define mqs_prints           (mqs_basic_entrypoints->mqs_dprints_fp)#define mqs_put_image_info   (mqs_basic_entrypoints->mqs_put_image_info_fp)#define mqs_get_image_info   (mqs_basic_entrypoints->mqs_get_image_info_fp)#define mqs_put_process_info (mqs_basic_entrypoints->mqs_put_process_info_fp)#define mqs_get_process_info (mqs_basic_entrypoints->mqs_get_process_info_fp)/* These macros *RELY* on the function already having set up the conventional * local variables i_info or p_info. */#define mqs_find_type        (i_info->image_callbacks->mqs_find_type_fp)#define mqs_field_offset     (i_info->image_callbacks->mqs_field_offset_fp)#define mqs_sizeof           (i_info->image_callbacks->mqs_sizeof_fp)#define mqs_get_type_sizes   (i_info->image_callbacks->mqs_get_type_sizes_fp)#define mqs_find_function    (i_info->image_callbacks->mqs_find_function_fp)#define mqs_find_symbol      (i_info->image_callbacks->mqs_find_symbol_fp)#define mqs_get_image        (p_info->process_callbacks->mqs_get_image_fp)#define mqs_get_global_rank  (p_info->process_callbacks->mqs_get_global_rank_fp)#define mqs_fetch_data       (p_info->process_callbacks->mqs_fetch_data_fp)#define mqs_target_to_host   (p_info->process_callbacks->mqs_target_to_host_fp)/**********************************************************************//* Version handling functions. * This one should never be changed. */int mqs_version_compatibility (void){    return MQS_INTERFACE_COMPATIBILITY;} /* mqs_version_compatibility *//* This one can say what you like */char *mqs_version_string (void){    return "Open MPI message queue support for parallel"           " debuggers compiled on " __DATE__;} /* mqs_version_string *//* So the debugger can tell what interface width the library was compiled with */int mqs_dll_taddr_width (void){    return sizeof (mqs_taddr_t);} /* mqs_dll_taddr_width *//**********************************************************************//* Additional error codes and error string conversion. */enum {    err_silent_failure  = mqs_first_user_code,    err_no_current_communicator,    err_bad_request,    err_no_store,    err_failed_qhdr,    err_unexpected,    err_posted,    err_failed_queue,    err_first,    err_context_id,    err_tag,    err_tagmask,    err_lsrc,    err_srcmask,    err_next,    err_ptr,    err_missing_type,    err_missing_symbol,    err_db_shandle,    err_db_comm,    err_db_target,    err_db_tag,    err_db_data,    err_db_byte_length,    err_db_next,    err_failed_rhandle,    err_is_complete,    err_buf,    err_len,    err_s,    err_failed_status,    err_count,    err_MPI_SOURCE,    err_MPI_TAG,    err_failed_commlist,    err_sequence_number,    err_comm_first,    err_failed_communicator,    err_lrank_to_grank,    err_send_context,    err_recv_context,    err_comm_next,    err_comm_name,    err_all_communicators,    err_mpid_sends,    err_mpid_recvs,    err_group_corrupt};/*********************************************************************** * Functions to access the image memory. They are specialized based    * * on the type we want to access and the debugged process architecture * ***********************************************************************/static mqs_taddr_t fetch_pointer (mqs_process * proc, mqs_taddr_t addr, mpi_process_info *p_info){    int isize = p_info->sizes.pointer_size;    char buffer[8];                  /* ASSUME the type fits in 8 bytes */    mqs_taddr_t res = 0;    if (mqs_ok == mqs_fetch_data (proc, addr, isize, buffer))        mqs_target_to_host (proc, buffer,                             ((char *)&res) + (host_is_big_endian ? sizeof(mqs_taddr_t)-isize : 0),                             isize);    return res;} /* fetch_pointer *//***********************************************************************/static mqs_tword_t fetch_int (mqs_process * proc, mqs_taddr_t addr, mpi_process_info *p_info){    int isize = p_info->sizes.int_size;    char buffer[8];                  /* ASSUME the type fits in 8 bytes */    mqs_tword_t res = 0;    if (mqs_ok == mqs_fetch_data (proc, addr, isize, buffer)) {        mqs_target_to_host (proc, buffer,                             ((char *)&res) + (host_is_big_endian ? sizeof(mqs_tword_t)-isize : 0),                             isize);    }    return res;} /* fetch_int *//***********************************************************************/static mqs_tword_t fetch_bool(mqs_process * proc, mqs_taddr_t addr, mpi_process_info *p_info){    int isize = p_info->sizes.bool_size;    mqs_tword_t res = 0;    mqs_fetch_data (proc, addr, isize, &res);    return (0 == res ? 0 : 1);} /* fetch_bool *//***********************************************************************/static mqs_taddr_t fetch_size_t(mqs_process * proc, mqs_taddr_t addr, mpi_process_info *p_info){    int isize = p_info->sizes.size_t_size;

⌨️ 快捷键说明

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