root/ompi/debuggers/ompi_mpihandles_dll.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. alloc_map
  2. fill_map
  3. fill_attributes
  4. mpidbg_init_once
  5. mpidbg_interface_version_compatibility
  6. mpidbg_version_string
  7. mpidbg_dll_taddr_width
  8. mpidbg_init_per_image
  9. mpidbg_finalize_per_image
  10. mpidbg_init_per_process
  11. mpidbg_finalize_per_process
  12. mpidbg_comm_query
  13. mpidbg_comm_f2c
  14. mpidbg_comm_cxx2c
  15. mpidbg_errhandler_query
  16. mpidbg_errhandler_f2c
  17. mpidbg_errhandler_cxx2c
  18. mpidbg_request_query
  19. mpidbg_request_f2c
  20. mpidbg_request_cxx2c
  21. mpidbg_status_query
  22. mpidbg_status_f2c
  23. mpidbg_status_cxx2c

   1 /*
   2  * Copyright (c) 2007-2008 Cisco Systems, Inc.  All rights reserved.
   3  * Copyright (c) 2004-2013 The University of Tennessee and The University
   4  *                         of Tennessee Research Foundation.  All rights
   5  *                         reserved.
   6  * Copyright (c) 2008      Sun Microsystems, Inc.  All rights reserved.
   7  * Copyright (c) 2012-2013 Inria.  All rights reserved.
   8  * Copyright (c) 2016      Research Organization for Information Science
   9  *                         and Technology (RIST). All rights reserved.
  10  * Copyright (c) 2017 IBM Corp.  All rights reserved.
  11  * $COPYRIGHT$
  12  *
  13  * Additional copyrights may follow
  14  *
  15  * $HEADER$
  16  */
  17 
  18 /**********************************************************************
  19  * Copyright (C) 2000-2004 by Etnus, LLC.
  20  * Copyright (C) 1999 by Etnus, Inc.
  21  * Copyright (C) 1997-1998 Dolphin Interconnect Solutions Inc.
  22  *
  23  * Permission is hereby granted to use, reproduce, prepare derivative
  24  * works, and to redistribute to others.
  25  *
  26  *                                DISCLAIMER
  27  *
  28  * Neither Dolphin Interconnect Solutions, Etnus LLC, nor any of their
  29  * employees, makes any warranty express or implied, or assumes any
  30  * legal liability or responsibility for the accuracy, completeness,
  31  * or usefulness of any information, apparatus, product, or process
  32  * disclosed, or represents that its use would not infringe privately
  33  * owned rights.
  34  *
  35  * This code was written by
  36  * James Cownie: Dolphin Interconnect Solutions. <jcownie@dolphinics.com>
  37  *               Etnus LLC <jcownie@etnus.com>
  38  **********************************************************************/
  39 
  40 #include "ompi_config.h"
  41 
  42 #include <string.h>
  43 #include <stdlib.h>
  44 
  45 #include "ompi/mca/pml/base/pml_base_request.h"
  46 #include "mpihandles_interface.h"
  47 #include "ompi_mpihandles_dll_defs.h"
  48 #include "ompi/communicator/communicator.h"
  49 
  50 
  51 #define OPAL_ALIGN(x,a,t) (((x)+((t)(a)-1)) & ~(((t)(a)-1)))
  52 
  53 /* Globals that the debugger expects to find in the DLL */
  54 #if defined(WORDS_BIGENDIAN)
  55 char mpidbg_dll_is_big_endian = 1;
  56 #else
  57 char mpidbg_dll_is_big_endian = 0;
  58 #endif
  59 char mpidbg_dll_bitness = (char) (sizeof(void*) * 8);
  60 enum mpidbg_comm_capabilities_t mpidbg_comm_capabilities = 0;
  61 struct mpidbg_name_map_t *mpidbg_comm_name_map = NULL;
  62 enum mpidbg_errhandler_capabilities_t mpidbg_errhandler_capabilities = 0;
  63 struct mpidbg_name_map_t *mpidbg_errhandler_name_map = NULL;
  64 enum mpidbg_request_capabilities_t mpidbg_request_capabilities = 0;
  65 struct mpidbg_name_map_t *mpidbg_request_name_map = NULL;
  66 enum mpidbg_status_capabilities_t mpidbg_status_capabilities = 0;
  67 struct mpidbg_name_map_t *mpidbg_status_name_map = NULL;
  68 
  69 #if defined(__SUNPRO_C)
  70 /*
  71  * These symbols are defined here because of the different way compilers
  72  * may handle extern definitions. The particular case that is causing
  73  * problems is when there is an extern variable that is accessed in a
  74  * static inline function. For example, here is the code we often see in
  75  * a header file.
  76  *
  77  * extern int request_complete;
  78  * static inline check_request(void) {
  79  *    request_complete = 1;
  80  * }
  81  *
  82  * If this code exists in a header file and gets included in a source
  83  * file, then some compilers expect to have request_complete defined
  84  * somewhere even if request_complete is never referenced and
  85  * check_request is never called. Other compilers do not need them defined
  86  * if they are never referenced in the source file. Therefore, to handle
  87  * cases like the above with compilers that require the symbol (like
  88  * Sun Studio) we add in these definitions here.
  89  */
  90 opal_mutex_t opal_event_lock;
  91 int opal_progress_spin_count;
  92 bool opal_mutex_check_locks;
  93 bool opal_uses_threads;
  94 #endif /* defined(__SUNPRO_C) */
  95 
  96 /*---------------------------------------------------------------------*/
  97 
  98 /* Small helper function: allocate a map of a given length */
  99 static struct mpidbg_name_map_t *alloc_map(mqs_image *image, int len)
 100 {
 101     mpi_image_info *i_info = (mpi_image_info *) mqs_get_image_info(image);
 102     struct mpidbg_name_map_t *m = NULL;
 103 
 104     if (NULL != i_info) {
 105         m = mqs_malloc(len * sizeof(struct mpidbg_name_map_t));
 106     }
 107 
 108     return m;
 109 }
 110 
 111 /* Small helper function: look up a symbol, and if we find it, put it
 112    in a map entry */
 113 static void fill_map(mqs_image *image,
 114                      char *public_name, char *private_name,
 115                      struct mpidbg_name_map_t *map)
 116 {
 117     mqs_taddr_t value;
 118     mpi_image_info *i_info = (mpi_image_info *) mqs_get_image_info(image);
 119 
 120     if (NULL != i_info) {
 121         map->map_name = strdup(public_name);
 122         if (NULL != private_name) {
 123             if (mqs_ok == mqs_find_symbol(image, private_name, &value)) {
 124                 map->map_handle = value;
 125                 return;
 126             }
 127         } else {
 128             map->map_handle = 0;
 129             return;
 130         }
 131     }
 132 
 133     printf("OMPI MPI handles DLL: fill_map: Unable to find symbol: %s\n",
 134            private_name);
 135 }
 136 
 137 /* Helper function to lookup MPI attributes and fill an
 138    mpidbg_attribute_pair_t array with their keys/values */
 139 static int fill_attributes(int *num_attrs,
 140                            struct mpidbg_attribute_pair_t **attrs,
 141                            mqs_taddr_t table)
 142 {
 143     /* JMS fill me in */
 144     return mqs_ok;
 145 }
 146 
 147 /*---------------------------------------------------------------------*/
 148 
 149 int mpidbg_init_once(const mqs_basic_callbacks *cb)
 150 {
 151     mqs_basic_entrypoints = cb;
 152     printf("mpidbg_init_once\n");
 153     return MPIDBG_SUCCESS;
 154 }
 155 
 156 /*---------------------------------------------------------------------*/
 157 
 158 /* Returns the fixed value */
 159 int mpidbg_interface_version_compatibility(void)
 160 {
 161     printf("mpidbg_interface_version_compatibility\n");
 162     return MPIDBG_INTERFACE_VERSION;
 163 }
 164 
 165 
 166 static char mpidbg_version_str[OMPI_MAX_VER_SIZE];
 167 
 168 /* Returns a string specific to OMPI */
 169 char *mpidbg_version_string(void)
 170 {
 171     int offset;
 172     printf("mpidbg_version_string\n");
 173     offset = snprintf(mpidbg_version_str, OMPI_MAX_VER_SIZE-1,  
 174                       "Open MPI handle interpretation support for parallel debuggers ");
 175     ompi_get_lib_version(mpidbg_version_str+offset, OMPI_MAX_VER_SIZE-offset);
 176     return mpidbg_version_str;
 177 }
 178 
 179 
 180 /* So the debugger can tell what interface width the library was
 181    compiled with */
 182 int mpidbg_dll_taddr_width(void)
 183 {
 184     printf("mpidbg_dll_taddr_width\n");
 185     return sizeof(mqs_taddr_t);
 186 }
 187 
 188 /*---------------------------------------------------------------------*/
 189 
 190 /* Once-per-image setup */
 191 int mpidbg_init_per_image(mqs_image *image, const mqs_image_callbacks *icb,
 192                           struct mpidbg_handle_info_t *handle_types)
 193 {
 194     char **message;
 195     mpi_image_info *i_info =
 196         (mpi_image_info *) mqs_malloc(sizeof(mpi_image_info));
 197     printf("mpidbg_init_per_image\n");
 198 
 199     if (NULL == i_info) {
 200         printf("mpidbg_init_per_image: malloc failed!\n");
 201         return MPIDBG_ERR_NO_MEM;
 202     }
 203 
 204     memset((void *)i_info, 0, sizeof(mpi_image_info));
 205     /* Before we do *ANYTHING* else */
 206     i_info->image_callbacks = icb;
 207 
 208     /* Nothing extra (yet) */
 209     i_info->extra = NULL;
 210 
 211     /* Save the info */
 212     mqs_put_image_info(image, (mqs_image_info *)i_info);
 213 
 214     /* Fill in the OMPI type information */
 215     if (mqs_ok != ompi_fill_in_type_info(image, message)) {
 216         printf("mpidbg_init_per_image: failed to get all type info\n");
 217         return MPIDBG_ERR_NOT_SUPPORTED;
 218     }
 219 
 220     /* Fill in the handle_types struct with our types */
 221     /* JMS: "MPI_Aint" is a typedef -- is that enough?  (the actual
 222        type is a #define, so it's not easy to put into the
 223        mqs_find_type call as a string) */
 224     handle_types->hi_c_aint = mqs_find_type(image, "MPI_Aint", mqs_lang_c);
 225     /* JMS: these ompi types are just the "foo" types; but OMPI MPI
 226        types are all "foo*"'s -- is this right?  If this is wrong, I
 227        *suspect* that something like the following may be right:
 228 
 229        handle_types->hi_c_comm = mqs_find_type(image, "ompi_communicator_t*", mqs_lang_c);
 230 
 231        Need to confirm this with the DDT guys...
 232     */
 233     handle_types->hi_c_comm = i_info->ompi_communicator_t.type;
 234     handle_types->hi_c_datatype = i_info->ompi_datatype_t.type;
 235     handle_types->hi_c_errhandler =
 236         mqs_find_type(image, "ompi_errhandler_t", mqs_lang_c);
 237     handle_types->hi_c_file =
 238         mqs_find_type(image, "ompi_file_t", mqs_lang_c);
 239     handle_types->hi_c_group = i_info->ompi_group_t.type;
 240     handle_types->hi_c_info =
 241         mqs_find_type(image, "opal_info_t", mqs_lang_c);
 242     /* JMS: "MPI_Offset" is a typedef (see comment about MPI_Aint above) */
 243     handle_types->hi_c_offset =
 244         mqs_find_type(image, "MPI_Offset", mqs_lang_c);
 245     handle_types->hi_c_op =
 246         mqs_find_type(image, "ompi_op_t", mqs_lang_c);
 247     handle_types->hi_c_request = i_info->ompi_request_t.type;
 248     handle_types->hi_c_status = i_info->ompi_status_public_t.type;
 249     handle_types->hi_c_win =
 250         mqs_find_type(image, "ompi_win_t", mqs_lang_c);
 251 
 252     /* MPI::Aint is a typedef to MPI_Aint */
 253     handle_types->hi_cxx_aint = handle_types->hi_cxx_aint;
 254     handle_types->hi_cxx_comm =
 255         mqs_find_type(image, "MPI::Comm", mqs_lang_cplus);
 256     handle_types->hi_cxx_intracomm =
 257         mqs_find_type(image, "MPI::Intracomm", mqs_lang_cplus);
 258     handle_types->hi_cxx_intercomm =
 259         mqs_find_type(image, "MPI::Intercomm", mqs_lang_cplus);
 260     handle_types->hi_cxx_graphcomm =
 261         mqs_find_type(image, "MPI::Graphcomm", mqs_lang_cplus);
 262     handle_types->hi_cxx_cartcomm =
 263         mqs_find_type(image, "MPI::Cartcomm", mqs_lang_cplus);
 264     handle_types->hi_cxx_datatype =
 265         mqs_find_type(image, "MPI::Datatype", mqs_lang_cplus);
 266     handle_types->hi_cxx_errhandler =
 267         mqs_find_type(image, "MPI::Errhandler", mqs_lang_cplus);
 268     handle_types->hi_cxx_file =
 269         mqs_find_type(image, "MPI::File", mqs_lang_cplus);
 270     handle_types->hi_cxx_group =
 271         mqs_find_type(image, "MPI::Group", mqs_lang_cplus);
 272     handle_types->hi_cxx_info =
 273         mqs_find_type(image, "MPI::Info", mqs_lang_cplus);
 274     /* MPI::Offset is a typedef to MPI_Offset */
 275     handle_types->hi_cxx_offset = handle_types->hi_c_offset;
 276     handle_types->hi_cxx_op =
 277         mqs_find_type(image, "MPI::Op", mqs_lang_cplus);
 278     handle_types->hi_cxx_request =
 279         mqs_find_type(image, "MPI::Request", mqs_lang_cplus);
 280     handle_types->hi_cxx_prequest =
 281         mqs_find_type(image, "MPI::Prequest", mqs_lang_cplus);
 282     handle_types->hi_cxx_grequest =
 283         mqs_find_type(image, "MPI::Grequest", mqs_lang_cplus);
 284     handle_types->hi_cxx_status =
 285         mqs_find_type(image, "MPI::Status", mqs_lang_cplus);
 286     handle_types->hi_cxx_win =
 287         mqs_find_type(image, "MPI::Win", mqs_lang_cplus);
 288 
 289     /* Tell the debuger what capabilities we have */
 290     mpidbg_comm_capabilities =
 291         MPIDBG_COMM_CAP_BASIC |
 292         MPIDBG_COMM_CAP_STRING_NAMES |
 293         MPIDBG_COMM_CAP_FREED_HANDLE |
 294         MPIDBG_COMM_CAP_FREED_OBJECT;
 295     mpidbg_errhandler_capabilities =
 296         MPIDBG_ERRH_CAP_BASIC |
 297         MPIDBG_ERRH_CAP_STRING_NAMES |
 298         MPIDBG_ERRH_CAP_FREED_HANDLE |
 299         MPIDBG_ERRH_CAP_FREED_OBJECT;
 300     mpidbg_request_capabilities =
 301         MPIDBG_REQUEST_CAP_BASIC;
 302     mpidbg_status_capabilities =
 303         MPIDBG_STATUS_CAP_BASIC;
 304 
 305     /* All done */
 306     printf("mpidbg_init_per_image: init succeeded -- ready!\n");
 307     return MPIDBG_SUCCESS;
 308 }
 309 
 310 
 311 /* This image is now dead; free all the state associated with it */
 312 void mpidbg_finalize_per_image(mqs_image *image, mqs_image_info *info)
 313 {
 314     mpi_image_info *i_info = (mpi_image_info *)info;
 315 
 316     printf("mpidbg_finalize_per_image\n");
 317     if (NULL != i_info->extra) {
 318         mqs_free(i_info->extra);
 319     }
 320     mqs_free(info);
 321 }
 322 
 323 /*---------------------------------------------------------------------*/
 324 
 325 /* Setup information needed for a specific process.  The debugger
 326  * assumes that this will hang something onto the process, if nothing
 327  * is attached to it, then TV will believe that this process has no
 328  * message queue information.
 329  */
 330 int mpidbg_init_per_process(mqs_process *process,
 331                             const mqs_process_callbacks *pcb,
 332                             struct mpidbg_handle_info_t *handle_types)
 333 {
 334     mqs_image *image;
 335     mpi_image_info *i_info;
 336 
 337     /* Extract the addresses of the global variables we need and save
 338        them away */
 339     mpi_process_info *p_info =
 340         (mpi_process_info *) mqs_malloc(sizeof(mpi_process_info));
 341     printf("mpidbg_init_per_process\n");
 342 
 343     if (NULL == p_info) {
 344         return MPIDBG_ERR_NO_MEM;
 345     }
 346 
 347     /* Setup the callbacks first */
 348     p_info->process_callbacks = pcb;
 349 
 350     /* Nothing extra (yet) */
 351     p_info->extra = NULL;
 352 
 353     /* Now we can get the rest of the info */
 354     image = mqs_get_image(process);
 355     i_info = (mpi_image_info *) mqs_get_image_info(image);
 356 
 357     /* Get process info sizes */
 358     mqs_get_type_sizes (process, &p_info->sizes);
 359 
 360     /* Save the info */
 361     mqs_put_process_info(process, (mqs_process_info *) p_info);
 362 
 363     /* Fill in pre-defined MPI handle name mappings (because OMPI uses
 364        #define's for the pre-defined names, such as "#define
 365        MPI_COMM_WORLD &ompi_mpi_comm_world"). */
 366     /* Communicators */
 367     mpidbg_comm_name_map = alloc_map(image, 4);
 368     if (NULL != mpidbg_comm_name_map) {
 369         int i = 0;
 370         fill_map(image, "MPI_COMM_WORLD", "ompi_mpi_comm_world",
 371                  &mpidbg_comm_name_map[i++]);
 372         fill_map(image, "MPI_COMM_SELF", "ompi_mpi_comm_self",
 373                  &mpidbg_comm_name_map[i++]);
 374         fill_map(image, "MPI_COMM_NULL", "ompi_mpi_comm_null",
 375                  &mpidbg_comm_name_map[i++]);
 376 
 377         /* Sentinel value */
 378         mpidbg_comm_name_map[i].map_name = NULL;
 379     }
 380 
 381     /* Error handlers */
 382     mpidbg_errhandler_name_map = alloc_map(image, 4);
 383     if (NULL != mpidbg_errhandler_name_map) {
 384         int i = 0;
 385         fill_map(image, "MPI_ERRORS_ARE_FATAL", "ompi_mpi_errors_are_fatal",
 386                  &mpidbg_errhandler_name_map[i++]);
 387         fill_map(image, "MPI_ERRORS_RETURN", "ompi_mpi_errors_return",
 388                  &mpidbg_errhandler_name_map[i++]);
 389         fill_map(image, "MPI_ERRHANDLER_NULL", "ompi_mpi_errhandler_null",
 390                  &mpidbg_errhandler_name_map[i++]);
 391         /* MPI::ERRORS_THROW_EXCEPTIONS exists as a symbol in OMPI; no
 392            need to alias it here */
 393 
 394         /* Sentinel value */
 395         mpidbg_errhandler_name_map[i].map_name = NULL;
 396     }
 397 
 398     /* Requests */
 399     mpidbg_request_name_map = alloc_map(image, 2);
 400     if (NULL != mpidbg_request_name_map) {
 401         int i = 0;
 402         fill_map(image, "MPI_REQUEST_NULL", "ompi_request_null",
 403                  &mpidbg_request_name_map[i++]);
 404 
 405         /* Sentinel value */
 406         mpidbg_request_name_map[i].map_name = NULL;
 407     }
 408 
 409     /* Statuses */
 410     mpidbg_status_name_map = alloc_map(image, 2);
 411     if (NULL != mpidbg_status_name_map) {
 412         int i = 0;
 413         fill_map(image, "MPI_STATUS_IGNORE", NULL,
 414                  &mpidbg_status_name_map[i++]);
 415 
 416         /* Sentinel value */
 417         mpidbg_status_name_map[i].map_name = NULL;
 418     }
 419 
 420     /* All done */
 421     return MPIDBG_SUCCESS;
 422 }
 423 
 424 
 425 /* This process is now done; free all the state associated with it */
 426 void mpidbg_finalize_per_process(mqs_process *process, mqs_process_info *info)
 427 {
 428     mpi_process_info *p_info = (mpi_process_info *)info;
 429 
 430     printf("mpidbg_finalize_per_process\n");
 431     if (NULL != p_info->extra) {
 432         mqs_free(p_info->extra);
 433     }
 434     mqs_free(info);
 435 }
 436 
 437 
 438 /*---------------------------------------------------------------------*/
 439 
 440 int mpidbg_comm_query(mqs_image *image, mqs_image_info *image_info,
 441                       mqs_process *process, mqs_process_info *process_info,
 442                       mqs_taddr_t c_comm, struct mpidbg_comm_info_t **info)
 443 {
 444     int flags;
 445     mpi_image_info *i_info = (mpi_image_info*) image_info;
 446     mpi_process_info *p_info = (mpi_process_info*) process_info;
 447     mqs_taddr_t group, topo, keyhash;
 448 
 449     /* Get the comm name */
 450 
 451     *info = mqs_malloc(sizeof(struct mpidbg_comm_info_t));
 452     if (NULL == *info) {
 453         return MPIDBG_ERR_NO_MEM;
 454     }
 455     /* JMS temporarily zero everything out.  Remove this when we fill
 456        in all the fields */
 457     memset(*info, 0, sizeof(struct mpidbg_comm_info_t));
 458     (*info)->comm_c_handle = c_comm;
 459 
 460     printf("mpidbg_comm_query: %p\n", (void*) c_comm);
 461     mqs_fetch_data(process, c_comm + i_info->ompi_communicator_t.offset.c_name,
 462                    MPIDBG_MAX_OBJECT_NAME, (*info)->comm_name);
 463 
 464     /* Get this process' rank in the comm */
 465     (*info)->comm_rank = ompi_fetch_int(process,
 466                                         c_comm + i_info->ompi_communicator_t.offset.c_my_rank,
 467                                         p_info);
 468 
 469     /* Analyze the flags on the comm */
 470     flags = ompi_fetch_int(process,
 471                            c_comm + i_info->ompi_communicator_t.offset.c_flags,
 472                            p_info);
 473     (*info)->comm_bitflags = 0;
 474     if (MPI_PROC_NULL == (*info)->comm_rank) {
 475         /* This communicator is MPI_COMM_NULL */
 476         (*info)->comm_rank = (*info)->comm_size = 0;
 477         (*info)->comm_bitflags |= MPIDBG_COMM_INFO_COMM_NULL;
 478     } else if (0 != (flags & OMPI_COMM_INTER)) {
 479         (*info)->comm_bitflags |= MPIDBG_COMM_INFO_INTERCOMM;
 480     } else {
 481         if (0 != (flags & OMPI_COMM_CART)) {
 482             (*info)->comm_bitflags |= MPIDBG_COMM_INFO_CARTESIAN;
 483         } else if (0 != (flags & OMPI_COMM_GRAPH)) {
 484             (*info)->comm_bitflags |= MPIDBG_COMM_INFO_GRAPH;
 485         } else if (0 != (flags & OMPI_COMM_DIST_GRAPH)) {
 486             (*info)->comm_bitflags |= MPIDBG_COMM_INFO_DIST_GRAPH;
 487         }
 488     }
 489     if (0 != (flags & OMPI_COMM_ISFREED)) {
 490         (*info)->comm_bitflags |= MPIDBG_COMM_INFO_FREED_HANDLE;
 491     }
 492     if (0 != (flags & OMPI_COMM_INTRINSIC)) {
 493         (*info)->comm_bitflags |= MPIDBG_COMM_INFO_PREDEFINED;
 494     }
 495     if (0 != (flags & OMPI_COMM_INVALID)) {
 496         (*info)->comm_bitflags |= MPIDBG_COMM_INFO_FREED_OBJECT;
 497     }
 498 
 499     /* Look up the local group */
 500     group = ompi_fetch_pointer(process,
 501                                c_comm + i_info->ompi_communicator_t.offset.c_local_group,
 502                                p_info);
 503     (*info)->comm_rank = ompi_fetch_int(process,
 504                                         group + i_info->ompi_group_t.offset.grp_my_rank,
 505                                         p_info);
 506     (*info)->comm_num_local_procs = ompi_fetch_int(process,
 507                                                    group + i_info->ompi_group_t.offset.grp_proc_count,
 508                                                    p_info);
 509 
 510     /* Fill in the comm_size with the size of the local group.  We'll
 511        override below if this is an intercommunicator. */
 512     (*info)->comm_size = (*info)->comm_num_local_procs;
 513 
 514     /* JMS fill this in: waiting to decide between mpidbg_process_t
 515        and mqs_process_location */
 516     (*info)->comm_local_procs = NULL;
 517 
 518     /* Look up the remote group (if relevant) */
 519     if (0 != (flags & OMPI_COMM_INTER)) {
 520         group = ompi_fetch_pointer(process,
 521                                    c_comm + i_info->ompi_communicator_t.offset.c_remote_group,
 522                                    p_info);
 523         (*info)->comm_num_remote_procs = ompi_fetch_int(process,
 524                                                         group + i_info->ompi_group_t.offset.grp_proc_count,
 525                                                         p_info);
 526         (*info)->comm_size = (*info)->comm_num_remote_procs;
 527 
 528         /* JMS fill this in: waiting to decide between
 529            mpidbg_process_t and mqs_process_location */
 530         (*info)->comm_remote_procs = NULL;
 531     } else {
 532         (*info)->comm_num_remote_procs = 0;
 533         (*info)->comm_remote_procs = NULL;
 534     }
 535 
 536     /* Fill in cartesian/graph info, if relevant.  The cartesian and
 537        graph data is just slightly different from each other; it's
 538        [slightly] easier (and less confusing!) to have separate
 539        retrieval code blocks. */
 540     topo = ompi_fetch_pointer(process,
 541                               c_comm + i_info->ompi_communicator_t.offset.c_topo,
 542                               p_info);
 543     if (0 != topo &&
 544         0 != ((*info)->comm_bitflags & MPIDBG_COMM_INFO_CARTESIAN)) {
 545         int i, ndims, tmp;
 546         mqs_taddr_t dims, periods;
 547 
 548         /* Alloc space for copying arrays */
 549         (*info)->comm_cart_num_dims = ndims =
 550             ompi_fetch_int(process,
 551                            topo + i_info->mca_topo_base_module_t.offset.mtc.cart.ndims,
 552                            p_info);
 553         (*info)->comm_cart_dims = mqs_malloc(ndims * sizeof(int));
 554         if (NULL == (*info)->comm_cart_dims) {
 555             return MPIDBG_ERR_NO_MEM;
 556         }
 557         (*info)->comm_cart_periods = mqs_malloc(ndims * sizeof(int8_t));
 558         if (NULL == (*info)->comm_cart_periods) {
 559             mqs_free((*info)->comm_cart_dims); (*info)->comm_cart_dims = NULL;
 560             return MPIDBG_ERR_NO_MEM;
 561         }
 562         (*info)->comm_cart_coords = mqs_malloc(ndims * sizeof(int8_t));
 563         if (NULL == (*info)->comm_cart_coords) {
 564             mqs_free((*info)->comm_cart_periods); (*info)->comm_cart_periods = NULL;
 565             mqs_free((*info)->comm_cart_dims);    (*info)->comm_cart_dims = NULL;
 566             return MPIDBG_ERR_NO_MEM;
 567         }
 568 
 569         /* Retrieve the dimension and periodic description data from
 570            the two arrays on the image's communicator */
 571         dims = ompi_fetch_pointer(process,
 572                                  topo + i_info->mca_topo_base_module_t.offset.mtc.cart.dims,
 573                                  p_info);
 574         periods = ompi_fetch_pointer(process,
 575                                  topo + i_info->mca_topo_base_module_t.offset.mtc.cart.periods,
 576                                  p_info);
 577         coords = ompi_fetch_pointer(process,
 578                                  topo + i_info->mca_topo_base_module_t.offset.mtc.cart.coords,
 579                                  p_info);
 580 
 581         for (i = 0; i < ndims; ++i) {
 582             (*info)->comm_cart_dims[i] =
 583                 ompi_fetch_int(process, dims + (sizeof(int) * i), p_info);
 584             tmp = ompi_fetch_int(process, periods + (sizeof(int) * i), p_info);
 585             (*info)->comm_cart_periods[i] = (int8_t) tmp;
 586             printf("mpidbg: cart comm: dimension %d: (length %d, periodic: %d)\n", i, (*info)->comm_cart_dims[i], tmp);
 587         }
 588     } else if (0 != topo &&
 589                0 != ((*info)->comm_bitflags & MPIDBG_COMM_INFO_GRAPH)) {
 590         int i, nnodes;
 591         mqs_taddr_t index, edges;
 592 
 593         /* Alloc space for copying the indexes */
 594         (*info)->comm_graph_num_nodes = nnodes =
 595             ompi_fetch_int(process,
 596                            topo + i_info->mca_topo_base_module_t.offset.mtc.graph.nnodes,
 597                            p_info);
 598         (*info)->comm_graph_index = mqs_malloc(nnodes * sizeof(int));
 599         if (NULL == (*info)->comm_graph_index) {
 600             return MPIDBG_ERR_NO_MEM;
 601         }
 602 
 603         /* Retrieve the index data */
 604         index = ompi_fetch_pointer(process,
 605                                  topo + i_info->mca_topo_base_module_t.offset.mtc.graph.index,
 606                                  p_info);
 607         for (i = 0; i < nnodes; ++i) {
 608             (*info)->comm_graph_index[i] =
 609                 ompi_fetch_int(process, index + (sizeof(int) * i), p_info);
 610         }
 611 
 612         /* Allocate space for the edges */
 613         (*info)->comm_graph_edges = mqs_malloc((*info)->comm_graph_index[(*info)->comm_graph_num_nodes - 1] * sizeof(int));
 614         if (NULL == (*info)->comm_graph_edges) {
 615             mqs_free((*info)->comm_graph_index);
 616             (*info)->comm_graph_index = NULL;
 617             return MPIDBG_ERR_NO_MEM;
 618         }
 619 
 620         /* Retrieve the edge data */
 621         edges = ompi_fetch_pointer(process,
 622                                  topo + i_info->mca_topo_base_module_t.offset.mtc.graph.edges,
 623                                  p_info);
 624         for (i = 0;
 625              i < (*info)->comm_graph_index[(*info)->comm_graph_num_nodes - 1];
 626              ++i) {
 627             (*info)->comm_graph_edges[i] =
 628                 ompi_fetch_int(process, edges + (sizeof(int) * i), p_info);
 629         }
 630     } else if (0 != topo &&
 631                0 != ((*info)->comm_bitflags & MPIDBG_COMM_INFO_DIST_GRAPH)) {
 632         /* TODO: Complete the info if the communicator has a distributed graph topology */
 633     }
 634 
 635     /* Fortran handle */
 636     (*info)->comm_fortran_handle =
 637         ompi_fetch_int(process,
 638                        c_comm + i_info->ompi_communicator_t.offset.c_f_to_c_index,
 639                        p_info);
 640     printf("mpdbg: comm fortran handle: %d\n", (*info)->comm_fortran_handle);
 641 
 642     /* Fill in attributes */
 643     keyhash = ompi_fetch_pointer(process,
 644                                  c_comm + i_info->ompi_communicator_t.offset.c_keyhash,
 645                                  p_info);
 646     fill_attributes(&((*info)->comm_num_attrs), &((*info)->comm_attrs),
 647                     keyhash);
 648 
 649     /* JMS temporary */
 650     (*info)->comm_num_pending_requests = MPIDBG_ERR_NOT_SUPPORTED;
 651     (*info)->comm_pending_requests = NULL;
 652     (*info)->comm_num_derived_windows = MPIDBG_ERR_NOT_SUPPORTED;
 653     (*info)->comm_derived_windows = NULL;
 654     (*info)->comm_num_derived_files = MPIDBG_ERR_NOT_SUPPORTED;
 655     (*info)->comm_derived_files = NULL;
 656 
 657     return MPIDBG_SUCCESS;
 658 }
 659 
 660 int mpidbg_comm_f2c(mqs_image *image, mqs_image_info *image_info,
 661                     mqs_process *process, mqs_process_info *process_info,
 662                     mqs_taddr_t f77_comm, mqs_taddr_t *c_comm)
 663 {
 664     mqs_taddr_t comm_list;
 665     mpi_image_info *i_info = (mpi_image_info *) image_info;
 666     mpi_process_info *p_info = (mpi_process_info*) process_info;
 667 
 668     mqs_find_symbol(image, "ompi_mpi_communicators", &comm_list);
 669     if (mqs_ok != ompi_fetch_opal_pointer_array_item(process, comm_list,
 670                                                      p_info, f77_comm,
 671                                                      c_comm) ||
 672         NULL == c_comm) {
 673         printf("mpidbg_comm_f2c: %lu -> not found\n",
 674                (long unsigned int) f77_comm);
 675         return MPIDBG_ERR_NOT_FOUND;
 676     }
 677     printf("mpidbg_comm_f2c: %lu -> %lu\n",
 678            (long unsigned int) f77_comm, (long unsigned int) c_comm);
 679     return MPIDBG_SUCCESS;
 680 }
 681 
 682 int mpidbg_comm_cxx2c(mqs_image *image, mqs_image_info *image_info,
 683                       mqs_process *process, mqs_process_info *process_info,
 684                       mqs_taddr_t cxx_comm,
 685                       enum mpidbg_comm_info_bitmap_t comm_type,
 686                       mqs_taddr_t *c_comm)
 687 {
 688     /* David tells me that any type of communicator (MPI::Comm,
 689        MPI::Intracomm, etc.) should have the offset to the mpi_comm
 690        member in the same place. */
 691     printf("mpidbg_comm_cxx2c: %p\n", (void*) cxx_comm);
 692     return MPIDBG_ERR_NOT_FOUND;
 693 }
 694 
 695 /*---------------------------------------------------------------------*/
 696 
 697 int mpidbg_errhandler_query(mqs_image *image, mqs_image_info *image_info,
 698                             mqs_process *process, mqs_process_info *process_info,
 699                             mqs_taddr_t c_errhandler,
 700                             struct mpidbg_errhandler_info_t **info)
 701 {
 702     printf("mpidbg_errhandler_query: %p\n", (void*) c_errhandler);
 703     printf("mpidbg_errhandler_query: not [yet] found\n");
 704     return MPIDBG_ERR_NOT_FOUND;
 705 }
 706 
 707 int mpidbg_errhandler_f2c(mqs_image *image, mqs_image_info *image_info,
 708                           mqs_process *process, mqs_process_info *process_info,
 709                           mqs_taddr_t f77_errhandler, mqs_taddr_t *c_errhandler)
 710 {
 711     printf("mpidbg_errhandler_f2c: %lu\n", (long unsigned int) f77_errhandler);
 712     printf("mpidbg_errhandler_f2c: not [yet] found\n");
 713     return MPIDBG_ERR_NOT_FOUND;
 714 }
 715 
 716 int mpidbg_errhandler_cxx2c(mqs_image *image, mqs_image_info *image_info,
 717                             mqs_process *process, mqs_process_info *process_info,
 718                             mqs_taddr_t cxx_errhandler,
 719                             mqs_taddr_t *c_errhandler)
 720 {
 721     printf("mpidbg_errhandler_cxx2c: %p\n", (void*) cxx_errhandler);
 722     printf("mpidbg_errhandler_cxx2c: not [yet] found\n");
 723     return MPIDBG_ERR_NOT_FOUND;
 724 }
 725 
 726 /*---------------------------------------------------------------------*/
 727 
 728 int mpidbg_request_query(mqs_image *image, mqs_image_info *image_info,
 729                          mqs_process *process, mqs_process_info *process_info,
 730                          mqs_taddr_t c_request,
 731                          struct mpidbg_request_info_t **info)
 732 {
 733     printf("mpidbg_request_query: %p\n", (void*) c_request);
 734     printf("mpidbg_request_query: not [yet] found\n");
 735     return MPIDBG_ERR_NOT_FOUND;
 736 }
 737 
 738 int mpidbg_request_f2c(mqs_image *image, mqs_image_info *image_info,
 739                        mqs_process *process, mqs_process_info *process_info,
 740                        mqs_taddr_t f77_request, mqs_taddr_t *c_request)
 741 {
 742     printf("mpidbg_request_f2c: %lu\n", (long unsigned int) f77_request);
 743     printf("mpidbg_request_f2c: not [yet] found\n");
 744     return MPIDBG_ERR_NOT_FOUND;
 745 }
 746 
 747 int mpidbg_request_cxx2c(mqs_image *image, mqs_image_info *image_info,
 748                          mqs_process *process, mqs_process_info *process_info,
 749                          mqs_taddr_t cxx_request,
 750                          enum mpidbg_request_info_bitmap_t request_type,
 751                          mqs_taddr_t *c_request)
 752 {
 753     printf("mpidbg_request_cxx2c: %p\n", (void*) cxx_request);
 754     printf("mpidbg_request_cxx2c: not [yet] found\n");
 755     return MPIDBG_ERR_NOT_FOUND;
 756 }
 757 
 758 /*---------------------------------------------------------------------*/
 759 
 760 int mpidbg_status_query(mqs_image *image, mqs_image_info *image_info,
 761                         mqs_process *process, mqs_process_info *process_info,
 762                         mqs_taddr_t c_status,
 763                         struct mpidbg_status_info_t **info)
 764 {
 765     printf("mpidbg_status_query: %p\n", (void*) c_status);
 766     printf("mpidbg_status_query: not [yet] found\n");
 767     return MPIDBG_ERR_NOT_FOUND;
 768 }
 769 
 770 int mpidbg_status_f2c(mqs_image *image, mqs_image_info *image_info,
 771                       mqs_process *process, mqs_process_info *process_info,
 772                       mqs_taddr_t f77_status, mqs_taddr_t *c_status)
 773 {
 774     printf("mpidbg_status_f2c: %lu\n", (long unsigned int) f77_status);
 775     printf("mpidbg_status_f2c: not [yet] found\n");
 776     return MPIDBG_ERR_NOT_FOUND;
 777 }
 778 
 779 int mpidbg_status_cxx2c(mqs_image *image, mqs_image_info *image_info,
 780                         mqs_process *process, mqs_process_info *process_info,
 781                         mqs_taddr_t cxx_status,
 782                         mqs_taddr_t *c_status)
 783 {
 784     printf("mpidbg_status_cxx2c: %p\n", (void*) cxx_status);
 785     printf("mpidbg_status_cxx2c: not [yet] found\n");
 786     return MPIDBG_ERR_NOT_FOUND;
 787 }

/* [<][>][^][v][top][bottom][index][help] */