1
1

Remodel the ompi_free_list a little. The free_list_memory is in

fact a free_list_item so instead of having a struct, use typedef
to make them equivalent. Modify the parallel debuggers support
in order to allow them access to the internal types even when
we have an optimized build.

This commit was SVN r16567.
Этот коммит содержится в:
George Bosilca 2007-10-25 16:47:54 +00:00
родитель 1085336cfc
Коммит e724ca0a1f
5 изменённых файлов: 50 добавлений и 37 удалений

Просмотреть файл

@ -31,15 +31,7 @@ static void ompi_free_list_destruct(ompi_free_list_t* fl);
OBJ_CLASS_INSTANCE(ompi_free_list_t, opal_atomic_lifo_t, OBJ_CLASS_INSTANCE(ompi_free_list_t, opal_atomic_lifo_t,
ompi_free_list_construct, ompi_free_list_destruct); ompi_free_list_construct, ompi_free_list_destruct);
struct ompi_free_list_memory_t { typedef struct ompi_free_list_item_t ompi_free_list_memory_t;
opal_list_item_t super;
mca_mpool_base_registration_t *registration;
void *base_ptr;
};
typedef struct ompi_free_list_memory_t ompi_free_list_memory_t;
static OBJ_CLASS_INSTANCE(ompi_free_list_memory_t,
opal_list_item_t,
NULL, NULL);
OBJ_CLASS_INSTANCE(ompi_free_list_item_t, OBJ_CLASS_INSTANCE(ompi_free_list_item_t,
opal_list_item_t, opal_list_item_t,
@ -76,7 +68,7 @@ static void ompi_free_list_destruct(ompi_free_list_t* fl)
while(NULL != (item = opal_list_remove_first(&(fl->fl_allocations)))) { while(NULL != (item = opal_list_remove_first(&(fl->fl_allocations)))) {
fl_mem = (ompi_free_list_memory_t*)item; fl_mem = (ompi_free_list_memory_t*)item;
if(fl->fl_mpool != NULL) { if(fl->fl_mpool != NULL) {
fl->fl_mpool->mpool_free(fl->fl_mpool, fl_mem->base_ptr, fl->fl_mpool->mpool_free(fl->fl_mpool, fl_mem->ptr,
fl_mem->registration); fl_mem->registration);
} }
/* destruct the item (we constructed it), then free the memory chunk */ /* destruct the item (we constructed it), then free the memory chunk */
@ -169,11 +161,11 @@ int ompi_free_list_grow(ompi_free_list_t* flist, size_t num_elements)
/* make the alloc_ptr a list item, save the chunk in the allocations list, /* make the alloc_ptr a list item, save the chunk in the allocations list,
* and have ptr point to memory right after the list item structure */ * and have ptr point to memory right after the list item structure */
OBJ_CONSTRUCT(alloc_ptr, ompi_free_list_memory_t); OBJ_CONSTRUCT(alloc_ptr, ompi_free_list_item_t);
opal_list_append(&(flist->fl_allocations), (opal_list_item_t*)alloc_ptr); opal_list_append(&(flist->fl_allocations), (opal_list_item_t*)alloc_ptr);
alloc_ptr->registration = reg; alloc_ptr->registration = reg;
alloc_ptr->base_ptr = mpool_alloc_ptr; alloc_ptr->ptr = mpool_alloc_ptr;
ptr = (unsigned char*)alloc_ptr + sizeof(ompi_free_list_memory_t); ptr = (unsigned char*)alloc_ptr + sizeof(ompi_free_list_memory_t);
ptr = OPAL_ALIGN_PTR(ptr, flist->fl_alignment, unsigned char*); ptr = OPAL_ALIGN_PTR(ptr, flist->fl_alignment, unsigned char*);

Просмотреть файл

@ -65,10 +65,8 @@ struct ompi_free_list_item_t
void *ptr; void *ptr;
}; };
typedef struct ompi_free_list_item_t ompi_free_list_item_t; typedef struct ompi_free_list_item_t ompi_free_list_item_t;
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_free_list_item_t); OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_free_list_item_t);
/** /**
* Initialize a free list. * Initialize a free list.
* *

Просмотреть файл

@ -516,15 +516,6 @@ int mqs_image_has_queues (mqs_image *image, char **message)
/* This is just an overloaded opal_list_item_t */ /* This is just an overloaded opal_list_item_t */
i_info->ompi_free_list_item_t.size = mqs_sizeof(qh_type); i_info->ompi_free_list_item_t.size = mqs_sizeof(qh_type);
} }
{
mqs_type* qh_type = mqs_find_type( image, "ompi_free_list_memory_t", mqs_lang_c );
if( !qh_type ) {
missing_in_action = "ompi_free_list_memory_t";
goto type_missing;
}
/* This is just an overloaded opal_list_item_t */
i_info->ompi_free_list_memory_t.size = mqs_sizeof(qh_type);
}
{ {
mqs_type* qh_type = mqs_find_type( image, "ompi_free_list_t", mqs_lang_c ); mqs_type* qh_type = mqs_find_type( image, "ompi_free_list_t", mqs_lang_c );
if( !qh_type ) { if( !qh_type ) {
@ -598,6 +589,7 @@ int mqs_image_has_queues (mqs_image *image, char **message)
/** /**
* Gather information about the received fragments and theirs headers. * Gather information about the received fragments and theirs headers.
*/ */
#if 0 /* Disabled until I find a better way */
{ {
mqs_type* qh_type = mqs_find_type( image, "mca_pml_ob1_common_hdr_t", mqs_lang_c ); mqs_type* qh_type = mqs_find_type( image, "mca_pml_ob1_common_hdr_t", mqs_lang_c );
if( !qh_type ) { if( !qh_type ) {
@ -631,7 +623,7 @@ int mqs_image_has_queues (mqs_image *image, char **message)
i_info->mca_pml_ob1_recv_frag_t.offset.hdr = mqs_field_offset(qh_type, "hdr"); i_info->mca_pml_ob1_recv_frag_t.offset.hdr = mqs_field_offset(qh_type, "hdr");
i_info->mca_pml_ob1_recv_frag_t.offset.request = mqs_field_offset(qh_type, "request"); i_info->mca_pml_ob1_recv_frag_t.offset.request = mqs_field_offset(qh_type, "request");
} }
#endif
/** /**
* And now let's look at the communicator and group structures. * And now let's look at the communicator and group structures.
*/ */
@ -1254,7 +1246,7 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
/** /**
* Handle alignment issues... * Handle alignment issues...
*/ */
active_allocation += i_info->ompi_free_list_memory_t.size; active_allocation += i_info->ompi_free_list_item_t.size;
active_allocation = OPAL_ALIGN( active_allocation, active_allocation = OPAL_ALIGN( active_allocation,
position->fl_alignment, mqs_taddr_t ); position->fl_alignment, mqs_taddr_t );
/** /**
@ -1300,7 +1292,7 @@ static int ompi_free_list_t_next_item( mqs_process *proc, mpi_process_info *p_in
/** /**
* Handle alignment issues... * Handle alignment issues...
*/ */
active_allocation += i_info->ompi_free_list_memory_t.size; active_allocation += i_info->ompi_free_list_item_t.size;
active_allocation = OPAL_ALIGN( active_allocation, active_allocation = OPAL_ALIGN( active_allocation,
position->fl_alignment, mqs_taddr_t ); position->fl_alignment, mqs_taddr_t );
/** /**

Просмотреть файл

@ -50,9 +50,6 @@ typedef struct
struct { struct {
int size; int size;
} ompi_free_list_item_t; } ompi_free_list_item_t;
struct {
int size;
} ompi_free_list_memory_t;
struct { struct {
int size; int size;
struct { struct {
@ -106,6 +103,7 @@ typedef struct
int req_bytes_packed; int req_bytes_packed;
} offset; } offset;
} mca_pml_base_recv_request_t; } mca_pml_base_recv_request_t;
#if 0
/* fragments for unexpected messages (as well as theirs headers) */ /* fragments for unexpected messages (as well as theirs headers) */
struct { struct {
int size; int size;
@ -131,6 +129,7 @@ typedef struct
int hdr_seq; int hdr_seq;
} offset; } offset;
} mca_pml_ob1_match_hdr_t; } mca_pml_ob1_match_hdr_t;
#endif
/* communicator structures */ /* communicator structures */
struct { struct {
int size; int size;

Просмотреть файл

@ -28,6 +28,24 @@
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "debuggers.h" #include "debuggers.h"
/**
* A lot of include files that are required by al optimized builds in order
* to get access to the type information. Beware, this file have to always
* be compiled with the -g flag, otherwise the type information will be
* missing and the parallel debuggers will be unable to initialize the
* Open MPI debug library.
*/
#include "opal/class/opal_list.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/request/request.h"
#include "ompi/mca/pml/base/pml_base_request.h"
#include "ompi/mca/pml/base/pml_base_sendreq.h"
#include "ompi/mca/pml/base/pml_base_recvreq.h"
#include "ompi/class/ompi_pointer_array.h"
#include "ompi/communicator/communicator.h"
#include "ompi/group/group.h"
#include "ompi/datatype/datatype.h"
#include "ompi/include/mpi.h"
OMPI_DECLSPEC int MPIR_being_debugged = 0; OMPI_DECLSPEC int MPIR_being_debugged = 0;
OMPI_DECLSPEC volatile int MPIR_debug_gate = 0; OMPI_DECLSPEC volatile int MPIR_debug_gate = 0;
@ -36,14 +54,6 @@ OMPI_DECLSPEC volatile int MPIR_debug_state = 0;
OMPI_DECLSPEC char MPIR_dll_name[] = OMPI_TV_DLL; OMPI_DECLSPEC char MPIR_dll_name[] = OMPI_TV_DLL;
#endif /* defined(OMPI_TV_DLL) */ #endif /* defined(OMPI_TV_DLL) */
/**
* There is an issue with the debugger running on different architectures
* compared with the debugged program. We need to know the sizes of the types
* on the debugged program. The problem is that the size depend on the
* compilation options (32 or 64 bits) and on the compiler. Therefore,
* the simplest and more accurate way is to export these sizes directly from
* the debugged program.
*/
OMPI_DECLSPEC int MPIR_debug_typedefs_sizeof[] = { OMPI_DECLSPEC int MPIR_debug_typedefs_sizeof[] = {
sizeof(short), sizeof(short),
sizeof(int), sizeof(int),
@ -62,6 +72,28 @@ struct MPIR_PROCDESC {
OMPI_DECLSPEC struct MPIR_PROCDESC *MPIR_proctable = NULL; OMPI_DECLSPEC struct MPIR_PROCDESC *MPIR_proctable = NULL;
OMPI_DECLSPEC int MPIR_proctable_size = 0; OMPI_DECLSPEC int MPIR_proctable_size = 0;
/**
* There is an issue with the debugger running on different architectures
* compared with the debugged program. We need to know the sizes of the types
* on the debugged program. The problem is that the size depend on the
* compilation options (32 or 64 bits) and on the compiler. Therefore,
* the simplest and more accurate way is to export these sizes directly from
* the debugged program.
*/
OMPI_DECLSPEC opal_list_item_t* opal_list_item_t_type_inclusion = NULL;
OMPI_DECLSPEC opal_list_t* opal_list_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_free_list_item_t* ompi_free_list_item_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_free_list_t* ompi_free_list_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_request_t* ompi_request_t_type_inclusion = NULL;
OMPI_DECLSPEC mca_pml_base_request_t* mca_pml_base_request_t_type_inclusion = NULL;
OMPI_DECLSPEC mca_pml_base_send_request_t* mca_pml_base_send_request_t_type_inclusion = NULL;
OMPI_DECLSPEC mca_pml_base_recv_request_t* mca_pml_base_recv_request_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_pointer_array_t* ompi_pointer_array_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_communicator_t* ompi_communicator_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_group_t* ompi_group_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_status_public_t* ompi_status_public_t_type_inclusion = NULL;
OMPI_DECLSPEC ompi_datatype_t* ompi_datatype_t_type_inclusion = NULL;
/** /**
* Wait for a TotalView-like debugger if asked. * Wait for a TotalView-like debugger if asked.
*/ */