1
1

Merge pull request #407 from hjelmn/opal_free_list

Merge opal_free_list_t and ompi_free_list_t
Этот коммит содержится в:
Nathan Hjelm 2015-02-24 10:24:27 -07:00
родитель b70fa3e2cb 5ef24000c7
Коммит 44f93b4832
180 изменённых файлов: 2357 добавлений и 2289 удалений

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

@ -32,8 +32,9 @@ static int ompi_comm_request_progress (void);
void ompi_comm_request_init (void)
{
OBJ_CONSTRUCT(&ompi_comm_requests, opal_free_list_t);
(void) opal_free_list_init (&ompi_comm_requests, sizeof (ompi_comm_request_t),
OBJ_CLASS(ompi_comm_request_t), 0, -1, 8);
(void) opal_free_list_init (&ompi_comm_requests, sizeof (ompi_comm_request_t), 8,
OBJ_CLASS(ompi_comm_request_t), 0, 0, 0, -1, 8,
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&ompi_comm_requests_active, opal_list_t);
ompi_comm_request_progress_active = false;
@ -237,10 +238,11 @@ OBJ_CLASS_INSTANCE(ompi_comm_request_item_t, opal_list_item_t, NULL, NULL);
ompi_comm_request_t *ompi_comm_request_get (void)
{
opal_free_list_item_t *item;
int rc;
OPAL_FREE_LIST_GET(&ompi_comm_requests, item, rc);
(void) rc;
item = opal_free_list_get (&ompi_comm_requests);
if (OPAL_UNLIKELY(NULL == item)) {
return NULL;
}
OMPI_REQUEST_INIT((ompi_request_t *) item, false);
@ -254,6 +256,6 @@ void ompi_comm_request_return (ompi_comm_request_t *request)
request->context = NULL;
}
OPAL_FREE_LIST_RETURN(&ompi_comm_requests, (opal_free_list_item_t *) request);
opal_free_list_return (&ompi_comm_requests, (opal_free_list_item_t *) request);
}

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
@ -8,6 +9,8 @@
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -76,7 +79,7 @@ static int host_is_big_endian = 0;
* internal objects. We have to make sure we're able to find all of
* them in the image and compute their ofset in order to be able to
* parse them later. We need to find the opal_list_item_t, the
* opal_list_t, the ompi_free_list_item_t, and the ompi_free_list_t.
* opal_list_t, the opal_free_list_item_t, and the opal_free_list_t.
*
* Once we have these offsets, we should make sure that we have access
* to all requests lists and types. We're looking here only at the
@ -111,41 +114,41 @@ int ompi_fill_in_type_info(mqs_image *image, char **message)
qh_type, opal_list_t, opal_list_sentinel);
}
{
mqs_type* qh_type = mqs_find_type( image, "ompi_free_list_item_t", mqs_lang_c );
mqs_type* qh_type = mqs_find_type( image, "opal_free_list_item_t", mqs_lang_c );
if( !qh_type ) {
missing_in_action = "ompi_free_list_item_t";
missing_in_action = "opal_free_list_item_t";
goto type_missing;
}
/* This is just an overloaded opal_list_item_t */
i_info->ompi_free_list_item_t.type = qh_type;
i_info->ompi_free_list_item_t.size = mqs_sizeof(qh_type);
i_info->opal_free_list_item_t.type = qh_type;
i_info->opal_free_list_item_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, "opal_free_list_t", mqs_lang_c );
if( !qh_type ) {
missing_in_action = "ompi_free_list_t";
missing_in_action = "opal_free_list_t";
goto type_missing;
}
i_info->ompi_free_list_t.type = qh_type;
i_info->ompi_free_list_t.size = mqs_sizeof(qh_type);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_mpool,
qh_type, ompi_free_list_t, fl_mpool);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_allocations,
qh_type, ompi_free_list_t, fl_allocations);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_frag_class,
qh_type, ompi_free_list_t, fl_frag_class);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_frag_size,
qh_type, ompi_free_list_t, fl_frag_size);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_frag_alignment,
qh_type, ompi_free_list_t, fl_frag_alignment);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_max_to_alloc,
qh_type, ompi_free_list_t, fl_max_to_alloc);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_num_per_alloc,
qh_type, ompi_free_list_t, fl_num_per_alloc);
ompi_field_offset(i_info->ompi_free_list_t.offset.fl_num_allocated,
qh_type, ompi_free_list_t, fl_num_allocated);
i_info->opal_free_list_t.type = qh_type;
i_info->opal_free_list_t.size = mqs_sizeof(qh_type);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_mpool,
qh_type, opal_free_list_t, fl_mpool);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_allocations,
qh_type, opal_free_list_t, fl_allocations);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_frag_class,
qh_type, opal_free_list_t, fl_frag_class);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_frag_size,
qh_type, opal_free_list_t, fl_frag_size);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_frag_alignment,
qh_type, opal_free_list_t, fl_frag_alignment);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_max_to_alloc,
qh_type, opal_free_list_t, fl_max_to_alloc);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_num_per_alloc,
qh_type, opal_free_list_t, fl_num_per_alloc);
ompi_field_offset(i_info->opal_free_list_t.offset.fl_num_allocated,
qh_type, opal_free_list_t, fl_num_allocated);
}
{
mqs_type* qh_type = mqs_find_type( image, "opal_hash_table_t", mqs_lang_c );

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

@ -1,9 +1,12 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2012-2013 Inria. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -65,7 +68,7 @@ typedef struct
struct {
mqs_type *type;
int size;
} ompi_free_list_item_t;
} opal_free_list_item_t;
struct {
mqs_type *type;
int size;
@ -79,7 +82,7 @@ typedef struct
int fl_num_per_alloc; /* size_t */
int fl_num_allocated; /* size_t */
} offset;
} ompi_free_list_t;
} opal_free_list_t;
struct {
mqs_type *type;
int size;

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

@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -11,8 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -62,7 +62,7 @@
* debuggers will be unable to initialize the Open MPI debug library.
*/
#include "opal/class/opal_list.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_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"
@ -110,8 +110,8 @@ OMPI_DECLSPEC int MPIR_debug_typedefs_sizeof[] = {
*/
OMPI_DECLSPEC opal_list_item_t* opal_list_item_t_type_force_inclusion = NULL;
OMPI_DECLSPEC opal_list_t* opal_list_t_type_force_inclusion = NULL;
OMPI_DECLSPEC ompi_free_list_item_t* ompi_free_list_item_t_type_force_inclusion = NULL;
OMPI_DECLSPEC ompi_free_list_t* ompi_free_list_t_type_force_inclusion = NULL;
OMPI_DECLSPEC opal_free_list_item_t* opal_free_list_item_t_type_force_inclusion = NULL;
OMPI_DECLSPEC opal_free_list_t* opal_free_list_t_type_force_inclusion = NULL;
OMPI_DECLSPEC ompi_request_t* ompi_request_t_type_force_inclusion = NULL;
OMPI_DECLSPEC mca_pml_base_request_t* mca_pml_base_request_t_type_force_inclusion = NULL;
OMPI_DECLSPEC mca_pml_base_send_request_t* mca_pml_base_send_request_t_type_force_inclusion = NULL;

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

@ -1,9 +1,12 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2010 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -860,9 +863,9 @@ static int next_item_opal_list_t( mqs_process *proc, mpi_process_info *p_info,
#if defined(CODE_NOT_USED)
/**
* Parsing the ompi_free_list lists.
* Parsing the opal_free_list lists.
*/
static void ompi_free_list_t_dump_position( mqs_ompi_free_list_t_pos* position )
static void opal_free_list_t_dump_position( mqs_opal_free_list_t_pos* position )
{
printf( "position->opal_list_t_pos.current_item = 0x%llx\n", (long long)position->opal_list_t_pos.current_item );
printf( "position->opal_list_t_pos.list = 0x%llx\n", (long long)position->opal_list_t_pos.list );
@ -881,8 +884,8 @@ static void ompi_free_list_t_dump_position( mqs_ompi_free_list_t_pos* position )
}
#endif /* CODE_NOT_USED */
static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_info,
mqs_ompi_free_list_t_pos* position, mqs_taddr_t free_list )
static int opal_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_info,
mqs_opal_free_list_t_pos* position, mqs_taddr_t free_list )
{
mqs_image * image = mqs_get_image (proc);
mpi_image_info *i_info = (mpi_image_info *)mqs_get_image_info (image);
@ -891,22 +894,22 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
position->free_list = free_list;
position->fl_frag_size =
ompi_fetch_size_t( proc, position->free_list + i_info->ompi_free_list_t.offset.fl_frag_size,
ompi_fetch_size_t( proc, position->free_list + i_info->opal_free_list_t.offset.fl_frag_size,
p_info );
position->fl_frag_alignment =
ompi_fetch_size_t( proc, position->free_list + i_info->ompi_free_list_t.offset.fl_frag_alignment,
ompi_fetch_size_t( proc, position->free_list + i_info->opal_free_list_t.offset.fl_frag_alignment,
p_info );
position->fl_frag_class =
ompi_fetch_pointer( proc, position->free_list + i_info->ompi_free_list_t.offset.fl_frag_class,
ompi_fetch_pointer( proc, position->free_list + i_info->opal_free_list_t.offset.fl_frag_class,
p_info );
position->fl_mpool =
ompi_fetch_pointer( proc, position->free_list + i_info->ompi_free_list_t.offset.fl_mpool,
ompi_fetch_pointer( proc, position->free_list + i_info->opal_free_list_t.offset.fl_mpool,
p_info );
position->fl_num_per_alloc =
ompi_fetch_size_t( proc, position->free_list + i_info->ompi_free_list_t.offset.fl_num_per_alloc,
ompi_fetch_size_t( proc, position->free_list + i_info->opal_free_list_t.offset.fl_num_per_alloc,
p_info );
position->fl_num_allocated =
ompi_fetch_size_t( proc, position->free_list + i_info->ompi_free_list_t.offset.fl_num_allocated,
ompi_fetch_size_t( proc, position->free_list + i_info->opal_free_list_t.offset.fl_num_allocated,
p_info );
if( 0 == position->fl_mpool ) {
@ -919,7 +922,7 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
position->fl_frag_alignment, mqs_taddr_t );
/**
* Work around the strange ompi_free_list_t way to allocate elements. The first chunk is
* Work around the strange opal_free_list_t way to allocate elements. The first chunk is
* not required to have the same size as the others.
* A similar work around should be set for the last chunk of allocations too !!! But how
* can we solve ONE equation with 2 unknowns ?
@ -931,7 +934,7 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
if( 0 == position->fl_num_initial_alloc )
position->fl_num_initial_alloc = position->fl_num_per_alloc;
}
DEBUG(VERBOSE_LISTS,("ompi_free_list_t fl_frag_size = %lld fl_header_space = %lld\n"
DEBUG(VERBOSE_LISTS,("opal_free_list_t fl_frag_size = %lld fl_header_space = %lld\n"
" fl_frag_alignment = %lld fl_num_per_alloc = %lld\n"
" fl_num_allocated = %lld fl_num_initial_alloc = %lld\n"
" header_space = %lld\n",
@ -944,7 +947,7 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
* Initialize the pointer to the opal_list_t.
*/
opal_list_t_init_parser( proc, p_info, &position->opal_list_t_pos,
position->free_list + i_info->ompi_free_list_t.offset.fl_allocations );
position->free_list + i_info->opal_free_list_t.offset.fl_allocations );
next_item_opal_list_t( proc, p_info, &position->opal_list_t_pos, &active_allocation );
DEBUG(VERBOSE_LISTS,("active_allocation 0x%llx header_space %d\n",
(long long)active_allocation, (int)position->header_space));
@ -954,7 +957,7 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
/**
* Handle alignment issues...
*/
active_allocation += i_info->ompi_free_list_item_t.size;
active_allocation += i_info->opal_free_list_item_t.size;
active_allocation = OPAL_ALIGN( active_allocation,
position->fl_frag_alignment, mqs_taddr_t );
/**
@ -968,15 +971,15 @@ static int ompi_free_list_t_init_parser( mqs_process *proc, mpi_process_info *p_
}
position->current_item = active_allocation;
/*ompi_free_list_t_dump_position( position );*/
/*opal_free_list_t_dump_position( position );*/
return mqs_ok;
}
/**
* Return the current position and move the internal counter to the next element.
*/
static int ompi_free_list_t_next_item( mqs_process *proc, mpi_process_info *p_info,
mqs_ompi_free_list_t_pos* position, mqs_taddr_t* active_item )
static int opal_free_list_t_next_item( mqs_process *proc, mpi_process_info *p_info,
mqs_opal_free_list_t_pos* position, mqs_taddr_t* active_item )
{
mqs_image * image = mqs_get_image (proc);
mpi_image_info *i_info = (mpi_image_info *)mqs_get_image_info (image);
@ -988,7 +991,7 @@ static int ompi_free_list_t_next_item( mqs_process *proc, mpi_process_info *p_in
position->current_item += position->header_space;
if( position->current_item >= position->upper_bound ) {
DEBUG(VERBOSE_LISTS,("Reach the end of one of the ompi_free_list_t "
DEBUG(VERBOSE_LISTS,("Reach the end of one of the opal_free_list_t "
"allocations. Go to the next one\n"));
/* we should go to the next allocation */
next_item_opal_list_t( proc, p_info,
@ -1000,7 +1003,7 @@ static int ompi_free_list_t_next_item( mqs_process *proc, mpi_process_info *p_in
/**
* Handle alignment issues...
*/
active_allocation += i_info->ompi_free_list_item_t.size;
active_allocation += i_info->opal_free_list_item_t.size;
active_allocation = OPAL_ALIGN( active_allocation,
position->fl_frag_alignment, mqs_taddr_t );
/**
@ -1012,7 +1015,7 @@ static int ompi_free_list_t_next_item( mqs_process *proc, mpi_process_info *p_in
DEBUG(VERBOSE_LISTS,("there are more elements in the list "
"active_allocation = %llx upper_bound = %llx\n",
(long long)active_allocation, (long long)position->upper_bound));
/*ompi_free_list_t_dump_position( position );*/
/*opal_free_list_t_dump_position( position );*/
}
DEBUG(VERBOSE_LISTS,("Free list actual position 0x%llx next element at 0x%llx\n",
(long long)*active_item, (long long)position->current_item));
@ -1079,7 +1082,7 @@ static int fetch_request( mqs_process *proc, mpi_process_info *p_info,
/* If we get a PML request with an internal tag we will jump back here */
rescan_requests:
while( 1 ) {
ompi_free_list_t_next_item( proc, p_info,
opal_free_list_t_next_item( proc, p_info,
&extra->next_msg, &current_item );
if( 0 == current_item ) {
DEBUG(VERBOSE_REQ,("no more items in the %s request queue\n",
@ -1239,12 +1242,12 @@ int mqs_setup_operation_iterator (mqs_process *proc, int op)
switch (op) {
case mqs_pending_sends:
DEBUG(VERBOSE_REQ,("setup the send queue iterator\n"));
ompi_free_list_t_init_parser( proc, p_info, &extra->next_msg, extra->send_queue_base );
opal_free_list_t_init_parser( proc, p_info, &extra->next_msg, extra->send_queue_base );
return mqs_ok;
case mqs_pending_receives:
DEBUG(VERBOSE_REQ,("setup the receive queue iterator\n"));
ompi_free_list_t_init_parser( proc, p_info, &extra->next_msg, extra->recv_queue_base );
opal_free_list_t_init_parser( proc, p_info, &extra->next_msg, extra->recv_queue_base );
return mqs_ok;
case mqs_unexpected_messages: /* TODO */

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

@ -1,8 +1,11 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2004-2007 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -86,7 +89,7 @@ typedef struct {
mqs_tword_t fl_num_per_alloc; /* size_t */
mqs_tword_t fl_num_allocated; /* size_t */
mqs_tword_t fl_num_initial_alloc; /* size_t */
} mqs_ompi_free_list_t_pos;
} mqs_opal_free_list_t_pos;
/* Information for a single process, a list of communicators, some
@ -112,7 +115,7 @@ typedef struct
int world_proc_array_entries;
mqs_taddr_t* world_proc_array;
mqs_ompi_free_list_t_pos next_msg; /* And state for the message iterator */
mqs_opal_free_list_t_pos next_msg; /* And state for the message iterator */
mqs_op_class what; /* What queue are we looking on */
} mpi_process_info_extra;

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -767,7 +767,7 @@ typedef struct mca_bcol_base_function_t mca_bcol_base_function_t;
struct mca_bcol_base_descriptor_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
/* Vasily: will be described in the future */
};
typedef struct mca_bcol_base_descriptor_t mca_bcol_base_descriptor_t;

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -74,7 +77,7 @@ struct mca_bcol_ptpcoll_component_t {
};
struct mca_bcol_ptpcoll_collreq_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
int tag;
int num_reqs;
@ -342,7 +345,7 @@ struct mca_bcol_ptpcoll_module_t {
int **allgather_offsets;
/* Free lists of outstanding collective operations */
ompi_free_list_t collreqs_free;
opal_free_list_t collreqs_free;
int log_group_size;
struct iovec *alltoall_iovec;

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

@ -1,9 +1,12 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -51,11 +54,11 @@ static int bcol_ptpcoll_barrier_recurs_knomial_new(
**rank_exchanges = my_exchange_node->rank_exchanges;
ompi_request_t **requests;
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_bcol_ptpcoll_collreq_t *collreq;
OMPI_FREE_LIST_WAIT_MT(&ptpcoll_module->collreqs_free, item);
item = opal_free_list_wait (&ptpcoll_module->collreqs_free);
if (OPAL_UNLIKELY(NULL == item)) {
PTPCOLL_ERROR(("Free list waiting failed."));
return OMPI_ERR_OUT_OF_RESOURCE;
@ -213,7 +216,7 @@ static int bcol_ptpcoll_barrier_recurs_knomial_new(
}
}
OMPI_FREE_LIST_RETURN_MT(&ptpcoll_module->collreqs_free, (ompi_free_list_item_t *) collreq);
opal_free_list_return (&ptpcoll_module->collreqs_free, (opal_free_list_item_t *) collreq);
return BCOL_FN_COMPLETE;
}
@ -382,11 +385,11 @@ static int bcol_ptpcoll_barrier_recurs_knomial_extra_new(
int *extra_sources_array = my_exchange_node->rank_extra_sources_array;
ompi_request_t **requests;
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_bcol_ptpcoll_collreq_t *collreq;
OMPI_FREE_LIST_WAIT_MT(&ptpcoll_module->collreqs_free, item);
item = opal_free_list_wait (&ptpcoll_module->collreqs_free);
if (OPAL_UNLIKELY(NULL == item)) {
PTPCOLL_ERROR(("Free list waiting failed."));
return OMPI_ERR_OUT_OF_RESOURCE;
@ -440,7 +443,7 @@ static int bcol_ptpcoll_barrier_recurs_knomial_extra_new(
return BCOL_FN_STARTED;
}
OMPI_FREE_LIST_RETURN_MT(&ptpcoll_module->collreqs_free, (ompi_free_list_item_t *) collreq);
opal_free_list_return (&ptpcoll_module->collreqs_free, (opal_free_list_item_t *) collreq);
return BCOL_FN_COMPLETE;
}
@ -464,11 +467,11 @@ static int bcol_ptpcoll_barrier_recurs_dbl_new(
n_exchange = ptp_module->super.sbgp_partner_module->n_levels_pow2;
ompi_request_t **requests;
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_bcol_ptpcoll_collreq_t *collreq;
OMPI_FREE_LIST_WAIT_MT(&ptp_module->collreqs_free, item);
item = opal_free_list_wait (&ptp_module->collreqs_free);
if (OPAL_UNLIKELY(NULL == item)) {
PTPCOLL_ERROR(("Free list waiting failed."));
return OMPI_ERR_OUT_OF_RESOURCE;
@ -618,7 +621,7 @@ static int bcol_ptpcoll_barrier_recurs_dbl_new(
}
}
OMPI_FREE_LIST_RETURN_MT(&ptp_module->collreqs_free, (ompi_free_list_item_t *) collreq);
opal_free_list_return (&ptp_module->collreqs_free, (opal_free_list_item_t *) collreq);
return BCOL_FN_COMPLETE;
}
@ -765,7 +768,7 @@ static int bcol_ptpcoll_barrier_recurs_dbl_extra_new(
tag, my_extra_partner_comm_rank;
ompi_request_t **requests;
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_bcol_ptpcoll_collreq_t *collreq;
@ -773,7 +776,7 @@ static int bcol_ptpcoll_barrier_recurs_dbl_extra_new(
(mca_bcol_ptpcoll_module_t *) const_args->bcol_module;
ompi_communicator_t *comm = ptp_module->super.sbgp_partner_module->group_comm;
OMPI_FREE_LIST_WAIT_MT(&ptp_module->collreqs_free, item);
item = opal_free_list_wait (&ptp_module->collreqs_free);
if (OPAL_UNLIKELY(NULL == item)) {
PTPCOLL_ERROR(("Free list waiting failed."));
return OMPI_ERR_OUT_OF_RESOURCE;
@ -829,7 +832,7 @@ static int bcol_ptpcoll_barrier_recurs_dbl_extra_new(
return BCOL_FN_STARTED;
}
OMPI_FREE_LIST_RETURN_MT(&ptp_module->collreqs_free, (ompi_free_list_item_t *) collreq);
opal_free_list_return (&ptp_module->collreqs_free, (opal_free_list_item_t *) collreq);
return BCOL_FN_COMPLETE;
}

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -101,7 +104,7 @@ collreq_destruct(mca_bcol_ptpcoll_collreq_t *collreq)
}
OBJ_CLASS_INSTANCE(mca_bcol_ptpcoll_collreq_t,
ompi_free_list_item_t,
opal_free_list_item_t,
collreq_construct,
collreq_destruct);

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2013 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -612,7 +612,7 @@ static int load_recursive_knomial_info(mca_bcol_ptpcoll_module_t *ptpcoll_module
return rc;
}
static void bcol_ptpcoll_collreq_init(ompi_free_list_item_t *item, void* ctx)
static int bcol_ptpcoll_collreq_init(opal_free_list_item_t *item, void* ctx)
{
mca_bcol_ptpcoll_module_t *ptpcoll_module= (mca_bcol_ptpcoll_module_t *) ctx;
mca_bcol_ptpcoll_collreq_t *collreq = (mca_bcol_ptpcoll_collreq_t *) item;
@ -627,6 +627,12 @@ static void bcol_ptpcoll_collreq_init(ompi_free_list_item_t *item, void* ctx)
calloc(2 * ptpcoll_module->k_nomial_radix, sizeof(ompi_request_t *));
break;
}
if (NULL == collreq->requests) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
return OPAL_SUCCESS;
}
/* query to see if the module is available for use on the given
@ -705,18 +711,18 @@ mca_bcol_base_module_t **mca_bcol_ptpcoll_comm_query(mca_sbgp_base_module_t *sbg
}
/* creating collfrag free list */
OBJ_CONSTRUCT(&ptpcoll_module->collreqs_free, ompi_free_list_t);
rc = ompi_free_list_init_ex_new(&ptpcoll_module->collreqs_free,
sizeof(mca_bcol_ptpcoll_collreq_t),
BCOL_PTP_CACHE_LINE_SIZE,
OBJ_CLASS(mca_bcol_ptpcoll_collreq_t),
0, BCOL_PTP_CACHE_LINE_SIZE,
256 /* free_list_num */,
-1 /* free_list_max, -1 = infinite */,
32 /* free_list_inc */,
NULL,
bcol_ptpcoll_collreq_init,
ptpcoll_module);
OBJ_CONSTRUCT(&ptpcoll_module->collreqs_free, opal_free_list_t);
rc = opal_free_list_init (&ptpcoll_module->collreqs_free,
sizeof(mca_bcol_ptpcoll_collreq_t),
BCOL_PTP_CACHE_LINE_SIZE,
OBJ_CLASS(mca_bcol_ptpcoll_collreq_t),
0, BCOL_PTP_CACHE_LINE_SIZE,
256 /* free_list_num */,
-1 /* free_list_max, -1 = infinite */,
32 /* free_list_inc */,
NULL, 0, NULL,
bcol_ptpcoll_collreq_init,
ptpcoll_module);
if (OMPI_SUCCESS != rc) {
goto CLEANUP;
}

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

@ -81,7 +81,7 @@ struct mca_coll_hcoll_component_t {
/* FCA global stuff */
mca_coll_hcoll_ops_t hcoll_ops;
ompi_free_list_t requests;
opal_free_list_t requests;
};
typedef struct mca_coll_hcoll_component_t mca_coll_hcoll_component_t;

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

@ -1,9 +1,12 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -119,8 +122,8 @@ static void init_module_fns(void){
void hcoll_rte_fns_setup(void)
{
init_module_fns();
OBJ_CONSTRUCT(&mca_coll_hcoll_component.requests, ompi_free_list_t);
ompi_free_list_init_ex_new(
OBJ_CONSTRUCT(&mca_coll_hcoll_component.requests, opal_free_list_t);
opal_free_list_init(
&(mca_coll_hcoll_component.requests),
sizeof(ompi_request_t),
/* no special alignment needed */
@ -132,7 +135,9 @@ void hcoll_rte_fns_setup(void)
10,
-1,
10,
/* No Mpool */
/* No Mpool or init function */
NULL,
0,
NULL,
NULL,
NULL
@ -175,7 +180,7 @@ static int recv_nb(struct dte_data_representation_t data,
int rc;
size_t size;
ompi_request_t *ompi_req;
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
if (!buffer && !HCOL_DTE_IS_ZERO(data)) {
fprintf(stderr, "***Error in hcolrte_rml_recv_nb: buffer pointer is NULL"
@ -246,7 +251,6 @@ static int send_nb( dte_data_representation_t data,
int rc;
size_t size;
ompi_request_t *ompi_req;
ompi_free_list_item_t *item;
if (!buffer && !HCOL_DTE_IS_ZERO(data)) {
fprintf(stderr, "***Error in hcolrte_rml_send_nb: buffer pointer is NULL"
" for non DTE_ZERO INLINE data representation\n");
@ -390,8 +394,8 @@ request_free(struct ompi_request_t **ompi_req)
static void* get_coll_handle(void)
{
ompi_request_t *ompi_req;
ompi_free_list_item_t *item;
OMPI_FREE_LIST_WAIT_MT(&(mca_coll_hcoll_component.requests),item);
opal_free_list_item_t *item;
item = opal_free_list_wait (&(mca_coll_hcoll_component.requests));
if (OPAL_UNLIKELY(NULL == item)) {
HCOL_ERROR("Wait for free list failed.\n");
return NULL;
@ -412,8 +416,8 @@ static int coll_handle_test(void* handle)
static void coll_handle_free(void *handle){
ompi_request_t *ompi_req = (ompi_request_t *)handle;
OMPI_FREE_LIST_RETURN_MT(&mca_coll_hcoll_component.requests,
(ompi_free_list_item_t *)ompi_req);
opal_free_list_return (&mca_coll_hcoll_component.requests,
(opal_free_list_item_t *)ompi_req);
}
static void coll_handle_complete(void *handle)

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -69,7 +69,7 @@ BEGIN_C_DECLS
struct ompi_coll_libnbc_component_t {
mca_coll_base_component_2_0_0_t super;
ompi_free_list_t requests;
opal_free_list_t requests;
opal_list_t active_requests;
int32_t active_comms;
opal_atomic_lock_t progress_lock;
@ -123,8 +123,8 @@ typedef ompi_coll_libnbc_request_t NBC_Handle;
#define OMPI_COLL_LIBNBC_REQUEST_ALLOC(comm, req) \
do { \
ompi_free_list_item_t *item; \
OMPI_FREE_LIST_WAIT_MT(&mca_coll_libnbc_component.requests, item); \
opal_free_list_item_t *item; \
item = opal_free_list_wait (&mca_coll_libnbc_component.requests); \
req = (ompi_coll_libnbc_request_t*) item; \
OMPI_REQUEST_INIT(&req->super, false); \
req->super.req_mpi_object.comm = comm; \
@ -135,8 +135,8 @@ typedef ompi_coll_libnbc_request_t NBC_Handle;
#define OMPI_COLL_LIBNBC_REQUEST_RETURN(req) \
do { \
OMPI_REQUEST_FINI(&request->super); \
OMPI_FREE_LIST_RETURN_MT(&mca_coll_libnbc_component.requests, \
(ompi_free_list_item_t*) req); \
opal_free_list_return (&mca_coll_libnbc_component.requests, \
(opal_free_list_item_t*) req); \
} while (0)
int ompi_coll_libnbc_progress(void);

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -87,14 +87,11 @@ libnbc_open(void)
{
int ret;
OBJ_CONSTRUCT(&mca_coll_libnbc_component.requests, ompi_free_list_t);
ret = ompi_free_list_init(&mca_coll_libnbc_component.requests,
sizeof(ompi_coll_libnbc_request_t),
OBJ_CLASS(ompi_coll_libnbc_request_t),
0,
-1,
8,
NULL);
OBJ_CONSTRUCT(&mca_coll_libnbc_component.requests, opal_free_list_t);
ret = opal_free_list_init (&mca_coll_libnbc_component.requests,
sizeof(ompi_coll_libnbc_request_t), 8,
OBJ_CLASS(ompi_coll_libnbc_request_t),
0, 0, 0, -1, 8, NULL, 0, NULL, NULL, NULL);
if (OMPI_SUCCESS != ret) return ret;
OBJ_CONSTRUCT(&mca_coll_libnbc_component.active_requests, opal_list_t);

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -29,7 +29,7 @@
#include "ompi/mca/bcol/bcol.h"
#include "ompi/mca/sbgp/sbgp.h"
#include "ompi/op/op.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "coll_ml_lmngr.h"
#include "coll_ml_functions.h"
@ -652,10 +652,10 @@ struct mca_coll_ml_module_t {
int32_t collective_sequence_num;
/** ompi free list of full message descriptors **/
ompi_free_list_t message_descriptors;
opal_free_list_t message_descriptors;
/** ompi free list of message fragment descriptors **/
ompi_free_list_t fragment_descriptors;
opal_free_list_t fragment_descriptors;
/** pointer to the payload memory block **/
struct mca_bcol_base_memory_block_desc_t *payload_block;
@ -672,7 +672,7 @@ struct mca_coll_ml_module_t {
/** collective operation descriptor free list - used to manage a single
* collective operation. */
ompi_free_list_t coll_ml_collective_descriptors;
opal_free_list_t coll_ml_collective_descriptors;
/** multiple function collective operation support */
/** broadcast */

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

@ -1,9 +1,12 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,7 +38,7 @@ static void mca_coll_ml_barrier_task_setup(
static int mca_coll_ml_barrier_launch(mca_coll_ml_module_t *ml_module,
ompi_request_t **req)
{
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_coll_ml_collective_operation_progress_t *coll_op;
mca_bcol_base_payload_buffer_desc_t *src_buffer_desc = NULL;
@ -49,8 +52,7 @@ static int mca_coll_ml_barrier_launch(mca_coll_ml_module_t *ml_module,
/* Blocking call on fragment allocation (Maybe we want to make it non blocking ?) */
OMPI_FREE_LIST_WAIT_MT(&(ml_module->coll_ml_collective_descriptors),
item);
item = opal_free_list_wait (&(ml_module->coll_ml_collective_descriptors));
coll_op = (mca_coll_ml_collective_operation_progress_t *) item;
assert(NULL != coll_op);

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -417,10 +417,10 @@ do {
struct ompi_communicator_t *comm = GET_COMM(op); \
bool is_coll_sync = IS_COLL_SYNCMEM(op); \
ML_VERBOSE(10, ("Releasing %p", op)); \
OMPI_REQUEST_FINI(&(op)->full_message.super); \
OMPI_FREE_LIST_RETURN_MT(&(((mca_coll_ml_module_t *)(op)->coll_module)-> \
coll_ml_collective_descriptors), \
(ompi_free_list_item_t *)op); \
OMPI_REQUEST_FINI(&(op)->full_message.super); \
opal_free_list_return (&(((mca_coll_ml_module_t *)(op)->coll_module)-> \
coll_ml_collective_descriptors), \
(opal_free_list_item_t *)op); \
/* Special check for memory synchronization completion */ \
/* We have to return it first to free list, since the communicator */ \
/* release potentially may trigger ML module distraction and having */ \

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -17,10 +17,10 @@
#include "ompi/mca/coll/ml/coll_ml_allocation.h"
/* collective managment descriptor initialization - called right after
* the constructor by ompi_free_list code
* the constructor by opal_free_list code
*/
static void mca_coll_ml_collective_operation_progress_init
(ompi_free_list_item_t* item, void* ctx)
(opal_free_list_item_t* item, void* ctx)
{
int i;
int max_dag_size = ((struct coll_desc_init *)ctx)->max_dag_size;
@ -161,7 +161,7 @@ int ml_coll_schedule_setup(mca_coll_ml_module_t *ml_module)
ml_module->coll_desc_init_data.bcol_base_module=(mca_coll_base_module_t *)
ml_module;
ret = ompi_free_list_init_ex_new(
ret = opal_free_list_init (
&(ml_module->coll_ml_collective_descriptors),
sizeof(mca_coll_ml_collective_operation_progress_t),
/* no special alignment needed */
@ -174,7 +174,7 @@ int ml_coll_schedule_setup(mca_coll_ml_module_t *ml_module)
cm->free_list_max_size,
cm->free_list_grow_size,
/* No Mpool */
NULL,
NULL, 0, NULL,
mca_coll_ml_collective_operation_progress_init,
(void *)&(ml_module->coll_desc_init_data)
);

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

@ -5,6 +5,8 @@
* Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -468,13 +470,12 @@ mca_coll_ml_alloc_op_prog_single_frag_dag(
size_t offset_into_user_buffer
)
{
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_coll_ml_collective_operation_progress_t *coll_op = NULL;
ompi_request_t *req;
/* Blocking call on fragment allocation (Maybe we want to make it non blocking ?) */
OMPI_FREE_LIST_WAIT_MT(&(ml_module->coll_ml_collective_descriptors),
item);
item = opal_free_list_wait (&(ml_module->coll_ml_collective_descriptors));
coll_op = (mca_coll_ml_collective_operation_progress_t *) item;
ML_VERBOSE(10, (">>> Allocating coll op %p", coll_op));
@ -529,12 +530,11 @@ static inline __opal_attribute_always_inline__ mca_coll_ml_collective_operation_
size_t offset_into_user_buffer
)
{
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_coll_ml_collective_operation_progress_t *coll_op = NULL;
/* Blocking call on fragment allocation (Maybe we want to make it non blocking ?) */
OMPI_FREE_LIST_WAIT_MT(&(ml_module->coll_ml_collective_descriptors),
item);
item = opal_free_list_wait (&(ml_module->coll_ml_collective_descriptors));
coll_op = (mca_coll_ml_collective_operation_progress_t *) item;

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

@ -2,7 +2,7 @@
/*
* Copyright (c) 2009-2013 Oak Ridge National Laboratory. All rights reserved.
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
@ -120,9 +120,9 @@ mca_coll_ml_module_construct(mca_coll_ml_module_t *module)
OBJ_CONSTRUCT(&module->active_bcols_list, opal_list_t);
OBJ_CONSTRUCT(&module->waiting_for_memory_list, opal_list_t);
OBJ_CONSTRUCT(&module->fragment_descriptors, ompi_free_list_t);
OBJ_CONSTRUCT(&module->message_descriptors, ompi_free_list_t);
OBJ_CONSTRUCT(&module->coll_ml_collective_descriptors, ompi_free_list_t);
OBJ_CONSTRUCT(&module->fragment_descriptors, opal_free_list_t);
OBJ_CONSTRUCT(&module->message_descriptors, opal_free_list_t);
OBJ_CONSTRUCT(&module->coll_ml_collective_descriptors, opal_free_list_t);
memset (&module->fallback, 0, sizeof (module->fallback));
}
@ -260,8 +260,8 @@ static int mca_coll_ml_request_free(ompi_request_t** request)
ML_VERBOSE(10, ("Releasing Master %p", ml_request));
/* Mark the request as invalid */
OMPI_REQUEST_FINI(&ml_request->full_message.super);
OMPI_FREE_LIST_RETURN_MT(&(ml_module->coll_ml_collective_descriptors),
(ompi_free_list_item_t *)ml_request);
opal_free_list_return (&(ml_module->coll_ml_collective_descriptors),
(opal_free_list_item_t *)ml_request);
/* MPI needs to return with the request object set to MPI_REQUEST_NULL
*/
@ -326,20 +326,20 @@ static void mca_coll_ml_collective_operation_progress_destruct
/* initialize the full message descriptor - can pass in module specific
* initialization data
*/
static void init_ml_fragment_desc(ompi_free_list_item_t *desc , void* ctx);
static void init_ml_message_desc(ompi_free_list_item_t *desc , void* ctx)
static void init_ml_fragment_desc(opal_free_list_item_t *desc , void* ctx);
static void init_ml_message_desc(opal_free_list_item_t *desc , void* ctx)
{
mca_coll_ml_module_t *module= (mca_coll_ml_module_t *) ctx;
mca_coll_ml_descriptor_t *msg_desc = (mca_coll_ml_descriptor_t *) desc;
/* finish setting up the fragment descriptor */
init_ml_fragment_desc((ompi_free_list_item_t*)&(msg_desc->fragment),module);
init_ml_fragment_desc((opal_free_list_item_t*)&(msg_desc->fragment),module);
}
/* initialize the fragment descriptor - can pass in module specific
* initialization data
*/
static void init_ml_fragment_desc(ompi_free_list_item_t *desc , void* ctx)
static void init_ml_fragment_desc(opal_free_list_item_t *desc , void* ctx)
{
mca_coll_ml_module_t *module= (mca_coll_ml_module_t *) ctx;
mca_coll_ml_fragment_t *frag_desc = (mca_coll_ml_fragment_t *) desc;
@ -2614,14 +2614,14 @@ static int init_lists(mca_coll_ml_module_t *ml_module)
/* no data associated with the message descriptor */
length = sizeof(mca_coll_ml_descriptor_t);
ret = ompi_free_list_init_ex_new(&(ml_module->message_descriptors), length,
opal_cache_line_size, OBJ_CLASS(mca_coll_ml_descriptor_t),
length_payload, 0,
num_elements, max_elements, elements_per_alloc,
NULL,
init_ml_message_desc, ml_module);
ret = opal_free_list_init(&(ml_module->message_descriptors), length,
opal_cache_line_size, OBJ_CLASS(mca_coll_ml_descriptor_t),
length_payload, 0,
num_elements, max_elements, elements_per_alloc,
NULL, 0, NULL,
init_ml_message_desc, ml_module);
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
ML_ERROR(("ompi_free_list_init_ex_new exit with error"));
ML_ERROR(("opal_free_list_init exit with error"));
return ret;
}
@ -2632,14 +2632,14 @@ static int init_lists(mca_coll_ml_module_t *ml_module)
/* create a free list of fragment descriptors */
/*length_payload=sizeof(something);*/
length = sizeof(mca_coll_ml_fragment_t);
ret = ompi_free_list_init_ex_new(&(ml_module->fragment_descriptors), length,
opal_cache_line_size, OBJ_CLASS(mca_coll_ml_fragment_t),
length_payload, 0,
num_elements, max_elements, elements_per_alloc,
NULL,
init_ml_fragment_desc, ml_module);
ret = opal_free_list_init (&(ml_module->fragment_descriptors), length,
opal_cache_line_size, OBJ_CLASS(mca_coll_ml_fragment_t),
length_payload, 0,
num_elements, max_elements, elements_per_alloc,
NULL, 0, NULL,
init_ml_fragment_desc, ml_module);
if (OMPI_SUCCESS != ret) {
ML_ERROR(("ompi_free_list_init_ex_new exit with error"));
ML_ERROR(("opal_free_list_init exit with error"));
return ret;
}

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -42,7 +45,7 @@ struct mca_coll_portals4_component_t {
ptl_handle_md_t md_h;
#endif
ompi_free_list_t requests; /* request free list for the i collectives */
opal_free_list_t requests; /* request free list for the i collectives */
};
typedef struct mca_coll_portals4_component_t mca_coll_portals4_component_t;
OMPI_MODULE_DECLSPEC extern mca_coll_portals4_component_t mca_coll_portals4_component;

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -11,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -110,17 +113,14 @@ portals4_open(void)
mca_coll_portals4_component.md_h = PTL_INVALID_HANDLE;
#endif
OBJ_CONSTRUCT(&mca_coll_portals4_component.requests, ompi_free_list_t);
ret = ompi_free_list_init(&mca_coll_portals4_component.requests,
sizeof(ompi_coll_portals4_request_t),
OBJ_CLASS(ompi_coll_portals4_request_t),
8,
0,
8,
NULL);
OBJ_CONSTRUCT(&mca_coll_portals4_component.requests, opal_free_list_t);
ret = opal_free_list_init (&mca_coll_portals4_component.requests,
sizeof(ompi_coll_portals4_request_t),
OBJ_CLASS(ompi_coll_portals4_request_t),
0, 0, 8, 0, 8, NULL, 0, NULL, NULL, NULL);
if (OMPI_SUCCESS != ret) {
opal_output_verbose(1, ompi_coll_base_framework.framework_output,
"%s:%d: ompi_free_list_init failed: %d\n",
"%s:%d: opal_free_list_init failed: %d\n",
__FILE__, __LINE__, ret);
return ret;
}

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -29,9 +32,8 @@ OBJ_CLASS_DECLARATION(ompi_coll_portals4_request_t);
#define OMPI_COLL_PORTALS4_REQUEST_ALLOC(comm, req) \
do { \
ompi_free_list_item_t *item; \
OMPI_FREE_LIST_GET_MT(&mca_coll_portals4_component.requests, \
item); \
opal_free_list_item_t *item; \
item = opal_free_list_get (&mca_coll_portals4_component.requests); \
req = (ompi_coll_portals4_request_t*) item; \
OMPI_REQUEST_INIT(&req->super, false); \
req->super.req_mpi_object.comm = comm; \
@ -42,8 +44,8 @@ OBJ_CLASS_DECLARATION(ompi_coll_portals4_request_t);
#define OMPI_COLL_PORTALS4_REQUEST_RETURN(req) \
do { \
OMPI_REQUEST_FINI(&request->super); \
OMPI_FREE_LIST_RETURN_MT(&mca_coll_portals4_component.requests, \
(ompi_free_list_item_t*) req); \
opal_free_list_return (&mca_coll_portals4_component.requests, \
(opal_free_list_item_t*) req); \
} while (0)

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University.
* All rights reserved.
@ -7,6 +8,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -50,13 +53,13 @@
* Object stuff
******************/
OBJ_CLASS_INSTANCE(ompi_crcp_base_pml_state_t,
ompi_free_list_item_t,
opal_free_list_item_t,
NULL,
NULL
);
OBJ_CLASS_INSTANCE(ompi_crcp_base_btl_state_t,
ompi_free_list_item_t,
opal_free_list_item_t,
NULL,
NULL
);

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2011 The Trustees of Indiana University.
* All rights reserved.
@ -5,8 +6,8 @@
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -41,7 +42,7 @@
#include "ompi/mca/crcp/crcp.h"
#include "ompi/mca/crcp/base/base.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "ompi/runtime/ompi_cr.h"
#include "orte/runtime/orte_wait.h"
@ -106,12 +107,12 @@ opal_list_t drained_msg_ack_list;
/*
* Free lists
*/
ompi_free_list_t coord_state_free_list;
ompi_free_list_t content_ref_free_list;
ompi_free_list_t peer_ref_free_list;
ompi_free_list_t traffic_msg_ref_free_list;
ompi_free_list_t drain_msg_ref_free_list;
ompi_free_list_t drain_ack_msg_ref_free_list;
opal_free_list_t coord_state_free_list;
opal_free_list_t content_ref_free_list;
opal_free_list_t peer_ref_free_list;
opal_free_list_t traffic_msg_ref_free_list;
opal_free_list_t drain_msg_ref_free_list;
opal_free_list_t drain_ack_msg_ref_free_list;
/*
* Quiescence requests to wait on
@ -618,74 +619,69 @@ static void traffic_message_dump_drain_msg_indv(ompi_crcp_bkmrk_pml_drain_messag
*/
#define HOKE_PEER_REF_ALLOC(peer_ref) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&peer_ref_free_list, item); \
peer_ref = (ompi_crcp_bkmrk_pml_peer_ref_t*)item; \
} while(0);
peer_ref = (ompi_crcp_bkmrk_pml_peer_ref_t *) \
opal_free_list_wait (&peer_ref_free_list); \
} while(0)
#define HOKE_PEER_REF_RETURN(peer_ref) \
do { \
OMPI_FREE_LIST_RETURN_MT(&peer_ref_free_list, \
(ompi_free_list_item_t*)peer_ref); \
} while(0);
#define HOKE_PEER_REF_RETURN(peer_ref) \
do { \
opal_free_list_return (&peer_ref_free_list, \
(opal_free_list_item_t*)peer_ref); \
} while(0)
#define HOKE_CONTENT_REF_ALLOC(content_ref) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&content_ref_free_list, item); \
content_ref = (ompi_crcp_bkmrk_pml_message_content_ref_t*)item; \
content_ref->msg_id = content_ref_seq_num; \
content_ref_seq_num++;\
} while(0);
content_ref = (ompi_crcp_bkmrk_pml_message_content_ref_t*) \
opal_free_list_wait (&content_ref_free_list); \
content_ref->msg_id = content_ref_seq_num; \
content_ref_seq_num++; \
} while(0)
#define HOKE_CONTENT_REF_RETURN(content_ref) \
do { \
OMPI_FREE_LIST_RETURN_MT(&content_ref_free_list, \
(ompi_free_list_item_t*)content_ref); \
} while(0);
#define HOKE_CONTENT_REF_RETURN(content_ref) \
do { \
opal_free_list_return (&content_ref_free_list, \
(opal_free_list_item_t*)content_ref); \
} while(0)
#define HOKE_TRAFFIC_MSG_REF_ALLOC(msg_ref) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&traffic_msg_ref_free_list, item); \
msg_ref = (ompi_crcp_bkmrk_pml_traffic_message_ref_t*)item; \
} while(0);
msg_ref = (ompi_crcp_bkmrk_pml_traffic_message_ref_t*) \
opal_free_list_wait (&traffic_msg_ref_free_list); \
} while(0)
#define HOKE_TRAFFIC_MSG_REF_RETURN(msg_ref) \
do { \
OMPI_FREE_LIST_RETURN_MT(&traffic_msg_ref_free_list, \
(ompi_free_list_item_t*)msg_ref); \
} while(0);
#define HOKE_TRAFFIC_MSG_REF_RETURN(msg_ref) \
do { \
opal_free_list_return (&traffic_msg_ref_free_list, \
(opal_free_list_item_t*)msg_ref); \
} while(0)
#define HOKE_DRAIN_MSG_REF_ALLOC(msg_ref) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&drain_msg_ref_free_list, item); \
msg_ref = (ompi_crcp_bkmrk_pml_drain_message_ref_t*)item; \
} while(0);
#define HOKE_DRAIN_MSG_REF_ALLOC(msg_ref) \
do { \
msg_ref = (ompi_crcp_bkmrk_pml_drain_message_ref_t *) \
opal_free_list_wait (&drain_msg_ref_free_list); \
} while(0)
#define HOKE_DRAIN_MSG_REF_RETURN(msg_ref) \
do { \
OMPI_FREE_LIST_RETURN_MT(&drain_msg_ref_free_list, \
(ompi_free_list_item_t*)msg_ref); \
} while(0);
#define HOKE_DRAIN_MSG_REF_RETURN(msg_ref) \
do { \
opal_free_list_return (&drain_msg_ref_free_list, \
(opal_free_list_item_t*)msg_ref); \
} while(0)
#define HOKE_DRAIN_ACK_MSG_REF_ALLOC(msg_ref) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&drain_ack_msg_ref_free_list, item); \
msg_ref = (ompi_crcp_bkmrk_pml_drain_message_ack_ref_t*)item; \
} while(0);
msg_ref = (ompi_crcp_bkmrk_pml_drain_message_ack_ref_t *) \
opal_free_list_wait (&drain_ack_msg_ref_free_list); \
} while(0)
#define HOKE_DRAIN_ACK_MSG_REF_RETURN(msg_ref) \
do { \
OMPI_FREE_LIST_RETURN_MT(&drain_ack_msg_ref_free_list, \
(ompi_free_list_item_t*)msg_ref); \
} while(0);
#define HOKE_DRAIN_ACK_MSG_REF_RETURN(msg_ref) \
do { \
opal_free_list_return (&drain_ack_msg_ref_free_list, \
(opal_free_list_item_t*)msg_ref); \
} while(0)
/*
@ -967,18 +963,17 @@ OBJ_CLASS_INSTANCE(ompi_crcp_bkmrk_pml_state_t,
/************************************
* Some Macro shortcuts
************************************/
#define CRCP_COORD_STATE_ALLOC(state_ref) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&coord_state_free_list, item); \
state_ref = (ompi_crcp_bkmrk_pml_state_t*)item; \
} while(0);
#define CRCP_COORD_STATE_ALLOC(state_ref) \
do { \
state_ref = (ompi_crcp_bkmrk_pml_state_t *) \
opal_free_list_wait (&coord_state_free_list); \
} while(0)
#define CRCP_COORD_STATE_RETURN(state_ref) \
do { \
OMPI_FREE_LIST_RETURN_MT(&coord_state_free_list, \
(ompi_free_list_item_t*)state_ref); \
} while(0);
#define CRCP_COORD_STATE_RETURN(state_ref) \
do { \
opal_free_list_return (&coord_state_free_list, \
(opal_free_list_item_t *)state_ref); \
} while(0)
#define CREATE_COORD_STATE(coord_state, pml_state, v_peer_ref, v_msg_ref) \
{ \
@ -1100,71 +1095,71 @@ int ompi_crcp_bkmrk_pml_init(void) {
* - Drain ACK Messsage Refs
* - Message Contents?
*/
OBJ_CONSTRUCT(&coord_state_free_list, ompi_free_list_t);
ompi_free_list_init_new( &coord_state_free_list,
sizeof(ompi_crcp_bkmrk_pml_state_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_state_t),
0,opal_cache_line_size,
4, /* Initial number */
-1, /* Max = Unlimited */
4, /* Increment by */
NULL);
OBJ_CONSTRUCT(&coord_state_free_list, opal_free_list_t);
opal_free_list_init (&coord_state_free_list,
sizeof(ompi_crcp_bkmrk_pml_state_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_state_t),
0,opal_cache_line_size,
4, /* Initial number */
-1, /* Max = Unlimited */
4, /* Increment by */
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&content_ref_free_list, ompi_free_list_t);
ompi_free_list_init_new( &content_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_message_content_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_message_content_ref_t),
0,opal_cache_line_size,
80, /* Initial number */
-1, /* Max = Unlimited */
32, /* Increment by */
NULL);
OBJ_CONSTRUCT(&content_ref_free_list, opal_free_list_t);
opal_free_list_init (&content_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_message_content_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_message_content_ref_t),
0,opal_cache_line_size,
80, /* Initial number */
-1, /* Max = Unlimited */
32, /* Increment by */
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&peer_ref_free_list, ompi_free_list_t);
ompi_free_list_init_new( &peer_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_peer_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_peer_ref_t),
0,opal_cache_line_size,
16, /* Initial number */
-1, /* Max = Unlimited */
16, /* Increment by */
NULL);
OBJ_CONSTRUCT(&peer_ref_free_list, opal_free_list_t);
opal_free_list_init (&peer_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_peer_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_peer_ref_t),
0,opal_cache_line_size,
16, /* Initial number */
-1, /* Max = Unlimited */
16, /* Increment by */
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&traffic_msg_ref_free_list, ompi_free_list_t);
ompi_free_list_init_new( &traffic_msg_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_traffic_message_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_traffic_message_ref_t),
0,opal_cache_line_size,
32, /* Initial number */
-1, /* Max = Unlimited */
64, /* Increment by */
NULL);
OBJ_CONSTRUCT(&traffic_msg_ref_free_list, opal_free_list_t);
opal_free_list_init (&traffic_msg_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_traffic_message_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_traffic_message_ref_t),
0,opal_cache_line_size,
32, /* Initial number */
-1, /* Max = Unlimited */
64, /* Increment by */
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&drain_msg_ref_free_list, ompi_free_list_t);
ompi_free_list_init_new( &drain_msg_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_drain_message_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_drain_message_ref_t),
0,opal_cache_line_size,
32, /* Initial number */
-1, /* Max = Unlimited */
64, /* Increment by */
NULL);
OBJ_CONSTRUCT(&drain_msg_ref_free_list, opal_free_list_t);
opal_free_list_init (&drain_msg_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_drain_message_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_drain_message_ref_t),
0,opal_cache_line_size,
32, /* Initial number */
-1, /* Max = Unlimited */
64, /* Increment by */
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&drain_ack_msg_ref_free_list, ompi_free_list_t);
ompi_free_list_init_new( &drain_ack_msg_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_drain_message_ack_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_drain_message_ack_ref_t),
0,opal_cache_line_size,
16, /* Initial number */
-1, /* Max = Unlimited */
16, /* Increment by */
NULL);
OBJ_CONSTRUCT(&drain_ack_msg_ref_free_list, opal_free_list_t);
opal_free_list_init (&drain_ack_msg_ref_free_list,
sizeof(ompi_crcp_bkmrk_pml_drain_message_ack_ref_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_bkmrk_pml_drain_message_ack_ref_t),
0,opal_cache_line_size,
16, /* Initial number */
-1, /* Max = Unlimited */
16, /* Increment by */
NULL, 0, NULL, NULL, NULL);
clear_timers();

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -34,7 +37,7 @@
#include "opal/mca/crs/base/base.h"
#include "opal/mca/btl/btl.h"
#include "opal/mca/btl/base/base.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "ompi/datatype/ompi_datatype.h"
#include "ompi/request/request.h"
@ -91,7 +94,7 @@ enum ompi_crcp_base_pml_states_t {
typedef enum ompi_crcp_base_pml_states_t ompi_crcp_base_pml_states_t;
struct ompi_crcp_base_pml_state_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
ompi_crcp_base_pml_states_t state;
int error_code;
mca_pml_base_component_t *wrapped_pml_component;
@ -183,7 +186,7 @@ enum ompi_crcp_base_btl_states_t {
typedef enum ompi_crcp_base_btl_states_t ompi_crcp_base_btl_states_t;
struct ompi_crcp_base_btl_state_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
ompi_crcp_base_btl_states_t state;
int error_code;
mca_btl_base_descriptor_t* des;

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -21,7 +24,6 @@
#include "ompi_config.h"
#include <stdio.h>
#include "opal/class/ompi_free_list.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2011 University of Houston. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -21,7 +24,6 @@
#include "ompi_config.h"
#include <stdio.h>
#include "opal/class/ompi_free_list.h"
#include "opal/mca/mca.h"
#include "opal/mca/base/base.h"

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

@ -1,8 +1,11 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) 2001-2011 Mellanox Technologies Ltd. ALL RIGHTS RESERVED.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -657,6 +660,6 @@ static void ompi_mtl_mxm_mem_release_cb(void *buf, size_t length,
OBJ_CLASS_INSTANCE(
ompi_mtl_mxm_message_t,
ompi_free_list_item_t,
opal_free_list_item_t,
NULL,
NULL);

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -30,7 +33,7 @@
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/mtl/mtl.h"
#include "ompi/mca/mtl/base/base.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "opal/util/output.h"
#include "opal/util/show_help.h"
@ -96,7 +99,7 @@ extern int ompi_mtl_mxm_finalize(struct mca_mtl_base_module_t* mtl);
int ompi_mtl_mxm_module_init(void);
struct ompi_mtl_mxm_message_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
mxm_mq_h mq;
mxm_conn_h conn;

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
@ -240,16 +241,16 @@ static int ompi_mtl_mxm_component_open(void)
return OPAL_ERR_NOT_AVAILABLE;
}
OBJ_CONSTRUCT(&mca_mtl_mxm_component.mxm_messages, ompi_free_list_t);
rc = ompi_free_list_init_new(&mca_mtl_mxm_component.mxm_messages,
sizeof(ompi_mtl_mxm_message_t),
opal_cache_line_size,
OBJ_CLASS(ompi_mtl_mxm_message_t),
0, opal_cache_line_size,
32 /* free list num */,
-1 /* free list max */,
32 /* free list inc */,
NULL);
OBJ_CONSTRUCT(&mca_mtl_mxm_component.mxm_messages, opal_free_list_t);
rc = opal_free_list_init (&mca_mtl_mxm_component.mxm_messages,
sizeof(ompi_mtl_mxm_message_t),
opal_cache_line_size,
OBJ_CLASS(ompi_mtl_mxm_message_t),
0, opal_cache_line_size,
32 /* free list num */,
-1 /* free list max */,
32 /* free list inc */,
NULL, 0, NULL, NULL, NULL);
if (OMPI_SUCCESS != rc) {
opal_show_help("help-mtl-mxm.txt", "mxm init", true,
mxm_error_string(err));

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

@ -1,8 +1,11 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -57,10 +60,10 @@ int ompi_mtl_mxm_improbe(struct mca_mtl_base_module_t *mtl,
mxm_error_t err;
mxm_recv_req_t req;
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
ompi_mtl_mxm_message_t *msgp;
OMPI_FREE_LIST_WAIT_MT(&mca_mtl_mxm_component.mxm_messages, item);
item = opal_free_list_wait (&mca_mtl_mxm_component.mxm_messages);
if (OPAL_UNLIKELY(NULL == item)) {
return OMPI_ERR_OUT_OF_RESOURCE;
}

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -185,8 +188,8 @@ int ompi_mtl_mxm_imrecv(struct mca_mtl_base_module_t* mtl,
return OMPI_ERROR;
}
OMPI_FREE_LIST_RETURN_MT(&mca_mtl_mxm_component.mxm_messages,
(ompi_free_list_item_t *) msgp);
msgp = (ompi_mtl_mxm_message_t *)
opal_free_list_wait (&mca_mtl_mxm_component.mxm_messages);
ompi_message_return(*message);
(*message) = MPI_MESSAGE_NULL;

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -54,7 +57,7 @@ extern mca_mtl_mxm_module_t ompi_mtl_mxm;
typedef struct mca_mtl_mxm_component_t {
mca_mtl_base_component_2_0_0_t super; /**< base MTL component */
ompi_free_list_t mxm_messages; /* will be used for MPI_Mprobe and MPI_Mrecv calls */
opal_free_list_t mxm_messages; /* will be used for MPI_Mprobe and MPI_Mrecv calls */
} mca_mtl_mxm_component_t;

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

@ -92,9 +92,9 @@ ompi_mtl_ofi_component_open(void)
OBJ_CONSTRUCT(&ompi_mtl_ofi.free_messages, opal_free_list_t);
opal_free_list_init(&ompi_mtl_ofi.free_messages,
sizeof(ompi_mtl_ofi_message_t),
OBJ_CLASS(ompi_mtl_ofi_message_t),
1, -1, 1);
sizeof(ompi_mtl_ofi_message_t), 8,
OBJ_CLASS(ompi_mtl_ofi_message_t), 0, 0,
1, -1, 1, NULL, 0, NULL, NULL, NULL);
ompi_mtl_ofi.domain = NULL;
ompi_mtl_ofi.av = NULL;

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
*
* $COPYRIGHT$
*
@ -26,13 +29,10 @@ OBJ_CLASS_DECLARATION(ompi_mtl_ofi_message_t);
static inline ompi_mtl_ofi_message_t*
ompi_mtl_ofi_message_alloc(const struct fi_cq_tagged_entry *wc)
{
int rc __opal_attribute_unused__;
opal_free_list_item_t *tmp;
ompi_mtl_ofi_message_t *message;
OPAL_FREE_LIST_GET(&ompi_mtl_ofi.free_messages,
tmp,
rc);
tmp = opal_free_list_get (&ompi_mtl_ofi.free_messages);
if (NULL == tmp) return NULL;
message = (ompi_mtl_ofi_message_t*) tmp;
@ -45,8 +45,8 @@ ompi_mtl_ofi_message_alloc(const struct fi_cq_tagged_entry *wc)
static inline void
ompi_mtl_ofi_message_free(ompi_mtl_ofi_message_t *message)
{
OPAL_FREE_LIST_RETURN(&ompi_mtl_ofi.free_messages,
&message->super);
opal_free_list_return (&ompi_mtl_ofi.free_messages,
&message->super);
}
#endif

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -204,7 +205,7 @@ ompi_mtl_portals4_component_open(void)
sizeof(ompi_mtl_portals4_message_t) +
ompi_mtl_portals4.eager_limit,
OBJ_CLASS(ompi_mtl_portals4_message_t),
1, -1, 1);
0, 0, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
ompi_mtl_portals4.ni_h = PTL_INVALID_HANDLE;
ompi_mtl_portals4.send_eq_h = PTL_INVALID_HANDLE;

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -41,7 +44,7 @@ ompi_mtl_portals4_flowctl_init(void)
opal_free_list_init(&ompi_mtl_portals4.flowctl.pending_fl,
sizeof(ompi_mtl_portals4_pending_request_t),
OBJ_CLASS(ompi_mtl_portals4_pending_request_t),
1, -1, 1);
0, 0, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
ompi_mtl_portals4.flowctl.max_send_slots = (ompi_mtl_portals4.send_queue_size - 3) / 3;
ompi_mtl_portals4.flowctl.send_slots = ompi_mtl_portals4.flowctl.max_send_slots;

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -22,13 +25,10 @@ OBJ_CLASS_DECLARATION(ompi_mtl_portals4_message_t);
static inline ompi_mtl_portals4_message_t*
ompi_mtl_portals4_message_alloc(const ptl_event_t *ev)
{
int rc __opal_attribute_unused__;
opal_free_list_item_t *tmp;
ompi_mtl_portals4_message_t* message;
OPAL_FREE_LIST_GET(&ompi_mtl_portals4.fl_message,
tmp,
rc);
tmp = opal_free_list_get (&ompi_mtl_portals4.fl_message);
if (NULL == tmp) return NULL;
message = (ompi_mtl_portals4_message_t*) tmp;
@ -51,8 +51,8 @@ ompi_mtl_portals4_message_alloc(const ptl_event_t *ev)
static inline void
ompi_mtl_portals4_message_free(ompi_mtl_portals4_message_t *message)
{
OPAL_FREE_LIST_RETURN(&ompi_mtl_portals4.fl_message,
&message->super);
opal_free_list_return (&ompi_mtl_portals4.fl_message,
&message->super);
}
#endif

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -118,8 +121,8 @@ ompi_mtl_portals4_callback(ptl_event_t *ev,
*complete = true;
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
OPAL_THREAD_ADD32(&ompi_mtl_portals4.flowctl.send_slots, 1);
OPAL_FREE_LIST_RETURN(&ompi_mtl_portals4.flowctl.pending_fl,
&ptl_request->pending->super);
opal_free_list_return (&ompi_mtl_portals4.flowctl.pending_fl,
&ptl_request->pending->super);
if (OPAL_UNLIKELY(0 != opal_list_get_size(&ompi_mtl_portals4.flowctl.pending_sends))) {
ompi_mtl_portals4_pending_list_progress();
@ -423,7 +426,7 @@ ompi_mtl_portals4_send_start(struct mca_mtl_base_module_t* mtl,
(int)length));
#if OMPI_MTL_PORTALS4_FLOW_CONTROL
OPAL_FREE_LIST_GET(&ompi_mtl_portals4.flowctl.pending_fl, item, ret);
item = opal_free_list_get (&ompi_mtl_portals4.flowctl.pending_fl);
if (NULL == item) return OMPI_ERR_OUT_OF_RESOURCE;
pending = (ompi_mtl_portals4_pending_request_t*) item;

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011-2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -45,7 +48,7 @@ struct ompi_osc_portals4_component_t {
ptl_size_t matching_fetch_atomic_max;
ptl_size_t matching_atomic_ordered_size;
ompi_free_list_t requests; /* request free list for the r* communication variants */
opal_free_list_t requests; /* request free list for the r* communication variants */
};
typedef struct ompi_osc_portals4_component_t ompi_osc_portals4_component_t;
OMPI_DECLSPEC extern ompi_osc_portals4_component_t mca_osc_portals4_component;

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011-2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -314,17 +317,14 @@ component_init(bool enable_progress_threads, bool enable_mpi_threads)
return ret;
}
OBJ_CONSTRUCT(&mca_osc_portals4_component.requests, ompi_free_list_t);
ret = ompi_free_list_init(&mca_osc_portals4_component.requests,
sizeof(ompi_osc_portals4_request_t),
OBJ_CLASS(ompi_osc_portals4_request_t),
8,
0,
8,
NULL);
OBJ_CONSTRUCT(&mca_osc_portals4_component.requests, opal_free_list_t);
ret = opal_free_list_init (&mca_osc_portals4_component.requests,
sizeof(ompi_osc_portals4_request_t),
OBJ_CLASS(ompi_osc_portals4_request_t),
0, 0, 8, 0, 8, NULL, 0, NULL, NULL, NULL);
if (OMPI_SUCCESS != ret) {
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
"%s:%d: ompi_free_list_init failed: %d\n",
"%s:%d: opal_free_list_init failed: %d\n",
__FILE__, __LINE__, ret);
return ret;
}

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011-2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -21,11 +24,10 @@ typedef struct ompi_osc_portals4_request_t ompi_osc_portals4_request_t;
OBJ_CLASS_DECLARATION(ompi_osc_portals4_request_t);
#define OMPI_OSC_PORTALS4_REQUEST_ALLOC(win, req) \
#define OMPI_OSC_PORTALS4_REQUEST_ALLOC(win, req) \
do { \
ompi_free_list_item_t *item; \
OMPI_FREE_LIST_WAIT_MT(&mca_osc_portals4_component.requests, \
item); \
opal_free_list_item_t *item; \
item = opal_free_list_wait(&mca_osc_portals4_component.requests); \
req = (ompi_osc_portals4_request_t*) item; \
OMPI_REQUEST_INIT(&req->super, false); \
req->super.req_mpi_object.win = win; \
@ -38,8 +40,8 @@ OBJ_CLASS_DECLARATION(ompi_osc_portals4_request_t);
#define OMPI_OSC_PORTALS4_REQUEST_RETURN(req) \
do { \
OMPI_REQUEST_FINI(&request->super); \
OMPI_FREE_LIST_RETURN_MT(&mca_osc_portals4_component.requests, \
(ompi_free_list_item_t*) req); \
opal_free_list_return (&mca_osc_portals4_component.requests, \
(opal_free_list_item_t*) req); \
} while (0)

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

@ -8,7 +8,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
@ -59,10 +59,10 @@ struct ompi_osc_pt2pt_component_t {
int module_count;
/** free list of ompi_osc_pt2pt_frag_t structures */
ompi_free_list_t frags;
opal_free_list_t frags;
/** Free list of requests */
ompi_free_list_t requests;
opal_free_list_t requests;
/** PT2PT component buffer size */
unsigned int buffer_size;

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

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2008 University of Houston. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
@ -254,28 +254,28 @@ component_init(bool enable_progress_threads,
mca_osc_pt2pt_component.progress_enable = false;
mca_osc_pt2pt_component.module_count = 0;
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.frags, ompi_free_list_t);
ret = ompi_free_list_init_new (&mca_osc_pt2pt_component.frags,
sizeof(ompi_osc_pt2pt_frag_t), 8,
OBJ_CLASS(ompi_osc_pt2pt_frag_t),
mca_osc_pt2pt_component.buffer_size +
sizeof (ompi_osc_pt2pt_frag_header_t),
8, 1, -1, 1, 0);
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.frags, opal_free_list_t);
ret = opal_free_list_init (&mca_osc_pt2pt_component.frags,
sizeof(ompi_osc_pt2pt_frag_t), 8,
OBJ_CLASS(ompi_osc_pt2pt_frag_t),
mca_osc_pt2pt_component.buffer_size +
sizeof (ompi_osc_pt2pt_frag_header_t),
8, 1, -1, 1, NULL, 0, NULL, NULL, NULL);
if (OMPI_SUCCESS != ret) {
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
"%s:%d: ompi_free_list_init failed: %d",
"%s:%d: opal_free_list_init failed: %d",
__FILE__, __LINE__, ret);
return ret;
}
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.requests, ompi_free_list_t);
ret = ompi_free_list_init(&mca_osc_pt2pt_component.requests,
sizeof(ompi_osc_pt2pt_request_t),
OBJ_CLASS(ompi_osc_pt2pt_request_t),
0, -1, 32, NULL);
OBJ_CONSTRUCT(&mca_osc_pt2pt_component.requests, opal_free_list_t);
ret = opal_free_list_init (&mca_osc_pt2pt_component.requests,
sizeof(ompi_osc_pt2pt_request_t), 8,
OBJ_CLASS(ompi_osc_pt2pt_request_t),
0, 0, 0, -1, 32, NULL, 0, NULL, NULL, NULL);
if (OMPI_SUCCESS != ret) {
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
"%s:%d: ompi_free_list_init failed: %d\n",
"%s:%d: opal_free_list_init failed: %d\n",
__FILE__, __LINE__, ret);
return ret;
}

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -26,7 +26,7 @@ static void ompi_osc_pt2pt_frag_constructor (ompi_osc_pt2pt_frag_t *frag){
frag->buffer = frag->super.ptr;
}
OBJ_CLASS_INSTANCE(ompi_osc_pt2pt_frag_t, ompi_free_list_item_t,
OBJ_CLASS_INSTANCE(ompi_osc_pt2pt_frag_t, opal_free_list_item_t,
ompi_osc_pt2pt_frag_constructor, NULL);
static int frag_send_cb (ompi_request_t *request)
@ -40,7 +40,7 @@ static int frag_send_cb (ompi_request_t *request)
frag->target, (void *) frag, (void *) request));
mark_outgoing_completion(module);
OMPI_FREE_LIST_RETURN_MT(&mca_osc_pt2pt_component.frags, &frag->super);
opal_free_list_return (&mca_osc_pt2pt_component.frags, &frag->super);
/* put this request on the garbage colletion list */

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -21,7 +21,7 @@
/** Communication buffer for packing messages */
struct ompi_osc_pt2pt_frag_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
/* target rank of buffer */
int target;
unsigned char *buffer;
@ -66,7 +66,7 @@ static inline int ompi_osc_pt2pt_frag_alloc(ompi_osc_pt2pt_module_t *module, int
OPAL_THREAD_LOCK(&module->lock);
if (NULL == curr || curr->remain_len < request_len) {
ompi_free_list_item_t *item = NULL;
opal_free_list_item_t *item = NULL;
if (NULL != curr) {
curr->remain_len = 0;
@ -83,7 +83,7 @@ static inline int ompi_osc_pt2pt_frag_alloc(ompi_osc_pt2pt_module_t *module, int
}
}
OMPI_FREE_LIST_GET_MT(&mca_osc_pt2pt_component.frags, item);
item = opal_free_list_get (&mca_osc_pt2pt_component.frags);
if (OPAL_UNLIKELY(NULL == item)) {
return OMPI_ERR_OUT_OF_RESOURCE;
}

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -34,16 +34,16 @@ OBJ_CLASS_DECLARATION(ompi_osc_pt2pt_request_t);
/* REQUEST_ALLOC is only called from "top-level" functions (pt2pt_rput,
pt2pt_rget, etc.), so it's ok to spin here... */
#define OMPI_OSC_PT2PT_REQUEST_ALLOC(win, req) \
#define OMPI_OSC_PT2PT_REQUEST_ALLOC(win, req) \
do { \
ompi_free_list_item_t *item; \
opal_free_list_item_t *item; \
do { \
OMPI_FREE_LIST_GET_MT(&mca_osc_pt2pt_component.requests, item); \
item = opal_free_list_get (&mca_osc_pt2pt_component.requests); \
if (NULL == item) { \
opal_progress(); \
} \
} while (NULL == item); \
req = (ompi_osc_pt2pt_request_t*) item; \
req = (ompi_osc_pt2pt_request_t*) item; \
OMPI_REQUEST_INIT(&req->super, false); \
req->super.req_mpi_object.win = win; \
req->super.req_complete = false; \
@ -52,11 +52,11 @@ OBJ_CLASS_DECLARATION(ompi_osc_pt2pt_request_t);
req->internal = false; \
} while (0)
#define OMPI_OSC_PT2PT_REQUEST_RETURN(req) \
#define OMPI_OSC_PT2PT_REQUEST_RETURN(req) \
do { \
OMPI_REQUEST_FINI(&(req)->super); \
OMPI_FREE_LIST_RETURN_MT(&mca_osc_pt2pt_component.requests, \
(ompi_free_list_item_t *) (req)); \
opal_free_list_return (&mca_osc_pt2pt_component.requests, \
(opal_free_list_item_t *) (req)); \
} while (0)
static inline void ompi_osc_pt2pt_request_complete (ompi_osc_pt2pt_request_t *request, int mpi_error)

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -15,7 +15,6 @@
#ifndef OSC_SM_SM_H
#define OSC_SM_SM_H
#include "opal/class/ompi_free_list.h"
#include "opal/mca/shmem/base/base.h"
/* data shared across all peers */

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

@ -1,7 +1,7 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
@ -18,7 +18,6 @@
#include "ompi/mca/osc/base/base.h"
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
#include "ompi/request/request.h"
#include "opal/class/ompi_free_list.h"
#include "opal/util/sys_limits.h"
#include "osc_sm.h"

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

@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -11,7 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -137,7 +138,7 @@ static int mca_pml_base_close(void)
anymore) */
/**
* Destruct the send and receive queues. The ompi_free_list_t destructor
* Destruct the send and receive queues. The opal_free_list_t destructor
* will return the memory to the mpool, so this has to be done before the
* mpool get released by the PML close function.
*/
@ -172,8 +173,8 @@ static int mca_pml_base_open(mca_base_open_flag_t flags)
* their content, they should get constructed as soon as possible once the MPI
* process is started.
*/
OBJ_CONSTRUCT(&mca_pml_base_send_requests, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_pml_base_recv_requests, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_pml_base_send_requests, opal_free_list_t);
OBJ_CONSTRUCT(&mca_pml_base_recv_requests, opal_free_list_t);
OBJ_CONSTRUCT(&mca_pml_base_pml, opal_pointer_array_t);

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -24,8 +27,8 @@
* If you wonder why these 2 freelists are declared here read the comment
* in the pml_base_request.h file.
*/
ompi_free_list_t mca_pml_base_send_requests = {{{0}}};
ompi_free_list_t mca_pml_base_recv_requests = {{{0}}};
opal_free_list_t mca_pml_base_send_requests = {{{0}}};
opal_free_list_t mca_pml_base_recv_requests = {{{0}}};
static void mca_pml_base_request_construct(mca_pml_base_request_t* req)
{

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

@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -11,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -24,7 +26,7 @@
#define MCA_PML_BASE_REQUEST_H
#include "ompi_config.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "ompi/communicator/communicator.h"
#include "ompi/request/request.h"
#include "opal/datatype/opal_convertor.h"
@ -37,8 +39,8 @@ BEGIN_C_DECLS
* the list. Beware these free lists have to be initialized
* directly by the PML who win the PML election.
*/
OMPI_DECLSPEC extern ompi_free_list_t mca_pml_base_send_requests;
OMPI_DECLSPEC extern ompi_free_list_t mca_pml_base_recv_requests;
OMPI_DECLSPEC extern opal_free_list_t mca_pml_base_send_requests;
OMPI_DECLSPEC extern opal_free_list_t mca_pml_base_recv_requests;
/**
* Type of request.

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2006-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -8,6 +9,8 @@
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -60,25 +63,25 @@ mca_pml_cm_enable(bool enable)
{
/* BWB - FIX ME - need to have this actually do something,
maybe? */
ompi_free_list_init_new(&mca_pml_base_send_requests,
sizeof(mca_pml_cm_hvy_send_request_t) + ompi_mtl->mtl_request_size,
opal_cache_line_size,
OBJ_CLASS(mca_pml_cm_hvy_send_request_t),
0,opal_cache_line_size,
ompi_pml_cm.free_list_num,
ompi_pml_cm.free_list_max,
ompi_pml_cm.free_list_inc,
NULL);
opal_free_list_init (&mca_pml_base_send_requests,
sizeof(mca_pml_cm_hvy_send_request_t) + ompi_mtl->mtl_request_size,
opal_cache_line_size,
OBJ_CLASS(mca_pml_cm_hvy_send_request_t),
0,opal_cache_line_size,
ompi_pml_cm.free_list_num,
ompi_pml_cm.free_list_max,
ompi_pml_cm.free_list_inc,
NULL, 0, NULL, NULL, NULL);
ompi_free_list_init_new(&mca_pml_base_recv_requests,
sizeof(mca_pml_cm_hvy_recv_request_t) + ompi_mtl->mtl_request_size,
opal_cache_line_size,
OBJ_CLASS(mca_pml_cm_hvy_recv_request_t),
0,opal_cache_line_size,
ompi_pml_cm.free_list_num,
ompi_pml_cm.free_list_max,
ompi_pml_cm.free_list_inc,
NULL);
opal_free_list_init (&mca_pml_base_recv_requests,
sizeof(mca_pml_cm_hvy_recv_request_t) + ompi_mtl->mtl_request_size,
opal_cache_line_size,
OBJ_CLASS(mca_pml_cm_hvy_recv_request_t),
0,opal_cache_line_size,
ompi_pml_cm.free_list_num,
ompi_pml_cm.free_list_max,
ompi_pml_cm.free_list_inc,
NULL, 0, NULL, NULL, NULL);
return OMPI_SUCCESS;
}

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -53,10 +56,9 @@ OBJ_CLASS_DECLARATION(mca_pml_cm_hvy_recv_request_t);
* @return Receive request.
*/
#define MCA_PML_CM_THIN_RECV_REQUEST_ALLOC(recvreq) \
do { \
ompi_free_list_item_t*item; \
OMPI_FREE_LIST_GET_MT(&mca_pml_base_recv_requests, item); \
recvreq = (mca_pml_cm_thin_recv_request_t*) item; \
do { \
recvreq = (mca_pml_cm_thin_recv_request_t*) \
opal_free_list_get (&mca_pml_base_recv_requests); \
recvreq->req_base.req_pml_type = MCA_PML_CM_REQUEST_RECV_THIN; \
recvreq->req_mtl.ompi_req = (ompi_request_t*) recvreq; \
recvreq->req_mtl.completion_callback = mca_pml_cm_recv_request_completion; \
@ -64,9 +66,8 @@ OBJ_CLASS_DECLARATION(mca_pml_cm_hvy_recv_request_t);
#define MCA_PML_CM_HVY_RECV_REQUEST_ALLOC(recvreq) \
do { \
ompi_free_list_item_t*item; \
OMPI_FREE_LIST_GET_MT(&mca_pml_base_recv_requests, item); \
recvreq = (mca_pml_cm_hvy_recv_request_t*) item; \
recvreq = (mca_pml_cm_hvy_recv_request_t*) \
opal_free_list_get (&mca_pml_base_recv_requests); \
recvreq->req_base.req_pml_type = MCA_PML_CM_REQUEST_RECV_HEAVY; \
recvreq->req_mtl.ompi_req = (ompi_request_t*) recvreq; \
recvreq->req_mtl.completion_callback = mca_pml_cm_recv_request_completion; \
@ -296,8 +297,8 @@ do { \
OBJ_RELEASE((recvreq)->req_base.req_datatype); \
OMPI_REQUEST_FINI(&(recvreq)->req_base.req_ompi); \
opal_convertor_cleanup( &((recvreq)->req_base.req_convertor) ); \
OMPI_FREE_LIST_RETURN_MT( &mca_pml_base_recv_requests, \
(ompi_free_list_item_t*)(recvreq)); \
opal_free_list_return ( &mca_pml_base_recv_requests, \
(opal_free_list_item_t*)(recvreq)); \
}
/**
@ -309,8 +310,8 @@ do { \
OBJ_RELEASE((recvreq)->req_base.req_datatype); \
OMPI_REQUEST_FINI(&(recvreq)->req_base.req_ompi); \
opal_convertor_cleanup( &((recvreq)->req_base.req_convertor) ); \
OMPI_FREE_LIST_RETURN_MT( &mca_pml_base_recv_requests, \
(ompi_free_list_item_t*)(recvreq)); \
opal_free_list_return ( &mca_pml_base_recv_requests, \
(opal_free_list_item_t*)(recvreq)); \
}
extern void mca_pml_cm_recv_request_completion(struct mca_mtl_request_t *mtl_request);

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -59,14 +62,13 @@ OBJ_CLASS_DECLARATION(mca_pml_cm_hvy_send_request_t);
#define MCA_PML_CM_THIN_SEND_REQUEST_ALLOC(sendreq, comm, dst, \
ompi_proc) \
do { \
ompi_free_list_item_t* item; \
ompi_proc = ompi_comm_peer_lookup( comm, dst ); \
\
if(OPAL_UNLIKELY(NULL == ompi_proc)) { \
sendreq = NULL; \
} else { \
OMPI_FREE_LIST_WAIT_MT(&mca_pml_base_send_requests, item); \
sendreq = (mca_pml_cm_thin_send_request_t*)item; \
sendreq = (mca_pml_cm_thin_send_request_t*) \
opal_free_list_wait (&mca_pml_base_send_requests); \
sendreq->req_send.req_base.req_pml_type = MCA_PML_CM_REQUEST_SEND_THIN; \
sendreq->req_mtl.ompi_req = (ompi_request_t*) sendreq; \
sendreq->req_mtl.completion_callback = mca_pml_cm_send_request_completion; \
@ -77,13 +79,12 @@ do { \
#define MCA_PML_CM_HVY_SEND_REQUEST_ALLOC(sendreq, comm, dst, \
ompi_proc) \
{ \
ompi_free_list_item_t* item; \
ompi_proc = ompi_comm_peer_lookup( comm, dst ); \
if(OPAL_UNLIKELY(NULL == ompi_proc)) { \
sendreq = NULL; \
} else { \
OMPI_FREE_LIST_WAIT_MT(&mca_pml_base_send_requests, item); \
sendreq = (mca_pml_cm_hvy_send_request_t*)item; \
sendreq = (mca_pml_cm_hvy_send_request_t*) \
opal_free_list_wait (&mca_pml_base_send_requests); \
sendreq->req_send.req_base.req_pml_type = MCA_PML_CM_REQUEST_SEND_HEAVY; \
sendreq->req_mtl.ompi_req = (ompi_request_t*) sendreq; \
sendreq->req_mtl.completion_callback = mca_pml_cm_send_request_completion; \
@ -307,8 +308,8 @@ do {
OBJ_RELEASE(sendreq->req_send.req_base.req_comm); \
OMPI_REQUEST_FINI(&sendreq->req_send.req_base.req_ompi); \
opal_convertor_cleanup( &(sendreq->req_send.req_base.req_convertor) ); \
OMPI_FREE_LIST_RETURN_MT( &mca_pml_base_send_requests, \
(ompi_free_list_item_t*)sendreq); \
opal_free_list_return ( &mca_pml_base_send_requests, \
(opal_free_list_item_t*)sendreq); \
}
/*
@ -346,8 +347,8 @@ do { \
OBJ_RELEASE(sendreq->req_send.req_base.req_comm); \
OMPI_REQUEST_FINI(&sendreq->req_send.req_base.req_ompi); \
opal_convertor_cleanup( &(sendreq->req_send.req_base.req_convertor) ); \
OMPI_FREE_LIST_RETURN_MT( &mca_pml_base_send_requests, \
(ompi_free_list_item_t*)sendreq); \
opal_free_list_return ( &mca_pml_base_send_requests, \
(opal_free_list_item_t*)sendreq); \
}
extern void

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

@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -25,7 +27,7 @@
#include "ompi_config.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "ompi/request/request.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/pml/base/pml_base_request.h"
@ -59,7 +61,7 @@ BEGIN_C_DECLS
extern mca_pml_crcpw_module_t mca_pml_crcpw_module;
/* Free list of PML states */
OMPI_MODULE_DECLSPEC extern ompi_free_list_t pml_state_list;
OMPI_MODULE_DECLSPEC extern opal_free_list_t pml_state_list;
OMPI_MODULE_DECLSPEC extern bool pml_crcpw_is_finalized;
/*

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -64,7 +67,7 @@ mca_pml_crcpw_component_t mca_pml_crcpw_component = {
false
};
ompi_free_list_t pml_state_list;
opal_free_list_t pml_state_list;
bool pml_crcpw_is_finalized = false;
static int mca_pml_crcpw_component_register(void)
@ -148,8 +151,8 @@ mca_pml_base_module_t* mca_pml_crcpw_component_init(int* priority,
opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,
"pml:crcpw: component_init: Initalize Wrapper");
OBJ_CONSTRUCT(&pml_state_list, ompi_free_list_t);
ompi_free_list_init_new( &pml_state_list,
OBJ_CONSTRUCT(&pml_state_list, opal_free_list_t);
opal_free_list_init (&pml_state_list,
sizeof(ompi_crcp_base_pml_state_t),
opal_cache_line_size,
OBJ_CLASS(ompi_crcp_base_pml_state_t),
@ -157,7 +160,7 @@ mca_pml_base_module_t* mca_pml_crcpw_component_init(int* priority,
5, /* Initial number */
-1, /* Max = Unlimited */
64, /* Increment by */
NULL);
NULL, 0, NULL, NULL, NULL);
}
else {
opal_output_verbose( 20, mca_pml_crcpw_component.output_handle,

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,6 +11,8 @@
* Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -27,7 +30,7 @@
#include "ompi/mca/pml/crcpw/pml_crcpw.h"
#include "ompi/mca/bml/base/base.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
mca_pml_crcpw_module_t mca_pml_crcpw_module = {
{
@ -61,17 +64,16 @@ mca_pml_crcpw_module_t mca_pml_crcpw_module = {
#define PML_CRCP_STATE_ALLOC(pml_state) \
do { \
if( !pml_crcpw_is_finalized ) { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&pml_state_list, item); \
pml_state = (ompi_crcp_base_pml_state_t*)item; \
pml_state = (ompi_crcp_base_pml_state_t*) \
opal_free_list_wait (&pml_state_list); \
} \
} while(0);
#define PML_CRCP_STATE_RETURN(pml_state) \
do { \
if( !pml_crcpw_is_finalized ) { \
OMPI_FREE_LIST_RETURN_MT(&pml_state_list, \
(ompi_free_list_item_t*)pml_state); \
opal_free_list_return (&pml_state_list, \
(opal_free_list_item_t*)pml_state); \
} \
} while(0);

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

@ -98,53 +98,53 @@ int mca_pml_ob1_enable(bool enable)
OBJ_CONSTRUCT(&mca_pml_ob1.lock, opal_mutex_t);
/* fragments */
OBJ_CONSTRUCT(&mca_pml_ob1.rdma_frags, ompi_free_list_t);
ompi_free_list_init_new( &mca_pml_ob1.rdma_frags,
sizeof(mca_pml_ob1_rdma_frag_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_rdma_frag_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL );
OBJ_CONSTRUCT(&mca_pml_ob1.rdma_frags, opal_free_list_t);
opal_free_list_init ( &mca_pml_ob1.rdma_frags,
sizeof(mca_pml_ob1_rdma_frag_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_rdma_frag_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&mca_pml_ob1.recv_frags, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_pml_ob1.recv_frags, opal_free_list_t);
ompi_free_list_init_new( &mca_pml_ob1.recv_frags,
sizeof(mca_pml_ob1_recv_frag_t) + mca_pml_ob1.unexpected_limit,
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_recv_frag_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL );
opal_free_list_init ( &mca_pml_ob1.recv_frags,
sizeof(mca_pml_ob1_recv_frag_t) + mca_pml_ob1.unexpected_limit,
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_recv_frag_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&mca_pml_ob1.pending_pckts, ompi_free_list_t);
ompi_free_list_init_new( &mca_pml_ob1.pending_pckts,
sizeof(mca_pml_ob1_pckt_pending_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_pckt_pending_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL );
OBJ_CONSTRUCT(&mca_pml_ob1.pending_pckts, opal_free_list_t);
opal_free_list_init ( &mca_pml_ob1.pending_pckts,
sizeof(mca_pml_ob1_pckt_pending_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_pckt_pending_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&mca_pml_ob1.buffers, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_pml_ob1.send_ranges, ompi_free_list_t);
ompi_free_list_init_new( &mca_pml_ob1.send_ranges,
sizeof(mca_pml_ob1_send_range_t) +
(mca_pml_ob1.max_send_per_range - 1) * sizeof(mca_pml_ob1_com_btl_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_send_range_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL );
OBJ_CONSTRUCT(&mca_pml_ob1.buffers, opal_free_list_t);
OBJ_CONSTRUCT(&mca_pml_ob1.send_ranges, opal_free_list_t);
opal_free_list_init ( &mca_pml_ob1.send_ranges,
sizeof(mca_pml_ob1_send_range_t) +
(mca_pml_ob1.max_send_per_range - 1) * sizeof(mca_pml_ob1_com_btl_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_send_range_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL, 0, NULL, NULL, NULL);
/* pending operations */
OBJ_CONSTRUCT(&mca_pml_ob1.send_pending, opal_list_t);
@ -160,29 +160,29 @@ int mca_pml_ob1_enable(bool enable)
* should get ownership for the send and receive requests list, and
* initialize them with the size of our own requests.
*/
ompi_free_list_init_new( &mca_pml_base_send_requests,
sizeof(mca_pml_ob1_send_request_t) +
(mca_pml_ob1.max_rdma_per_request - 1) *
sizeof(mca_pml_ob1_com_btl_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_send_request_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL );
opal_free_list_init ( &mca_pml_base_send_requests,
sizeof(mca_pml_ob1_send_request_t) +
(mca_pml_ob1.max_rdma_per_request - 1) *
sizeof(mca_pml_ob1_com_btl_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_send_request_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL, 0, NULL, NULL, NULL);
ompi_free_list_init_new( &mca_pml_base_recv_requests,
sizeof(mca_pml_ob1_recv_request_t) +
(mca_pml_ob1.max_rdma_per_request - 1) *
sizeof(mca_pml_ob1_com_btl_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_recv_request_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL );
opal_free_list_init ( &mca_pml_base_recv_requests,
sizeof(mca_pml_ob1_recv_request_t) +
(mca_pml_ob1.max_rdma_per_request - 1) *
sizeof(mca_pml_ob1_com_btl_t),
opal_cache_line_size,
OBJ_CLASS(mca_pml_ob1_recv_request_t),
0,opal_cache_line_size,
mca_pml_ob1.free_list_num,
mca_pml_ob1.free_list_max,
mca_pml_ob1.free_list_inc,
NULL, 0, NULL, NULL, NULL);
mca_pml_ob1.enabled = true;
return OMPI_SUCCESS;

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

@ -28,7 +28,7 @@
#define MCA_PML_OB1_H
#include "ompi_config.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "ompi/request/request.h"
#include "ompi/mca/pml/pml.h"
#include "ompi/mca/pml/base/pml_base_request.h"
@ -65,11 +65,11 @@ struct mca_pml_ob1_t {
opal_mutex_t lock;
/* free lists */
ompi_free_list_t rdma_frags;
ompi_free_list_t recv_frags;
ompi_free_list_t pending_pckts;
ompi_free_list_t buffers;
ompi_free_list_t send_ranges;
opal_free_list_t rdma_frags;
opal_free_list_t recv_frags;
opal_free_list_t pending_pckts;
opal_free_list_t buffers;
opal_free_list_t send_ranges;
/* list of pending operations */
opal_list_t pckt_pending;
@ -211,7 +211,7 @@ extern int mca_pml_ob1_ft_event( int state );
END_C_DECLS
struct mca_pml_ob1_pckt_pending_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
ompi_proc_t* proc;
mca_pml_ob1_hdr_t hdr;
struct mca_bml_base_btl_t *bml_btl;
@ -223,16 +223,15 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_pckt_pending_t);
#define MCA_PML_OB1_PCKT_PENDING_ALLOC(pckt) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&mca_pml_ob1.pending_pckts, item); \
pckt = (mca_pml_ob1_pckt_pending_t*)item; \
pckt = (mca_pml_ob1_pckt_pending_t *) \
opal_free_list_get (&mca_pml_ob1.pending_pckts); \
} while (0)
#define MCA_PML_OB1_PCKT_PENDING_RETURN(pckt) \
do { \
/* return packet */ \
OMPI_FREE_LIST_RETURN_MT(&mca_pml_ob1.pending_pckts, \
(ompi_free_list_item_t*)pckt); \
opal_free_list_return (&mca_pml_ob1.pending_pckts, \
(opal_free_list_item_t*)pckt); \
} while(0)
#define MCA_PML_OB1_ADD_FIN_TO_PENDING(P, D, Sz, B, O, S) \

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -40,7 +40,7 @@
#include "opal/runtime/opal_params.h"
OBJ_CLASS_INSTANCE( mca_pml_ob1_pckt_pending_t,
ompi_free_list_item_t,
opal_free_list_item_t,
NULL,
NULL );

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

@ -31,6 +31,6 @@ static void mca_pml_ob1_rdma_frag_constructor (mca_pml_ob1_rdma_frag_t *frag)
OBJ_CLASS_INSTANCE(
mca_pml_ob1_rdma_frag_t,
ompi_free_list_item_t,
opal_free_list_item_t,
mca_pml_ob1_rdma_frag_constructor,
NULL);

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

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -42,7 +42,7 @@ typedef void (*mca_pml_ob1_rdma_frag_callback_t)(struct mca_pml_ob1_rdma_frag_t
* Used to keep track of local and remote RDMA operations.
*/
struct mca_pml_ob1_rdma_frag_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
mca_bml_base_btl_t *rdma_bml;
mca_pml_ob1_hdr_t rdma_hdr;
mca_pml_ob1_rdma_state_t rdma_state;
@ -65,10 +65,9 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_rdma_frag_t);
#define MCA_PML_OB1_RDMA_FRAG_ALLOC(frag) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&mca_pml_ob1.rdma_frags, item); \
frag = (mca_pml_ob1_rdma_frag_t*)item; \
} while(0)
frag = (mca_pml_ob1_rdma_frag_t *) \
opal_free_list_wait (&mca_pml_ob1.rdma_frags); \
} while(0)
#define MCA_PML_OB1_RDMA_FRAG_RETURN(frag) \
do { \
@ -77,8 +76,8 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_rdma_frag_t);
mca_bml_base_deregister_mem (frag->rdma_bml, frag->local_handle); \
frag->local_handle = NULL; \
} \
OMPI_FREE_LIST_RETURN_MT(&mca_pml_ob1.rdma_frags, \
(ompi_free_list_item_t*)frag); \
opal_free_list_return (&mca_pml_ob1.rdma_frags, \
(opal_free_list_item_t*)frag); \
} while (0)
END_C_DECLS

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

@ -50,7 +50,7 @@
#endif /* OPAL_CUDA_SUPPORT */
OBJ_CLASS_INSTANCE( mca_pml_ob1_buffer_t,
ompi_free_list_item_t,
opal_free_list_item_t,
NULL,
NULL );

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2008 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -39,7 +39,7 @@ typedef struct mca_pml_ob1_buffer_t mca_pml_ob1_buffer_t;
struct mca_pml_ob1_recv_frag_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
mca_pml_ob1_hdr_t hdr;
size_t num_segments;
mca_btl_base_module_t* btl;
@ -54,9 +54,8 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_recv_frag_t);
#define MCA_PML_OB1_RECV_FRAG_ALLOC(frag) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_WAIT_MT(&mca_pml_ob1.recv_frags, item); \
frag = (mca_pml_ob1_recv_frag_t*)item; \
frag = (mca_pml_ob1_recv_frag_t *) \
opal_free_list_wait (&mca_pml_ob1.recv_frags); \
} while(0)
@ -104,8 +103,8 @@ do { \
frag->num_segments = 0; \
\
/* return recv_frag */ \
OMPI_FREE_LIST_RETURN_MT(&mca_pml_ob1.recv_frags, \
(ompi_free_list_item_t*)frag); \
opal_free_list_return (&mca_pml_ob1.recv_frags, \
(opal_free_list_item_t*)frag); \
} while(0)

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -79,9 +79,8 @@ static inline bool unlock_recv_request(mca_pml_ob1_recv_request_t *recvreq)
*/
#define MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq) \
do { \
ompi_free_list_item_t* item; \
OMPI_FREE_LIST_GET_MT(&mca_pml_base_recv_requests, item); \
recvreq = (mca_pml_ob1_recv_request_t*)item; \
recvreq = (mca_pml_ob1_recv_request_t *) \
opal_free_list_get (&mca_pml_base_recv_requests); \
} while(0)
@ -138,8 +137,8 @@ do { \
mca_bml_base_deregister_mem ((recvreq)->rdma_bml, (recvreq)->local_handle); \
(recvreq)->local_handle = NULL; \
} \
OMPI_FREE_LIST_RETURN_MT( &mca_pml_base_recv_requests, \
(ompi_free_list_item_t*)(recvreq)); \
opal_free_list_return (&mca_pml_base_recv_requests, \
(opal_free_list_item_t*)(recvreq)); \
}
/**

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

@ -36,7 +36,7 @@
#include "ompi/mca/bml/base/base.h"
#include "ompi/memchecker.h"
OBJ_CLASS_INSTANCE(mca_pml_ob1_send_range_t, ompi_free_list_item_t,
OBJ_CLASS_INSTANCE(mca_pml_ob1_send_range_t, opal_free_list_item_t,
NULL, NULL);
void mca_pml_ob1_send_request_process_pending(mca_bml_base_btl_t *bml_btl)
@ -830,7 +830,7 @@ void mca_pml_ob1_send_request_copy_in_out( mca_pml_ob1_send_request_t *sendreq,
uint64_t send_length )
{
mca_pml_ob1_send_range_t *sr;
ompi_free_list_item_t *i;
opal_free_list_item_t *i;
mca_bml_base_endpoint_t* bml_endpoint = sendreq->req_endpoint;
int num_btls = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_send);
int n;
@ -839,7 +839,7 @@ void mca_pml_ob1_send_request_copy_in_out( mca_pml_ob1_send_request_t *sendreq,
if( OPAL_UNLIKELY(0 == send_length) )
return;
OMPI_FREE_LIST_WAIT_MT(&mca_pml_ob1.send_ranges, i);
i = opal_free_list_wait (&mca_pml_ob1.send_ranges);
sr = (mca_pml_ob1_send_range_t*)i;
@ -893,7 +893,7 @@ get_next_send_range(mca_pml_ob1_send_request_t* sendreq,
{
OPAL_THREAD_LOCK(&sendreq->req_send_range_lock);
opal_list_remove_item(&sendreq->req_send_ranges, (opal_list_item_t *)range);
OMPI_FREE_LIST_RETURN_MT(&mca_pml_ob1.send_ranges, &range->base);
opal_free_list_return (&mca_pml_ob1.send_ranges, &range->base);
range = get_send_range_nolock(sendreq);
OPAL_THREAD_UNLOCK(&sendreq->req_send_range_lock);

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2011-2012 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -62,7 +62,7 @@ typedef struct mca_pml_ob1_send_request_t mca_pml_ob1_send_request_t;
OBJ_CLASS_DECLARATION(mca_pml_ob1_send_request_t);
struct mca_pml_ob1_send_range_t {
ompi_free_list_item_t base;
opal_free_list_item_t base;
uint64_t range_send_offset;
uint64_t range_send_length;
int range_btl_idx;
@ -121,11 +121,10 @@ get_request_from_send_pending(mca_pml_ob1_send_pending_t *type)
sendreq) \
{ \
ompi_proc_t *proc = ompi_comm_peer_lookup( comm, dst ); \
ompi_free_list_item_t* item; \
\
if( OPAL_LIKELY(NULL != proc) ) { \
OMPI_FREE_LIST_WAIT_MT(&mca_pml_base_send_requests, item); \
sendreq = (mca_pml_ob1_send_request_t*)item; \
sendreq = (mca_pml_ob1_send_request_t*) \
opal_free_list_wait (&mca_pml_base_send_requests); \
sendreq->req_send.req_base.req_proc = proc; \
} \
}
@ -226,8 +225,8 @@ do {
MCA_PML_OB1_RDMA_FRAG_RETURN (sendreq->rdma_frag); \
sendreq->rdma_frag = NULL; \
} \
OMPI_FREE_LIST_RETURN_MT( &mca_pml_base_send_requests, \
(ompi_free_list_item_t*)sendreq); \
opal_free_list_return ( &mca_pml_base_send_requests, \
(opal_free_list_item_t*)sendreq); \
} while(0)

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -157,7 +160,7 @@ void mca_pml_yalla_init_datatype(void)
}
OBJ_CLASS_INSTANCE(mca_pml_yalla_convertor_t,
ompi_free_list_item_t,
opal_free_list_item_t,
mca_pml_yalla_convertor_construct,
mca_pml_yalla_convertor_destruct);

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -13,7 +16,7 @@
#include "pml_yalla.h"
struct pml_yalla_convertor {
ompi_free_list_item_t super;
opal_free_list_item_t super;
ompi_datatype_t *datatype;
opal_convertor_t convertor;
};

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -17,20 +20,15 @@
#define mca_pml_yalla_freelist_t opal_free_list_t
#define PML_YALLA_FREELIST_GET(_freelist) \
({ \
opal_free_list_item_t *item; \
int rc; \
OPAL_FREE_LIST_GET(_freelist, item, rc); \
(void*)(item); \
})
opal_free_list_get (_freelist);\
#define PML_YALLA_FREELIST_RETURN(_freelist, _item) \
{ \
OPAL_FREE_LIST_RETURN(_freelist, _item); \
opal_free_list_return (_freelist, _item); \
}
#define PML_YALLA_FREELIST_INIT(_fl, _type, _initial, _max, _batch) \
opal_free_list_init(_fl, sizeof(_type), OBJ_CLASS(_type), \
_initial, _max, _batch);
opal_free_list_init(_fl, sizeof(_type), 8, OBJ_CLASS(_type), \
0, 0, _initial, _max, _batch, NULL, 0, NULL, NULL, NULL)
#endif /* PML_YALLA_FREELIST_H_ */

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -272,7 +275,7 @@ OBJ_CLASS_INSTANCE(mca_pml_yalla_send_request_t,
mca_pml_yalla_send_request_destruct);
OBJ_CLASS_INSTANCE(mca_pml_yalla_bsend_request_t,
ompi_free_list_item_t,
opal_free_list_item_t,
mca_pml_yalla_bsend_request_construct,
NULL);

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

@ -1,5 +1,8 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (C) Mellanox Technologies Ltd. 2001-2011. ALL RIGHTS RESERVED.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,7 +34,7 @@ struct pml_yalla_send_request {
};
struct pml_yalla_bsend_request {
ompi_free_list_item_t super;
opal_free_list_item_t super;
mxm_send_req_t mxm;
};

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -18,7 +21,7 @@ int mca_vprotocol_base_request_parasite(void)
if(mca_vprotocol.req_recv_class)
{
ompi_free_list_t pml_fl_save = mca_pml_base_recv_requests;
opal_free_list_t pml_fl_save = mca_pml_base_recv_requests;
mca_pml_v.host_pml_req_recv_size =
pml_fl_save.fl_frag_class->cls_sizeof;
V_OUTPUT_VERBOSE(300, "req_rebuild: recv\tsize %lu+%lu\talignment=%lu", (unsigned long) mca_pml_v.host_pml_req_recv_size, (unsigned long) mca_vprotocol.req_recv_class->cls_sizeof, (unsigned long) pml_fl_save.fl_frag_alignment);
@ -28,24 +31,26 @@ int mca_vprotocol_base_request_parasite(void)
pml_fl_save.fl_frag_class->cls_sizeof;
/* rebuild the requests free list with the right size */
OBJ_DESTRUCT(&mca_pml_base_recv_requests);
OBJ_CONSTRUCT(&mca_pml_base_recv_requests, ompi_free_list_t);
ret = ompi_free_list_init_ex_new(&mca_pml_base_recv_requests,
mca_vprotocol.req_recv_class->cls_sizeof,
pml_fl_save.fl_frag_alignment,
mca_vprotocol.req_recv_class,
pml_fl_save.fl_payload_buffer_size,
pml_fl_save.fl_payload_buffer_alignment,
pml_fl_save.fl_num_allocated,
pml_fl_save.fl_max_to_alloc,
pml_fl_save.fl_num_per_alloc,
pml_fl_save.fl_mpool,
pml_fl_save.item_init,
pml_fl_save.ctx);
OBJ_CONSTRUCT(&mca_pml_base_recv_requests, opal_free_list_t);
ret = opal_free_list_init (&mca_pml_base_recv_requests,
mca_vprotocol.req_recv_class->cls_sizeof,
pml_fl_save.fl_frag_alignment,
mca_vprotocol.req_recv_class,
pml_fl_save.fl_payload_buffer_size,
pml_fl_save.fl_payload_buffer_alignment,
pml_fl_save.fl_num_allocated,
pml_fl_save.fl_max_to_alloc,
pml_fl_save.fl_num_per_alloc,
pml_fl_save.fl_mpool,
pml_fl_save.fl_mpool_reg_flags,
0,
pml_fl_save.item_init,
pml_fl_save.ctx);
if(OMPI_SUCCESS != ret) return ret;
}
if(mca_vprotocol.req_send_class)
{
ompi_free_list_t pml_fl_save = mca_pml_base_send_requests;
opal_free_list_t pml_fl_save = mca_pml_base_send_requests;
mca_pml_v.host_pml_req_send_size =
pml_fl_save.fl_frag_class->cls_sizeof;
V_OUTPUT_VERBOSE(300, "req_rebuild: send\tsize %lu+%lu\talignment=%lu", (unsigned long) mca_pml_v.host_pml_req_send_size, (unsigned long) mca_vprotocol.req_send_class->cls_sizeof, (unsigned long) pml_fl_save.fl_frag_alignment);
@ -55,19 +60,21 @@ int mca_vprotocol_base_request_parasite(void)
pml_fl_save.fl_frag_class->cls_sizeof;
/* rebuild the requests free list with the right size */
OBJ_DESTRUCT(&mca_pml_base_send_requests);
OBJ_CONSTRUCT(&mca_pml_base_send_requests, ompi_free_list_t);
ret = ompi_free_list_init_ex_new(&mca_pml_base_send_requests,
mca_vprotocol.req_send_class->cls_sizeof,
pml_fl_save.fl_frag_alignment,
mca_vprotocol.req_send_class,
pml_fl_save.fl_payload_buffer_size,
pml_fl_save.fl_payload_buffer_alignment,
pml_fl_save.fl_num_allocated,
pml_fl_save.fl_max_to_alloc,
pml_fl_save.fl_num_per_alloc,
pml_fl_save.fl_mpool,
pml_fl_save.item_init,
pml_fl_save.ctx);
OBJ_CONSTRUCT(&mca_pml_base_send_requests, opal_free_list_t);
ret = opal_free_list_init (&mca_pml_base_send_requests,
mca_vprotocol.req_send_class->cls_sizeof,
pml_fl_save.fl_frag_alignment,
mca_vprotocol.req_send_class,
pml_fl_save.fl_payload_buffer_size,
pml_fl_save.fl_payload_buffer_alignment,
pml_fl_save.fl_num_allocated,
pml_fl_save.fl_max_to_alloc,
pml_fl_save.fl_num_per_alloc,
pml_fl_save.fl_mpool,
pml_fl_save.fl_mpool_reg_flags,
0,
pml_fl_save.item_init,
pml_fl_save.ctx);
if(OMPI_SUCCESS != ret) return ret;
}
return OMPI_SUCCESS;

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -37,7 +40,7 @@ typedef struct mca_vprotocol_pessimist_module_t {
size_t event_buffer_max_length;
/* space for allocating events */
ompi_free_list_t events_pool;
opal_free_list_t events_pool;
/* Sender Based repository */
vprotocol_pessimist_sender_based_t sender_based;

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -127,16 +130,16 @@ static mca_vprotocol_base_module_t *mca_vprotocol_pessimist_component_init( int*
mca_vprotocol_pessimist.replay = false;
OBJ_CONSTRUCT(&mca_vprotocol_pessimist.replay_events, opal_list_t);
OBJ_CONSTRUCT(&mca_vprotocol_pessimist.pending_events, opal_list_t);
OBJ_CONSTRUCT(&mca_vprotocol_pessimist.events_pool, ompi_free_list_t);
ompi_free_list_init_new(&mca_vprotocol_pessimist.events_pool,
sizeof(mca_vprotocol_pessimist_event_t),
opal_cache_line_size,
OBJ_CLASS(mca_vprotocol_pessimist_event_t),
0,opal_cache_line_size,
_free_list_num,
_free_list_max,
_free_list_inc,
NULL);
OBJ_CONSTRUCT(&mca_vprotocol_pessimist.events_pool, opal_free_list_t);
opal_free_list_init (&mca_vprotocol_pessimist.events_pool,
sizeof(mca_vprotocol_pessimist_event_t),
opal_cache_line_size,
OBJ_CLASS(mca_vprotocol_pessimist_event_t),
0,opal_cache_line_size,
_free_list_num,
_free_list_max,
_free_list_inc,
NULL, 0, NULL, NULL, NULL);
mca_vprotocol_pessimist.event_buffer_max_length =
_event_buffer_size / sizeof(vprotocol_pessimist_mem_event_t);
mca_vprotocol_pessimist.event_buffer_length = 0;

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2013 The Trustees of the University of Tennessee.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -42,7 +45,7 @@ typedef union vprotocol_pessimist_mem_event_t {
} vprotocol_pessimist_mem_event_t;
typedef struct mca_vprotocol_pessimist_event_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
vprotocol_pessimist_event_type_t type;
mca_pml_base_request_t *req;
vprotocol_pessimist_mem_event_t u_event;
@ -53,8 +56,8 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_vprotocol_pessimist_event_t);
#define VPESSIMIST_MATCHING_EVENT_NEW(event) \
do { \
ompi_free_list_item_t *item; \
OMPI_FREE_LIST_WAIT_MT(&mca_vprotocol_pessimist.events_pool, item); \
opal_free_list_item_t *item; \
item = opal_free_list_wait (&mca_vprotocol_pessimist.events_pool); \
event = (mca_vprotocol_pessimist_event_t *) item; \
event->type = VPROTOCOL_PESSIMIST_EVENT_TYPE_MATCHING; \
event->u_event.e_matching.src = -1; \
@ -62,15 +65,15 @@ OMPI_DECLSPEC OBJ_CLASS_DECLARATION(mca_vprotocol_pessimist_event_t);
#define VPESSIMIST_DELIVERY_EVENT_NEW(event) \
do { \
ompi_free_list_item_t *item; \
OMPI_FREE_LIST_WAIT_MT(&mca_vprotocol_pessimist.events_pool, item); \
opal_free_list_item_t *item; \
item = opal_free_list_wait (&mca_vprotocol_pessimist.events_pool); \
event = (mca_vprotocol_pessimist_event_t *) item; \
event->type = VPROTOCOL_PESSIMIST_EVENT_TYPE_DELIVERY; \
} while(0)
#define VPESSIMIST_EVENT_RETURN(event) \
OMPI_FREE_LIST_RETURN_MT(&mca_vprotocol_pessimist.events_pool, \
(ompi_free_list_item_t *) event)
opal_free_list_return (&mca_vprotocol_pessimist.events_pool, \
(opal_free_list_item_t *) event)
END_C_DECLS

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -43,9 +46,9 @@ ompi_message_init(void)
OBJ_CONSTRUCT(&ompi_message_free_list, opal_free_list_t);
rc = opal_free_list_init(&ompi_message_free_list,
sizeof(ompi_message_t),
sizeof(ompi_message_t), 8,
OBJ_CLASS(ompi_message_t),
8, -1, 8);
0, 0, 8, -1, 8, NULL, 0, NULL, NULL, NULL);
OBJ_CONSTRUCT(&ompi_message_f_to_c_table, opal_pointer_array_t);

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

@ -1,6 +1,9 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2011-2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -56,13 +59,7 @@ static inline
ompi_message_t*
ompi_message_alloc(void)
{
int rc;
opal_free_list_item_t *tmp;
OPAL_FREE_LIST_GET(&ompi_message_free_list,
tmp,
rc);
(void)rc; /* prevent "set but not used" compiler complaints */
return (ompi_message_t*) tmp;
return (ompi_message_t *) opal_free_list_get (&ompi_message_free_list);
}
static inline
@ -75,8 +72,8 @@ ompi_message_return(ompi_message_t* msg)
msg->m_f_to_c_index = MPI_UNDEFINED;
}
OPAL_FREE_LIST_RETURN(&ompi_message_free_list,
&msg->super);
opal_free_list_return (&ompi_message_free_list,
&msg->super);
}

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -149,7 +152,8 @@ static void initFreeList(void)
OBJ_CONSTRUCT(&ompi_java_buffers, opal_free_list_t);
int r = opal_free_list_init(&ompi_java_buffers, sizeof(ompi_java_buffer_t),
OBJ_CLASS(ompi_java_buffer_t), 2, -1, 2);
OBJ_CLASS(ompi_java_buffer_t), 0, 0, 2, -1, 2,
NULL, 0, NULL, NULL, NULL);
if(r != OPAL_SUCCESS)
{
fprintf(stderr, "Unable to initialize ompi_java_buffers.\n");
@ -511,12 +515,11 @@ static void* getBuffer(JNIEnv *env, ompi_java_buffer_t **item, int size)
}
else
{
int rc;
opal_free_list_item_t *freeListItem;
OPAL_FREE_LIST_GET(&ompi_java_buffers, freeListItem, rc);
freeListItem = opal_free_list_get (&ompi_java_buffers);
ompi_java_exceptionCheck(env,
rc==OPAL_SUCCESS ? OMPI_SUCCESS : OMPI_ERROR);
ompi_java_exceptionCheck(env, NULL == freeListItem ? OMPI_ERROR :
OMPI_SUCCESS);
*item = (ompi_java_buffer_t*)freeListItem;
return (*item)->buffer;
@ -532,7 +535,7 @@ static void releaseBuffer(void *ptr, ompi_java_buffer_t *item)
else
{
assert(item->buffer == ptr);
OPAL_FREE_LIST_RETURN(&ompi_java_buffers, (opal_free_list_item_t*)item);
opal_free_list_return (&ompi_java_buffers, (opal_free_list_item_t*)item);
}
}

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

@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -13,6 +13,8 @@
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -98,7 +100,7 @@ int ompi_request_persistent_proc_null_free(ompi_request_t** request)
OBJ_CLASS_INSTANCE(
ompi_request_t,
ompi_free_list_item_t,
opal_free_list_item_t,
ompi_request_construct,
ompi_request_destruct);

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

@ -1,4 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -13,6 +13,8 @@
* Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -30,7 +32,7 @@
#include "ompi_config.h"
#include "mpi.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/threads/condition.h"
#include "ompi/constants.h"
@ -97,7 +99,7 @@ typedef union ompi_mpi_object_t {
* Main top-level request struct definition
*/
struct ompi_request_t {
ompi_free_list_item_t super; /**< Base type */
opal_free_list_item_t super; /**< Base type */
ompi_request_type_t req_type; /**< Enum indicating the type of the request */
ompi_status_public_t req_status; /**< Completion status */
volatile bool req_complete; /**< Flag indicating wether request has completed */

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

@ -57,4 +57,3 @@ lib@OPAL_LIB_PREFIX@open_pal_la_SOURCES += \
class/opal_ring_buffer.c \
class/opal_rb_tree.c \
class/ompi_free_list.c

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

@ -1,19 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2009 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
* Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -22,281 +9,6 @@
* $HEADER$
*/
#include "opal_config.h"
#include "opal/class/ompi_free_list.h"
#include "opal/align.h"
#include "opal/util/output.h"
#include "opal/mca/mpool/mpool.h"
static void ompi_free_list_construct(ompi_free_list_t* fl);
static void ompi_free_list_destruct(ompi_free_list_t* fl);
OBJ_CLASS_INSTANCE(ompi_free_list_t, opal_lifo_t,
ompi_free_list_construct, ompi_free_list_destruct);
typedef struct ompi_free_list_item_t ompi_free_list_memory_t;
OBJ_CLASS_INSTANCE(ompi_free_list_item_t,
opal_list_item_t,
NULL, NULL);
static void ompi_free_list_construct(ompi_free_list_t* fl)
{
OBJ_CONSTRUCT(&fl->fl_lock, opal_mutex_t);
OBJ_CONSTRUCT(&fl->fl_condition, opal_condition_t);
fl->fl_max_to_alloc = 0;
fl->fl_num_allocated = 0;
fl->fl_num_per_alloc = 0;
fl->fl_num_waiting = 0;
fl->fl_frag_size = sizeof(ompi_free_list_item_t);
fl->fl_frag_alignment = 0;
fl->fl_payload_buffer_size=0;
fl->fl_payload_buffer_alignment=0;
fl->fl_frag_class = OBJ_CLASS(ompi_free_list_item_t);
fl->fl_mpool = 0;
fl->ctx = NULL;
OBJ_CONSTRUCT(&(fl->fl_allocations), opal_list_t);
}
static void ompi_free_list_destruct(ompi_free_list_t* fl)
{
opal_list_item_t *item;
ompi_free_list_item_t *fl_item;
ompi_free_list_memory_t *fl_mem;
#if 0 && OPAL_ENABLE_DEBUG
if(opal_list_get_size(&fl->super) != fl->fl_num_allocated) {
opal_output(0, "ompi_free_list: %d allocated %d returned: %s:%d\n",
fl->fl_num_allocated, opal_list_get_size(&fl->super),
fl->super.super.cls_init_file_name, fl->super.super.cls_init_lineno);
}
#endif
while(NULL != (item = opal_lifo_pop(&(fl->super)))) {
fl_item = (ompi_free_list_item_t*)item;
/* destruct the item (we constructed it), the underlying memory will be
* reclaimed when we free the slab (ompi_free_list_memory_t ptr)
* containing it */
OBJ_DESTRUCT(fl_item);
}
while(NULL != (item = opal_list_remove_first(&(fl->fl_allocations)))) {
fl_mem = (ompi_free_list_memory_t*)item;
if( NULL != fl->fl_mpool ) {
fl->fl_mpool->mpool_free(fl->fl_mpool, fl_mem->ptr,
fl_mem->registration);
} else if (fl_mem->ptr) {
free (fl_mem->ptr);
}
/* destruct the item (we constructed it), then free the memory chunk */
OBJ_DESTRUCT(item);
free(item);
}
OBJ_DESTRUCT(&fl->fl_allocations);
OBJ_DESTRUCT(&fl->fl_condition);
OBJ_DESTRUCT(&fl->fl_lock);
}
int ompi_free_list_init_ex(
ompi_free_list_t *flist,
size_t elem_size,
size_t alignment,
opal_class_t* elem_class,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
mca_mpool_base_module_t* mpool,
ompi_free_list_item_init_fn_t item_init,
void* ctx)
{
/* alignment must be more than zero and power of two */
if(alignment <= 1 || (alignment & (alignment - 1)))
return OPAL_ERROR;
if(elem_size > flist->fl_frag_size)
flist->fl_frag_size = elem_size;
flist->fl_frag_alignment = alignment;
if(elem_class)
flist->fl_frag_class = elem_class;
flist->fl_payload_buffer_size=flist->fl_frag_size-
flist->fl_frag_class->cls_sizeof;
flist->fl_payload_buffer_alignment=alignment;
flist->fl_max_to_alloc = max_elements_to_alloc;
flist->fl_num_allocated = 0;
flist->fl_num_per_alloc = num_elements_per_alloc;
flist->fl_mpool = mpool;
flist->item_init = item_init;
flist->ctx = ctx;
if(num_elements_to_alloc)
return ompi_free_list_grow(flist, num_elements_to_alloc);
return OPAL_SUCCESS;
}
/* this will replace ompi_free_list_init_ex */
int ompi_free_list_init_ex_new(
ompi_free_list_t *flist,
size_t frag_size,
size_t frag_alignment,
opal_class_t* frag_class,
size_t payload_buffer_size,
size_t payload_buffer_alignment,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
mca_mpool_base_module_t* mpool,
ompi_free_list_item_init_fn_t item_init,
void* ctx)
{
/* alignment must be more than zero and power of two */
if (frag_alignment <= 1 || (frag_alignment & (frag_alignment - 1)))
return OPAL_ERROR;
if (0 < payload_buffer_size) {
if (payload_buffer_alignment <= 1 || (payload_buffer_alignment & (payload_buffer_alignment - 1)))
return OPAL_ERROR;
}
if (frag_size > flist->fl_frag_size)
flist->fl_frag_size = frag_size;
if (frag_class)
flist->fl_frag_class = frag_class;
flist->fl_payload_buffer_size=payload_buffer_size;
flist->fl_max_to_alloc = max_elements_to_alloc;
flist->fl_num_allocated = 0;
flist->fl_num_per_alloc = num_elements_per_alloc;
flist->fl_mpool = mpool;
flist->fl_frag_alignment = frag_alignment;
flist->fl_payload_buffer_alignment = payload_buffer_alignment;
flist->item_init = item_init;
flist->ctx = ctx;
if (num_elements_to_alloc)
return ompi_free_list_grow(flist, num_elements_to_alloc);
return OPAL_SUCCESS;
}
int ompi_free_list_grow(ompi_free_list_t* flist, size_t num_elements)
{
unsigned char *ptr, *mpool_alloc_ptr = NULL, *payload_ptr = NULL;
ompi_free_list_memory_t *alloc_ptr;
size_t i, alloc_size, head_size, elem_size = 0;
mca_mpool_base_registration_t *reg = NULL;
if(flist->fl_max_to_alloc > 0)
if(flist->fl_num_allocated + num_elements > flist->fl_max_to_alloc)
num_elements = flist->fl_max_to_alloc - flist->fl_num_allocated;
if(num_elements == 0)
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
head_size = (NULL == flist->fl_mpool) ? flist->fl_frag_size:
flist->fl_frag_class->cls_sizeof;
head_size = OPAL_ALIGN(head_size, flist->fl_frag_alignment, size_t);
/* calculate head allocation size */
alloc_size = num_elements * head_size + sizeof(ompi_free_list_memory_t) +
flist->fl_frag_alignment;
alloc_ptr = (ompi_free_list_memory_t*)malloc(alloc_size);
if(NULL == alloc_ptr)
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
if (0 != flist->fl_payload_buffer_size) {
elem_size = OPAL_ALIGN(flist->fl_payload_buffer_size,
flist->fl_payload_buffer_alignment, size_t);
/* elem_size should not be 0 here */
assert (elem_size > 0);
/* allocate the rest from the mpool (or use memalign/malloc) */
if(flist->fl_mpool != NULL) {
payload_ptr = mpool_alloc_ptr =
(unsigned char *) flist->fl_mpool->mpool_alloc(flist->fl_mpool,
num_elements * elem_size,
flist->fl_payload_buffer_alignment,
MCA_MPOOL_FLAGS_CACHE_BYPASS |
MCA_MPOOL_FLAGS_CUDA_REGISTER_MEM, &reg);
} else {
#ifdef HAVE_POSIX_MEMALIGN
posix_memalign ((void **) &mpool_alloc_ptr, flist->fl_payload_buffer_alignment,
num_elements * elem_size);
payload_ptr = mpool_alloc_ptr;
#else
mpool_alloc_ptr = (unsigned char *) malloc (num_elements * elem_size +
flist->fl_payload_buffer_alignment);
payload_ptr = (unsigned char *) OPAL_ALIGN((uintptr_t)mpool_alloc_ptr,
flist->fl_payload_buffer_alignment,
uintptr_t);
#endif
}
if(NULL == mpool_alloc_ptr) {
free(alloc_ptr);
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
}
}
/* 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 */
OBJ_CONSTRUCT(alloc_ptr, ompi_free_list_item_t);
opal_list_append(&(flist->fl_allocations), (opal_list_item_t*)alloc_ptr);
alloc_ptr->registration = reg;
alloc_ptr->ptr = mpool_alloc_ptr;
ptr = (unsigned char*)alloc_ptr + sizeof(ompi_free_list_memory_t);
ptr = OPAL_ALIGN_PTR(ptr, flist->fl_frag_alignment, unsigned char*);
for(i=0; i<num_elements; i++) {
ompi_free_list_item_t* item = (ompi_free_list_item_t*)ptr;
item->registration = reg;
item->ptr = payload_ptr;
OBJ_CONSTRUCT_INTERNAL(item, flist->fl_frag_class);
item->super.item_free = 0;
/* run the initialize function if present */
if(flist->item_init) {
flist->item_init(item, flist->ctx);
}
opal_lifo_push(&(flist->super), &(item->super));
ptr += head_size;
payload_ptr += elem_size;
}
flist->fl_num_allocated += num_elements;
return OPAL_SUCCESS;
}
/**
* This function resize the free_list to contain at least the specified
* number of elements. We do not create all of them in the same memory
* segment. Instead we will several time the fl_num_per_alloc elements
* until we reach the required number of the maximum allowed by the
* initialization.
*/
int
ompi_free_list_resize_mt(ompi_free_list_t* flist, size_t size)
{
ssize_t inc_num;
int ret = OPAL_SUCCESS;
if (flist->fl_num_allocated > size) {
return OPAL_SUCCESS;
}
OPAL_THREAD_LOCK(&((flist)->fl_lock));
inc_num = (ssize_t)size - (ssize_t)flist->fl_num_allocated;
while( inc_num > 0 ) {
ret = ompi_free_list_grow(flist, flist->fl_num_per_alloc);
if( OPAL_SUCCESS != ret ) break;
inc_num = (ssize_t)size - (ssize_t)flist->fl_num_allocated;
}
OPAL_THREAD_UNLOCK(&((flist)->fl_lock));
return ret;
}
OBJ_CLASS_INSTANCE(ompi_free_list_t, opal_free_list_t, NULL, NULL);

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

@ -24,271 +24,105 @@
#ifndef OMPI_FREE_LIST_H
#define OMPI_FREE_LIST_H
#include "opal_config.h"
#include "opal/class/opal_lifo.h"
#include "opal/prefetch.h"
#include "opal/threads/condition.h"
#include "opal/constants.h"
#include "opal/runtime/opal.h"
#include "opal_free_list.h"
BEGIN_C_DECLS
#define ompi_free_list_item_t opal_free_list_item_t
struct mca_mem_pool_t;
struct ompi_free_list_item_t;
typedef void (*ompi_free_list_item_init_fn_t) (
struct ompi_free_list_item_t*, void* ctx);
typedef void (*ompi_free_list_item_init_fn_t) (ompi_free_list_item_t*, void* ctx);
struct ompi_free_list_t
{
opal_lifo_t super;
size_t fl_max_to_alloc;
size_t fl_num_allocated;
size_t fl_num_per_alloc;
size_t fl_num_waiting;
size_t fl_frag_size; /* size of the fragment descriptor */
size_t fl_frag_alignment; /* fragment descriptor alignment */
size_t fl_payload_buffer_size; /* size of payload buffer */
size_t fl_payload_buffer_alignment; /* payload buffer alignment */
opal_class_t* fl_frag_class;
struct mca_mpool_base_module_t* fl_mpool;
opal_mutex_t fl_lock;
opal_condition_t fl_condition;
opal_list_t fl_allocations;
struct ompi_free_list_t {
opal_free_list_t super;
ompi_free_list_item_init_fn_t item_init;
void* ctx;
void *ctx;
};
typedef struct ompi_free_list_t ompi_free_list_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(ompi_free_list_t);
struct mca_mpool_base_registration_t;
struct ompi_free_list_item_t
{
opal_list_item_t super;
struct mca_mpool_base_registration_t *registration;
void *ptr;
};
typedef struct ompi_free_list_item_t ompi_free_list_item_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(ompi_free_list_item_t);
#define OMPI_FREE_LIST_GET_MT(fl, item) \
opal_free_list_get (&(fl)->super, &(item))
/**
* Initialize a free list.
*
* @param free_list (IN) Free list.
* @param element_size (IN) Size of each element.
* @param element_class (IN) opal_class_t of element - used to initialize allocated elements.
* @param num_elements_to_alloc Initial number of elements to allocate.
* @param max_elements_to_alloc Maximum number of elements to allocate.
* @param num_elements_per_alloc Number of elements to grow by per allocation.
* @param mpool Optional memory pool for allocation.s
*/
OPAL_DECLSPEC int ompi_free_list_init_ex(
ompi_free_list_t *free_list,
size_t element_size,
size_t alignment,
opal_class_t* element_class,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
struct mca_mpool_base_module_t*,
ompi_free_list_item_init_fn_t item_init,
void *ctx
);
#define OMPI_FREE_LIST_WAIT_MT(fl, item) \
opal_free_list_wait (&(fl)->super, &(item))
static inline int ompi_free_list_init(
ompi_free_list_t *free_list,
size_t element_size,
opal_class_t* element_class,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
struct mca_mpool_base_module_t* mpool)
#define OMPI_FREE_LIST_RETURN_MT(fl, item) \
opal_free_list_return (&(fl)->super, item)
static inline int ompi_free_list_item_init_compat (ompi_free_list_item_t *item,
void *ctx)
{
return ompi_free_list_init_ex(free_list, element_size, opal_cache_line_size,
element_class, num_elements_to_alloc, max_elements_to_alloc,
num_elements_per_alloc, mpool, NULL, NULL);
ompi_free_list_t *free_list = (ompi_free_list_t *) ctx;
free_list->item_init (item, free_list->ctx);
return OPAL_SUCCESS;
}
/**
* Initialize a free list. - this will replace ompi_free_list_init_ex
*
* @param free_list (IN) Free list.
* @param frag_size (IN) Size of each element - allocated by malloc.
* @param frag_alignment (IN) Fragment alignment.
* @param frag_class (IN) opal_class_t of element - used to initialize allocated elements.
* @param payload_buffer_size (IN) Size of payload buffer - allocated from mpool.
* @param payload_buffer_alignment (IN) Payload buffer alignment.
* @param num_elements_to_alloc (IN) Initial number of elements to allocate.
* @param max_elements_to_alloc (IN) Maximum number of elements to allocate.
* @param num_elements_per_alloc (IN) Number of elements to grow by per allocation.
* @param mpool (IN) Optional memory pool for allocation.s
* @param item_init (IN)
* @param ctx (IN)
*/
OPAL_DECLSPEC int ompi_free_list_init_ex_new(
ompi_free_list_t *free_list,
size_t frag_size,
size_t frag_alignment,
opal_class_t* frag_class,
size_t payload_buffer_size,
size_t payload_buffer_alignment,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
struct mca_mpool_base_module_t*,
ompi_free_list_item_init_fn_t item_init,
void *ctx
);
/**
* Initialize a free list. - this will replace ompi_free_list_init
*
* @param free_list (IN) Free list.
* @param frag_size (IN) Size of each element - allocated by malloc.
* @param frag_alignment (IN) Fragment alignment.
* @param frag_class (IN) opal_class_t of element - used to initialize allocated elements.
* @param payload_buffer_size (IN) Size of payload buffer - allocated from mpool.
* @param payload_buffer_alignment (IN) Payload buffer alignment.
* @param num_elements_to_alloc (IN) Initial number of elements to allocate.
* @param max_elements_to_alloc (IN) Maximum number of elements to allocate.
* @param num_elements_per_alloc (IN) Number of elements to grow by per allocation.
* @param mpool (IN) Optional memory pool for allocation.s
*/
static inline int ompi_free_list_init_new(
ompi_free_list_t *free_list,
size_t frag_size,
size_t frag_alignment,
opal_class_t* frag_class,
size_t payload_buffer_size,
size_t payload_buffer_alignment,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
struct mca_mpool_base_module_t* mpool)
static inline int __opal_attribute_deprecated__
ompi_free_list_init_ex_new (ompi_free_list_t *free_list, size_t frag_size,
size_t frag_alignment, opal_class_t* frag_class,
size_t payload_buffer_size, size_t payload_buffer_alignment,
int num_elements_to_alloc, int max_elements_to_alloc,
int num_elements_per_alloc, struct mca_mpool_base_module_t *mpool,
ompi_free_list_item_init_fn_t item_init, void *ctx)
{
return ompi_free_list_init_ex_new(free_list,
frag_size, frag_alignment, frag_class,
payload_buffer_size, payload_buffer_alignment,
num_elements_to_alloc, max_elements_to_alloc,
num_elements_per_alloc, mpool, NULL, NULL);
free_list->item_init = item_init;
free_list->ctx = ctx;
return opal_free_list_init (&free_list->super, frag_size, frag_alignment,
frag_class, payload_buffer_size, payload_buffer_alignment,
num_elements_to_alloc, max_elements_to_alloc,
num_elements_per_alloc, mpool, 0, NULL,
ompi_free_list_item_init_compat,
(void *) free_list);
}
OPAL_DECLSPEC int ompi_free_list_grow(ompi_free_list_t* flist, size_t num_elements);
static inline int __opal_attribute_deprecated__
ompi_free_list_init_new (ompi_free_list_t *free_list, size_t frag_size,
size_t frag_alignment, opal_class_t* frag_class,
size_t payload_buffer_size, size_t payload_buffer_alignment,
int num_elements_to_alloc,int max_elements_to_alloc,
int num_elements_per_alloc, struct mca_mpool_base_module_t* mpool)
{
return opal_free_list_init (&free_list->super, frag_size, frag_alignment,
frag_class, payload_buffer_size,
payload_buffer_alignment, num_elements_to_alloc,
max_elements_to_alloc, num_elements_per_alloc,
mpool, 0, NULL, NULL, NULL);
}
static inline int __opal_attribute_deprecated__
ompi_free_list_init_ex (ompi_free_list_t *free_list, size_t element_size,
size_t alignment, opal_class_t* element_class,
int num_elements_to_alloc, int max_elements_to_alloc,
int num_elements_per_alloc, struct mca_mpool_base_module_t *mpool,
ompi_free_list_item_init_fn_t item_init, void *ctx)
{
return ompi_free_list_init_ex_new (free_list, element_size, alignment,
element_class, 0, 0, num_elements_to_alloc,
max_elements_to_alloc, num_elements_per_alloc,
mpool, item_init, ctx);
}
static inline int __opal_attribute_deprecated__
ompi_free_list_init (ompi_free_list_t *free_list, size_t element_size,
opal_class_t* element_class, int num_elements_to_alloc,
int max_elements_to_alloc, int num_elements_per_alloc,
struct mca_mpool_base_module_t* mpool)
{
return opal_free_list_init (&free_list->super, element_size, opal_cache_line_size,
element_class, 0, 0, num_elements_to_alloc,
max_elements_to_alloc, num_elements_per_alloc,
mpool, 0, NULL, NULL, NULL);
}
/* Grow the free list to be *at least* size elements. This function
will not shrink the list if it is already larger than size and may
grow it past size if necessary (it will grow in
num_elements_per_alloc chunks) */
OPAL_DECLSPEC int ompi_free_list_resize_mt(ompi_free_list_t *flist, size_t size);
/**
* Attemp to obtain an item from a free list.
*
* @param fl (IN) Free list.
* @param item (OUT) Allocated item.
*
* If the requested item is not available the free list is grown to
* accomodate the request - unless the max number of allocations has
* been reached. If this is the case - a NULL pointer is returned
* to the caller.
*/
#define OMPI_FREE_LIST_GET_MT(fl, item) \
{ \
item = (ompi_free_list_item_t*) opal_lifo_pop (&((fl)->super)); \
if( OPAL_UNLIKELY(NULL == item) ) { \
if(opal_using_threads()) { \
opal_mutex_lock(&((fl)->fl_lock)); \
ompi_free_list_grow((fl), (fl)->fl_num_per_alloc); \
opal_mutex_unlock(&((fl)->fl_lock)); \
} else { \
ompi_free_list_grow((fl), (fl)->fl_num_per_alloc); \
} \
item = (ompi_free_list_item_t*) opal_lifo_pop(&((fl)->super)); \
} \
}
/**
* Blocking call to obtain an item from a free list.
*
* @param fl (IN) Free list.
* @param item (OUT) Allocated item.
*
* If the requested item is not available the free list is grown to
* accomodate the request - unless the max number of allocations has
* been reached. In this case the caller is blocked until an item
* is returned to the list.
*/
#define OMPI_FREE_LIST_WAIT_MT(fl, item) \
__ompi_free_list_wait_mt( (fl), &(item) )
static inline void __ompi_free_list_wait_mt( ompi_free_list_t* fl,
ompi_free_list_item_t** item )
static inline int __opal_attribute_deprecated__
ompi_free_list_resize_mt(ompi_free_list_t *flist, size_t size)
{
*item = (ompi_free_list_item_t*)opal_lifo_pop(&((fl)->super));
while( NULL == *item ) {
if( !OPAL_THREAD_TRYLOCK(&((fl)->fl_lock)) ) {
if((fl)->fl_max_to_alloc <= (fl)->fl_num_allocated) {
(fl)->fl_num_waiting++;
opal_condition_wait(&((fl)->fl_condition), &((fl)->fl_lock));
(fl)->fl_num_waiting--;
} else {
if(ompi_free_list_grow((fl), (fl)->fl_num_per_alloc)
== OPAL_SUCCESS) {
if( 0 < (fl)->fl_num_waiting ) {
if( 1 == (fl)->fl_num_waiting ) {
opal_condition_signal(&((fl)->fl_condition));
} else {
opal_condition_broadcast(&((fl)->fl_condition));
}
}
} else {
(fl)->fl_num_waiting++;
opal_condition_wait(&((fl)->fl_condition), &((fl)->fl_lock));
(fl)->fl_num_waiting--;
}
}
} else {
/* If I wasn't able to get the lock in the begining when I finaly grab it
* the one holding the lock in the begining already grow the list. I will
* release the lock and try to get a new element until I succeed.
*/
OPAL_THREAD_LOCK(&((fl)->fl_lock));
}
OPAL_THREAD_UNLOCK(&((fl)->fl_lock));
*item = (ompi_free_list_item_t*)opal_lifo_pop(&((fl)->super));
}
}
/**
* Return an item to a free list.
*
* @param fl (IN) Free list.
* @param item (OUT) Allocated item.
*
*/
#define OMPI_FREE_LIST_RETURN_MT(fl, item) \
do { \
opal_list_item_t* original; \
\
original = opal_lifo_push( &(fl)->super, &(item)->super); \
if( &(fl)->super.opal_lifo_ghost == original ) { \
OPAL_THREAD_LOCK(&(fl)->fl_lock); \
if((fl)->fl_num_waiting > 0) { \
if( 1 == (fl)->fl_num_waiting ) { \
opal_condition_signal(&((fl)->fl_condition)); \
} else { \
opal_condition_broadcast(&((fl)->fl_condition)); \
} \
} \
OPAL_THREAD_UNLOCK(&(fl)->fl_lock); \
} \
} while(0)
END_C_DECLS
#endif
return opal_free_list_resize_mt (&flist->super, size);
}
#endif

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

@ -3,15 +3,17 @@
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2008 The University of Tennessee and The University
* Copyright (c) 2004-2009 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved.
* Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -23,15 +25,12 @@
#include "opal_config.h"
#include "opal/class/opal_free_list.h"
#include "opal/runtime/opal.h"
#include "opal/align.h"
#include "opal/util/output.h"
#include "opal/mca/mpool/mpool.h"
static void opal_free_list_construct(opal_free_list_t* fl);
static void opal_free_list_destruct(opal_free_list_t* fl);
typedef struct opal_free_list_item_t opal_free_list_memory_t;
OBJ_CLASS_INSTANCE(opal_free_list_t,
opal_list_t,
opal_free_list_construct,
opal_free_list_destruct);
OBJ_CLASS_INSTANCE(opal_free_list_item_t,
opal_list_item_t,
NULL, NULL);
@ -44,27 +43,56 @@ static void opal_free_list_construct(opal_free_list_t* fl)
fl->fl_num_allocated = 0;
fl->fl_num_per_alloc = 0;
fl->fl_num_waiting = 0;
fl->fl_elem_size = 0;
fl->fl_elem_class = 0;
fl->fl_frag_size = sizeof(opal_free_list_item_t);
fl->fl_frag_alignment = 0;
fl->fl_payload_buffer_size = 0;
fl->fl_payload_buffer_alignment = 0;
fl->fl_frag_class = OBJ_CLASS(opal_free_list_item_t);
fl->fl_mpool = NULL;
/* default flags */
fl->fl_mpool_reg_flags = MCA_MPOOL_FLAGS_CACHE_BYPASS |
MCA_MPOOL_FLAGS_CUDA_REGISTER_MEM;
fl->ctx = NULL;
OBJ_CONSTRUCT(&(fl->fl_allocations), opal_list_t);
}
static void opal_free_list_destruct(opal_free_list_t* fl)
static void opal_free_list_allocation_release (opal_free_list_t *fl, opal_free_list_memory_t *fl_mem)
{
opal_list_item_t *item;
if (fl->fl_elem_class) {
while (NULL != (item = opal_list_remove_first (&fl->super))) {
/* destruct the item (we constructed it), the underlying memory will be
* reclaimed when we free the slab below */
OBJ_DESTRUCT(item);
}
if (NULL != fl->fl_mpool) {
fl->fl_mpool->mpool_free (fl->fl_mpool, fl_mem->ptr, fl_mem->registration);
} else if (fl_mem->ptr) {
free (fl_mem->ptr);
}
while (NULL != (item = opal_list_remove_first(&(fl->fl_allocations)))) {
/* destruct the item (we constructed it), then free the memory chunk */
OBJ_DESTRUCT(item);
free(item);
/* destruct the item (we constructed it), then free the memory chunk */
OBJ_DESTRUCT(fl_mem);
free(fl_mem);
}
static void opal_free_list_destruct(opal_free_list_t *fl)
{
opal_list_item_t *item;
opal_free_list_item_t *fl_item;
#if 0 && OPAL_ENABLE_DEBUG
if(opal_list_get_size(&fl->super) != fl->fl_num_allocated) {
opal_output(0, "opal_free_list: %d allocated %d returned: %s:%d\n",
fl->fl_num_allocated, opal_list_get_size(&fl->super),
fl->super.super.cls_init_file_name, fl->super.super.cls_init_lineno);
}
#endif
while(NULL != (item = opal_lifo_pop(&(fl->super)))) {
fl_item = (opal_free_list_item_t*)item;
/* destruct the item (we constructed it), the underlying memory will be
* reclaimed when we free the slab (opal_free_list_memory_t ptr)
* containing it */
OBJ_DESTRUCT(fl_item);
}
while(NULL != (item = opal_list_remove_first(&fl->fl_allocations))) {
opal_free_list_allocation_release (fl, (opal_free_list_memory_t *) item);
}
OBJ_DESTRUCT(&fl->fl_allocations);
@ -72,69 +100,191 @@ static void opal_free_list_destruct(opal_free_list_t* fl)
OBJ_DESTRUCT(&fl->fl_lock);
}
int opal_free_list_init(
opal_free_list_t *flist,
size_t elem_size,
opal_class_t* elem_class,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc)
OBJ_CLASS_INSTANCE(opal_free_list_t, opal_lifo_t, opal_free_list_construct,
opal_free_list_destruct);
int opal_free_list_init (opal_free_list_t *flist, size_t frag_size, size_t frag_alignment,
opal_class_t *frag_class, size_t payload_buffer_size,
size_t payload_buffer_alignment, int num_elements_to_alloc,
int max_elements_to_alloc, int num_elements_per_alloc,
mca_mpool_base_module_t* mpool, int mpool_reg_flags,
void *unused0, opal_free_list_item_init_fn_t item_init, void *ctx)
{
flist->fl_elem_size = elem_size;
flist->fl_elem_class = elem_class;
/* alignment must be more than zero and power of two */
if (frag_alignment <= 1 || (frag_alignment & (frag_alignment - 1))) {
return OPAL_ERROR;
}
if (0 < payload_buffer_size) {
if (payload_buffer_alignment <= 1 || (payload_buffer_alignment & (payload_buffer_alignment - 1)))
return OPAL_ERROR;
}
if (frag_size > flist->fl_frag_size) {
flist->fl_frag_size = frag_size;
}
if (frag_class) {
flist->fl_frag_class = frag_class;
}
flist->fl_payload_buffer_size = payload_buffer_size;
flist->fl_max_to_alloc = max_elements_to_alloc;
flist->fl_num_allocated = 0;
flist->fl_num_per_alloc = num_elements_per_alloc;
if(num_elements_to_alloc)
return opal_free_list_grow(flist, num_elements_to_alloc);
flist->fl_mpool = mpool;
flist->fl_frag_alignment = frag_alignment;
flist->fl_payload_buffer_alignment = payload_buffer_alignment;
flist->item_init = item_init;
flist->fl_mpool_reg_flags |= mpool_reg_flags;
flist->ctx = ctx;
if (num_elements_to_alloc) {
return opal_free_list_grow_st (flist, num_elements_to_alloc);
}
return OPAL_SUCCESS;
}
int opal_free_list_grow(opal_free_list_t* flist, size_t num_elements)
int opal_free_list_grow_st (opal_free_list_t* flist, size_t num_elements)
{
unsigned char* ptr;
unsigned char* alloc_ptr;
size_t i;
size_t mod;
unsigned char *ptr, *mpool_alloc_ptr = NULL, *payload_ptr = NULL;
opal_free_list_memory_t *alloc_ptr;
size_t alloc_size, head_size, elem_size = 0;
mca_mpool_base_registration_t *reg = NULL;
int rc = OPAL_SUCCESS;
if (flist->fl_max_to_alloc > 0 && flist->fl_num_allocated + num_elements > flist->fl_max_to_alloc)
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
alloc_ptr = (unsigned char *)malloc((num_elements * flist->fl_elem_size) +
sizeof(opal_list_item_t) +
opal_cache_line_size);
if(NULL == alloc_ptr)
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
/* 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 */
OBJ_CONSTRUCT(alloc_ptr, opal_list_item_t);
opal_list_append(&(flist->fl_allocations), (opal_list_item_t*) alloc_ptr);
ptr = alloc_ptr + sizeof(opal_list_item_t);
mod = (uintptr_t)ptr % opal_cache_line_size;
if(mod != 0) {
ptr += (opal_cache_line_size - mod);
if (flist->fl_max_to_alloc && (flist->fl_num_allocated + num_elements) >
flist->fl_max_to_alloc) {
num_elements = flist->fl_max_to_alloc - flist->fl_num_allocated;
}
if (NULL != flist->fl_elem_class) {
for(i=0; i<num_elements; i++) {
opal_free_list_item_t* item = (opal_free_list_item_t*)ptr;
OBJ_CONSTRUCT_INTERNAL(item, flist->fl_elem_class);
opal_list_append(&(flist->super), &(item->super));
ptr += flist->fl_elem_size;
if (num_elements == 0) {
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
}
head_size = (NULL == flist->fl_mpool) ? flist->fl_frag_size:
flist->fl_frag_class->cls_sizeof;
head_size = OPAL_ALIGN(head_size, flist->fl_frag_alignment, size_t);
/* calculate head allocation size */
alloc_size = num_elements * head_size + sizeof(opal_free_list_memory_t) +
flist->fl_frag_alignment;
alloc_ptr = (opal_free_list_memory_t *) malloc(alloc_size);
if (OPAL_UNLIKELY(NULL == alloc_ptr)) {
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
}
if (0 != flist->fl_payload_buffer_size) {
elem_size = OPAL_ALIGN(flist->fl_payload_buffer_size,
flist->fl_payload_buffer_alignment, size_t);
/* elem_size should not be 0 here */
assert (elem_size > 0);
/* allocate the rest from the mpool (or use memalign/malloc) */
if(flist->fl_mpool != NULL) {
payload_ptr = mpool_alloc_ptr =
(unsigned char *) flist->fl_mpool->mpool_alloc(flist->fl_mpool,
num_elements * elem_size,
flist->fl_payload_buffer_alignment,
flist->fl_mpool_reg_flags, &reg);
} else {
#ifdef HAVE_POSIX_MEMALIGN
posix_memalign ((void **) &mpool_alloc_ptr, flist->fl_payload_buffer_alignment,
num_elements * elem_size);
payload_ptr = mpool_alloc_ptr;
#else
mpool_alloc_ptr = (unsigned char *) malloc (num_elements * elem_size +
flist->fl_payload_buffer_alignment);
payload_ptr = (unsigned char *) OPAL_ALIGN((uintptr_t)mpool_alloc_ptr,
flist->fl_payload_buffer_alignment,
uintptr_t);
#endif
}
} else {
for(i=0; i<num_elements; i++) {
opal_free_list_item_t* item = (opal_free_list_item_t*)ptr;
opal_list_append(&(flist->super), &(item->super));
ptr += flist->fl_elem_size;
if(NULL == mpool_alloc_ptr) {
free(alloc_ptr);
return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
}
}
/* 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 */
OBJ_CONSTRUCT(alloc_ptr, opal_free_list_item_t);
opal_list_append(&(flist->fl_allocations), (opal_list_item_t*)alloc_ptr);
alloc_ptr->registration = reg;
alloc_ptr->ptr = mpool_alloc_ptr;
ptr = (unsigned char*)alloc_ptr + sizeof(opal_free_list_memory_t);
ptr = OPAL_ALIGN_PTR(ptr, flist->fl_frag_alignment, unsigned char*);
for(size_t i = 0; i < num_elements ; ++i) {
opal_free_list_item_t* item = (opal_free_list_item_t*)ptr;
item->registration = reg;
item->ptr = payload_ptr;
OBJ_CONSTRUCT_INTERNAL(item, flist->fl_frag_class);
item->super.item_free = 0;
/* run the initialize function if present */
if (flist->item_init) {
if (OPAL_SUCCESS != (rc = flist->item_init(item, flist->ctx))) {
num_elements = i;
OBJ_DESTRUCT (item);
break;
}
}
/* NTH: in case the free list may be accessed from multiple threads
* use the atomic lifo push. The overhead is small compared to the
* overall overhead of opal_free_list_grow(). */
opal_lifo_push_atomic (&flist->super, &item->super);
ptr += head_size;
payload_ptr += elem_size;
}
if (OPAL_SUCCESS != rc && 0 == num_elements) {
/* couldn't initialize any items */
opal_list_remove_item (&flist->fl_allocations, (opal_list_item_t *) alloc_ptr);
opal_free_list_allocation_release (flist, alloc_ptr);
return OPAL_ERR_OUT_OF_RESOURCE;
}
flist->fl_num_allocated += num_elements;
return OPAL_SUCCESS;
}
/**
* This function resize the free_list to contain at least the specified
* number of elements. We do not create all of them in the same memory
* segment. Instead we will several time the fl_num_per_alloc elements
* until we reach the required number of the maximum allowed by the
* initialization.
*/
int opal_free_list_resize_mt(opal_free_list_t *flist, size_t size)
{
ssize_t inc_num;
int ret = OPAL_SUCCESS;
if (flist->fl_num_allocated > size) {
return OPAL_SUCCESS;
}
opal_mutex_lock (&flist->fl_lock);
do {
ret = opal_free_list_grow_st (flist, flist->fl_num_per_alloc);
if (OPAL_SUCCESS != ret) {
break;
}
inc_num = (ssize_t)size - (ssize_t)flist->fl_num_allocated;
} while (inc_num > 0);
opal_mutex_unlock (&flist->fl_lock);
return ret;
}

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

@ -1,14 +1,19 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 IBM Corporation. All rights reserved.
* Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -20,101 +25,213 @@
#define OPAL_FREE_LIST_H
#include "opal_config.h"
#include "opal/class/opal_list.h"
#include "opal/class/opal_lifo.h"
#include "opal/prefetch.h"
#include "opal/threads/condition.h"
#include "opal/constants.h"
#include "opal/prefetch.h"
#include "opal/runtime/opal.h"
BEGIN_C_DECLS
struct opal_free_list_t
{
opal_list_t super;
struct mca_mem_pool_t;
struct opal_free_list_item_t;
/**
* Free list item initializtion function.
*
* @param item (IN) Free list item to initialize
* @param ctx (IN) Free list initialization context
*
* @returns OPAL_SUCCESS on success
* @returns opal error code on failure
*
* This function attempts to initialize the free list item
* specified in item. If the item can be initialized the
* function should return OPAL_SUCCESS. On any error
* opal_free_list_grow will stop initializing new items.
*/
typedef int (*opal_free_list_item_init_fn_t) (
struct opal_free_list_item_t *item, void *ctx);
struct opal_free_list_t {
/** Items in a free list are stored last-in first-out */
opal_lifo_t super;
/** Maximum number of items to allocate in the free list */
size_t fl_max_to_alloc;
/** Current number of items allocated */
size_t fl_num_allocated;
/** Number of items to allocate when growing the free list */
size_t fl_num_per_alloc;
/** Number of threads waiting on free list item availability */
size_t fl_num_waiting;
size_t fl_elem_size;
opal_class_t* fl_elem_class;
/** Size of each free list item */
size_t fl_frag_size;
/** Free list item alignment */
size_t fl_frag_alignment;
/** Free list item buffer size */
size_t fl_payload_buffer_size;
/** Free list item buffer alignment */
size_t fl_payload_buffer_alignment;
/** Class of free list items */
opal_class_t *fl_frag_class;
/** mpool to use for free list buffer allocation (posix_memalign/malloc
* are used if this is NULL) */
struct mca_mpool_base_module_t *fl_mpool;
/** Multi-threaded lock. Used when the free list is empty. */
opal_mutex_t fl_lock;
opal_condition_t fl_condition;
/** Multi-threaded condition. Used when threads are waiting on free
* list item availability. */
opal_condition_t fl_condition;
/** List of free list allocation */
opal_list_t fl_allocations;
/** Flags to pass to the mpool register function */
int fl_mpool_reg_flags;
/** Free list item initialization function */
opal_free_list_item_init_fn_t item_init;
/** Initialization function context */
void *ctx;
};
typedef struct opal_free_list_t opal_free_list_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_free_list_t);
struct mca_mpool_base_registration_t;
struct opal_free_list_item_t
{
opal_list_item_t super;
struct mca_mpool_base_registration_t *registration;
void *ptr;
};
typedef struct opal_free_list_item_t opal_free_list_item_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_free_list_item_t);
/**
* Initialize a free list.
*
* @param free_list (IN) Free list.
* @param element_size (IN) Size of each element.
* @param element_class (IN) opal_class_t of element - used to initialize allocated elements.
* @param num_elements_to_alloc Initial number of elements to allocate.
* @param max_elements_to_alloc Maximum number of elements to allocate.
* @param num_elements_per_alloc Number of elements to grow by per allocation.
* @param free_list (IN) Free list.
* @param frag_size (IN) Size of each element - allocated by malloc.
* @param frag_alignment (IN) Fragment alignment.
* @param frag_class (IN) opal_class_t of element - used to initialize allocated elements.
* @param payload_buffer_size (IN) Size of payload buffer - allocated from mpool.
* @param payload_buffer_alignment (IN) Payload buffer alignment.
* @param num_elements_to_alloc (IN) Initial number of elements to allocate.
* @param max_elements_to_alloc (IN) Maximum number of elements to allocate.
* @param num_elements_per_alloc (IN) Number of elements to grow by per allocation.
* @param mpool (IN) Optional memory pool for allocations.
* @param mpool_reg_flags (IN) Flags to pass to mpool registration function.
* @param unused0 (IN) Future. Must be NULL.
* @param item_init (IN) Optional item initialization function
* @param ctx (IN) Initialization function context.
*/
OPAL_DECLSPEC int opal_free_list_init(
opal_free_list_t *free_list,
size_t element_size,
opal_class_t* element_class,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc);
OPAL_DECLSPEC int opal_free_list_init (opal_free_list_t *free_list,
size_t frag_size,
size_t frag_alignment,
opal_class_t* frag_class,
size_t payload_buffer_size,
size_t payload_buffer_alignment,
int num_elements_to_alloc,
int max_elements_to_alloc,
int num_elements_per_alloc,
struct mca_mpool_base_module_t *mpool,
int mpool_reg_flags,
void *unused0,
opal_free_list_item_init_fn_t item_init,
void *ctx);
/**
* Grow the free list by at most num_elements elements.
*
* @param flist (IN) Free list to grow
* @param num_elements (IN) Number of elements to add
*
* @returns OPAL_SUCCESS if any elements were added
* @returns OPAL_ERR_OUT_OF_RESOURCE if no elements could be added
*
* This function will attempt to grow the free list by num_elements items. The
* caller must hold the free list lock if calling this function on a free list
* that may be accessed by multiple threads simultaneously. Note: this is an
* internal function that will be used when needed by opal_free_list_get* and
* opal_free_list_wait*.
*/
OPAL_DECLSPEC int opal_free_list_grow_st (opal_free_list_t *flist, size_t num_elements);
/**
* Grow the free list to be at least size elements.
*
* @param flist (IN) Free list to resize.
* @param size (IN) New size
*
* @returns OPAL_SUCCESS if the free list was resized
* @returns OPAL_ERR_OUT_OF_RESOURCE if resources could not be allocated
*
* This function will not shrink the list if it is already larger than size
* and may grow it past size if necessary (it will grow in num_elements_per_alloc
* chunks). This function is thread-safe and will obtain the free list lock before
* growing the free list.
*/
OPAL_DECLSPEC int opal_free_list_resize_mt (opal_free_list_t *flist, size_t size);
OPAL_DECLSPEC int opal_free_list_grow(opal_free_list_t* flist, size_t num_elements) __opal_attribute_nonnull__(1);
/**
* Attemp to obtain an item from a free list.
*
* @param fl (IN) Free list.
* @param item (OUT) Allocated item.
* @param rc (OUT) OPAL_SUCCESS or error status on failure.
*
* If the requested item is not available the free list is grown to
* accomodate the request - unless the max number of allocations has
* been reached. If this is the case - an out of resource error is
* returned to the caller.
* been reached. If this is the case - a NULL pointer is returned
* to the caller. This function comes in three flavor: thread safe
* (opal_free_list_get_mt), single threaded (opal_free_list_get_st),
* and opal_using_threads conditioned (opal_free_list_get).
*/
#define OPAL_FREE_LIST_GET(fl, item, rc) \
{ \
if(opal_using_threads()) { \
opal_mutex_lock(&((fl)->fl_lock)); \
item = (opal_free_list_item_t*) \
opal_list_remove_first(&((fl)->super)); \
if( OPAL_UNLIKELY(NULL == item) ) { \
opal_free_list_grow((fl), (fl)->fl_num_per_alloc); \
item = (opal_free_list_item_t*) \
opal_list_remove_first(&((fl)->super)); \
} \
opal_mutex_unlock(&((fl)->fl_lock)); \
} else { \
item = (opal_free_list_item_t*) \
opal_list_remove_first(&((fl)->super)); \
if( OPAL_UNLIKELY(NULL == item) ) { \
opal_free_list_grow((fl), (fl)->fl_num_per_alloc); \
item = (opal_free_list_item_t*) \
opal_list_remove_first(&((fl)->super)); \
} \
} \
rc = (NULL == item) ? OPAL_ERR_TEMP_OUT_OF_RESOURCE : OPAL_SUCCESS; \
static inline opal_free_list_item_t *opal_free_list_get_mt (opal_free_list_t *flist)
{
opal_free_list_item_t *item =
(opal_free_list_item_t*) opal_lifo_pop_atomic (&flist->super);
if (OPAL_UNLIKELY(NULL == item)) {
opal_mutex_lock (&flist->fl_lock);
opal_free_list_grow_st (flist, flist->fl_num_per_alloc);
opal_mutex_unlock (&flist->fl_lock);
item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&flist->super);
}
return item;
}
static inline opal_free_list_item_t *opal_free_list_get_st (opal_free_list_t *flist)
{
opal_free_list_item_t *item =
(opal_free_list_item_t*) opal_lifo_pop_st (&flist->super);
if (OPAL_UNLIKELY(NULL == item)) {
opal_free_list_grow_st (flist, flist->fl_num_per_alloc);
item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&flist->super);
}
return item;
}
static inline opal_free_list_item_t *opal_free_list_get (opal_free_list_t *flist)
{
if (opal_using_threads ()) {
return opal_free_list_get_mt (flist);
}
return opal_free_list_get_st (flist);
}
/** compatibility macro */
#define OPAL_FREE_LIST_GET(fl, item) \
(item) = opal_free_list_get (fl)
/**
* Blocking call to obtain an item from a free list.
*
* @param fl (IN) Free list.
* @param item (OUT) Allocated item.
* @param rc (OUT) OPAL_SUCCESS or error status on failure.
*
* If the requested item is not available the free list is grown to
* accomodate the request - unless the max number of allocations has
@ -122,22 +239,71 @@ OPAL_DECLSPEC int opal_free_list_grow(opal_free_list_t* flist, size_t num_elemen
* is returned to the list.
*/
#define OPAL_FREE_LIST_WAIT(fl, item, rc) \
do { \
OPAL_THREAD_LOCK(&((fl)->fl_lock)); \
while( NULL == (item = (opal_free_list_item_t*) opal_list_remove_first(&((fl)->super))) ) { \
if( OPAL_LIKELY((fl)->fl_max_to_alloc <= (fl)->fl_num_allocated) ) { \
(fl)->fl_num_waiting++; \
opal_condition_wait(&((fl)->fl_condition), &((fl)->fl_lock)); \
(fl)->fl_num_waiting--; \
} else { \
opal_free_list_grow((fl), (fl)->fl_num_per_alloc); \
} \
} \
OPAL_THREAD_UNLOCK(&((fl)->fl_lock)); \
rc = OPAL_SUCCESS; \
} while(0)
/** compatibility macro */
#define OPAL_FREE_LIST_WAIT(fl, item) \
(item) = opal_free_list_wait (fl)
static inline opal_free_list_item_t *opal_free_list_wait_mt (opal_free_list_t *fl)
{
opal_free_list_item_t *item =
(opal_free_list_item_t *) opal_lifo_pop (&fl->super);
while (NULL == item) {
if (!opal_mutex_trylock (&fl->fl_lock)) {
if (fl->fl_max_to_alloc <= fl->fl_num_allocated ||
OPAL_SUCCESS != opal_free_list_grow_st (fl, fl->fl_num_per_alloc)) {
fl->fl_num_waiting++;
opal_condition_wait (&fl->fl_condition, &fl->fl_lock);
fl->fl_num_waiting--;
} else {
if (0 < fl->fl_num_waiting) {
if (1 == fl->fl_num_waiting) {
opal_condition_signal (&fl->fl_condition);
} else {
opal_condition_broadcast (&fl->fl_condition);
}
}
}
} else {
/* If I wasn't able to get the lock in the begining when I finaly grab it
* the one holding the lock in the begining already grow the list. I will
* release the lock and try to get a new element until I succeed.
*/
opal_mutex_lock (&fl->fl_lock);
}
opal_mutex_unlock (&fl->fl_lock);
item = (opal_free_list_item_t *) opal_lifo_pop (&fl->super);
}
return item;
}
static inline opal_free_list_item_t *opal_free_list_wait_st (opal_free_list_t *fl)
{
opal_free_list_item_t *item =
(opal_free_list_item_t *) opal_lifo_pop (&fl->super);
while (NULL == item) {
if (fl->fl_max_to_alloc <= fl->fl_num_allocated ||
OPAL_SUCCESS != opal_free_list_grow_st (fl, fl->fl_num_per_alloc)) {
/* try to make progress */
opal_progress ();
}
item = (opal_free_list_item_t *) opal_lifo_pop (&fl->super);
}
return item;
}
static inline opal_free_list_item_t *opal_free_list_wait (opal_free_list_t *fl)
{
if (opal_using_threads ()) {
return opal_free_list_wait_mt (fl);
} else {
return opal_free_list_wait_st (fl);
}
}
/**
* Return an item to a free list.
@ -146,18 +312,54 @@ OPAL_DECLSPEC int opal_free_list_grow(opal_free_list_t* flist, size_t num_elemen
* @param item (OUT) Allocated item.
*
*/
#define OPAL_FREE_LIST_RETURN(fl, item) \
do { \
OPAL_THREAD_LOCK(&(fl)->fl_lock); \
opal_list_prepend(&((fl)->super), ((opal_list_item_t*) item)); \
if( OPAL_UNLIKELY((fl)->fl_num_waiting > 0) ) { \
opal_condition_signal(&((fl)->fl_condition)); \
} \
OPAL_THREAD_UNLOCK(&(fl)->fl_lock); \
} while(0)
static inline void opal_free_list_return_mt (opal_free_list_t *flist,
opal_free_list_item_t *item)
{
opal_list_item_t* original;
original = opal_lifo_push_atomic (&flist->super, &item->super);
if (&flist->super.opal_lifo_ghost == original) {
if (flist->fl_num_waiting > 0) {
/* one one item is being returned so it doesn't make sense to wake
* more than a single waiting thread. additionally, posix thread
* semantics do not require that the lock be held to signal the
* condition variable. */
opal_condition_signal (&flist->fl_condition);
}
}
}
static inline void opal_free_list_return_st (opal_free_list_t *flist,
opal_free_list_item_t *item)
{
opal_list_item_t* original;
original = opal_lifo_push_st (&flist->super, &item->super);
if (&flist->super.opal_lifo_ghost == original) {
if (flist->fl_num_waiting > 0) {
/* one one item is being returned so it doesn't make sense to wake
* more than a single waiting thread. additionally, posix thread
* semantics do not require that the lock be held to signal the
* condition variable. */
opal_condition_signal (&flist->fl_condition);
}
}
}
static inline void opal_free_list_return (opal_free_list_t *flist,
opal_free_list_item_t *item)
{
if (opal_using_threads ()) {
opal_free_list_return_mt (flist, item);
} else {
opal_free_list_return_st (flist, item);
}
}
/** compatibility macro */
#define OPAL_FREE_LIST_RETURN(fl, item) \
opal_free_list_return (fl, item)
END_C_DECLS
#endif

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -49,11 +52,10 @@ static void opal_rb_tree_construct(opal_object_t * object)
{
opal_rb_tree_t * tree = (opal_rb_tree_t *) object;
tree->root_ptr = NULL;
OBJ_CONSTRUCT(&(tree->free_list), ompi_free_list_t);
ompi_free_list_init_new(&(tree->free_list), sizeof(opal_rb_tree_node_t),
OBJ_CONSTRUCT(&(tree->free_list), opal_free_list_t);
opal_free_list_init (&(tree->free_list), sizeof(opal_rb_tree_node_t),
opal_cache_line_size, OBJ_CLASS(opal_rb_tree_node_t),
0,opal_cache_line_size,
0, -1 , 128, NULL);
0,opal_cache_line_size, 0, -1 , 128, NULL, 0, NULL, NULL, NULL);
}
/**
@ -71,7 +73,7 @@ static void opal_rb_tree_destruct(opal_object_t * object)
}
/* declare the instance of the classes */
OBJ_CLASS_INSTANCE(opal_rb_tree_node_t, ompi_free_list_item_t, NULL, NULL);
OBJ_CLASS_INSTANCE(opal_rb_tree_node_t, opal_free_list_item_t, NULL, NULL);
OBJ_CLASS_INSTANCE(opal_rb_tree_t, opal_object_t, opal_rb_tree_construct,
opal_rb_tree_destruct);
@ -79,17 +81,17 @@ OBJ_CLASS_INSTANCE(opal_rb_tree_t, opal_object_t, opal_rb_tree_construct,
int opal_rb_tree_init(opal_rb_tree_t * tree,
opal_rb_tree_comp_fn_t comp)
{
ompi_free_list_item_t * node;
opal_free_list_item_t * node;
/* we need to get memory for the root pointer from the free list */
OMPI_FREE_LIST_GET_MT(&(tree->free_list), node);
node = opal_free_list_get (&(tree->free_list));
tree->root_ptr = (opal_rb_tree_node_t *) node;
if (NULL == node) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
OMPI_FREE_LIST_GET_MT(&(tree->free_list), node);
node = opal_free_list_get (&(tree->free_list));
if (NULL == node) {
OMPI_FREE_LIST_RETURN_MT(&(tree->free_list), (ompi_free_list_item_t*)tree->root_ptr);
opal_free_list_return (&tree->free_list, (opal_free_list_item_t*)tree->root_ptr);
return OPAL_ERR_OUT_OF_RESOURCE;
}
tree->nill = (opal_rb_tree_node_t *) node;
@ -119,10 +121,10 @@ int opal_rb_tree_insert(opal_rb_tree_t *tree, void * key, void * value)
{
opal_rb_tree_node_t * y;
opal_rb_tree_node_t * node;
ompi_free_list_item_t * item;
opal_free_list_item_t * item;
/* get the memory for a node */
OMPI_FREE_LIST_GET_MT(&(tree->free_list), item);
item = opal_free_list_get (&tree->free_list);
if (NULL == item) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
@ -226,7 +228,7 @@ int opal_rb_tree_delete(opal_rb_tree_t *tree, void *key)
opal_rb_tree_node_t * p;
opal_rb_tree_node_t * todelete;
opal_rb_tree_node_t * y;
ompi_free_list_item_t * item;
opal_free_list_item_t * item;
p = opal_rb_tree_find_node(tree, key);
if (NULL == p) {
@ -264,8 +266,8 @@ int opal_rb_tree_delete(opal_rb_tree_t *tree, void *key)
if (todelete->color == BLACK) {
btree_delete_fixup(tree, y);
}
item = (ompi_free_list_item_t *) todelete;
OMPI_FREE_LIST_RETURN_MT(&(tree->free_list), item);
item = (opal_free_list_item_t *) todelete;
opal_free_list_return (&(tree->free_list), item);
--tree->tree_size;
return OPAL_SUCCESS;
}
@ -274,18 +276,18 @@ int opal_rb_tree_delete(opal_rb_tree_t *tree, void *key)
/* Destroy the hashmap */
int opal_rb_tree_destroy(opal_rb_tree_t *tree)
{
ompi_free_list_item_t * item;
opal_free_list_item_t * item;
/* Recursive inorder traversal for delete */
inorder_destroy(tree, tree->root_ptr);
/* Now free the root -- root does not get free'd in the above
* inorder destroy */
item = (ompi_free_list_item_t *) tree->root_ptr;
OMPI_FREE_LIST_RETURN_MT(&(tree->free_list), item);
item = (opal_free_list_item_t *) tree->root_ptr;
opal_free_list_return(&(tree->free_list), item);
/* free the tree->nill node */
item = (ompi_free_list_item_t *) tree->nill;
OMPI_FREE_LIST_RETURN_MT(&(tree->free_list), item);
item = (opal_free_list_item_t *) tree->nill;
opal_free_list_return (&(tree->free_list), item);
return OPAL_SUCCESS;
}
@ -419,7 +421,7 @@ static void btree_delete_fixup(opal_rb_tree_t *tree, opal_rb_tree_node_t * x)
static void
inorder_destroy(opal_rb_tree_t *tree, opal_rb_tree_node_t * node)
{
ompi_free_list_item_t * item;
opal_free_list_item_t * item;
if (node == tree->nill) {
return;
@ -428,16 +430,16 @@ inorder_destroy(opal_rb_tree_t *tree, opal_rb_tree_node_t * node)
inorder_destroy(tree, node->left);
if (node->left != tree->nill) {
item = (ompi_free_list_item_t *) node->left;
item = (opal_free_list_item_t *) node->left;
--tree->tree_size;
OMPI_FREE_LIST_RETURN_MT(&(tree->free_list), item);
opal_free_list_return (&tree->free_list, item);
}
inorder_destroy(tree, node->right);
if (node->right != tree->nill) {
item = (ompi_free_list_item_t *) node->right;
item = (opal_free_list_item_t *) node->right;
--tree->tree_size;
OMPI_FREE_LIST_RETURN_MT(&(tree->free_list), item);
opal_free_list_return (&tree->free_list, item);
}
}

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -29,7 +32,7 @@
#include <stdlib.h>
#include "opal/constants.h"
#include "opal/class/opal_object.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
BEGIN_C_DECLS
/*
@ -46,7 +49,7 @@ typedef enum {RED, BLACK} opal_rb_tree_nodecolor_t;
*/
struct opal_rb_tree_node_t
{
ompi_free_list_item_t super; /**< the parent class */
opal_free_list_item_t super; /**< the parent class */
opal_rb_tree_nodecolor_t color; /**< the node color */
struct opal_rb_tree_node_t * parent;/**< the parent node, can be NULL */
struct opal_rb_tree_node_t * left; /**< the left child - can be nill */
@ -72,7 +75,7 @@ struct opal_rb_tree_t {
opal_rb_tree_node_t * root_ptr; /**< a pointer to the root of the tree */
opal_rb_tree_node_t * nill; /**< the nill sentinal node */
opal_rb_tree_comp_fn_t comp; /**< the compare function */
ompi_free_list_t free_list; /**< the free list to get the memory from */
opal_free_list_t free_list; /**< the free list to get the memory from */
size_t tree_size; /**< the size of the tree */
};
typedef struct opal_rb_tree_t opal_rb_tree_t;

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -12,6 +13,8 @@
* Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -50,7 +53,7 @@ mca_allocator_base_component_t mca_allocator_basic_component = {
OBJ_CLASS_INSTANCE(
mca_allocator_basic_segment_t,
ompi_free_list_item_t,
opal_free_list_item_t,
NULL,
NULL);
@ -93,9 +96,9 @@ mca_allocator_base_module_t* mca_allocator_basic_component_init(
module->seg_free = segment_free;
OBJ_CONSTRUCT(&module->seg_list, opal_list_t);
OBJ_CONSTRUCT(&module->seg_lock, opal_mutex_t);
OBJ_CONSTRUCT(&module->seg_descriptors, ompi_free_list_t);
OBJ_CONSTRUCT(&module->seg_descriptors, opal_free_list_t);
ompi_free_list_init_new(&module->seg_descriptors,
opal_free_list_init (&module->seg_descriptors,
sizeof(mca_allocator_basic_segment_t),
opal_cache_line_size,
OBJ_CLASS(mca_allocator_basic_segment_t),
@ -103,7 +106,7 @@ mca_allocator_base_module_t* mca_allocator_basic_component_init(
0, /* initial size */
-1, /* maximum size */
16, /* increment to grow by */
NULL);
NULL, 0, NULL, NULL, NULL);
return &module->super;
}
@ -122,7 +125,7 @@ static void mca_allocator_basic_combine_prev(
if(prev->seg_addr + prev->seg_size == seg->seg_addr) {
prev->seg_size += seg->seg_size;
opal_list_remove_item(&module->seg_list, &seg->seg_item.super);
OMPI_FREE_LIST_RETURN_MT(&module->seg_descriptors, &seg->seg_item);
opal_free_list_return (&module->seg_descriptors, &seg->seg_item);
return;
}
}
@ -139,7 +142,7 @@ static void mca_allocator_basic_combine_next(
next->seg_addr = seg->seg_addr;
next->seg_size += seg->seg_size;
opal_list_remove_item(&module->seg_list, &seg->seg_item.super);
OMPI_FREE_LIST_RETURN_MT(&module->seg_descriptors, &seg->seg_item);
opal_free_list_return (&module->seg_descriptors, &seg->seg_item);
return;
}
}
@ -165,7 +168,6 @@ void *mca_allocator_basic_alloc(
{
mca_allocator_basic_module_t* module = (mca_allocator_basic_module_t*)base;
mca_allocator_basic_segment_t* seg;
ompi_free_list_item_t* item;
unsigned char* addr;
size_t allocated_size;
OPAL_THREAD_LOCK(&module->seg_lock);
@ -175,11 +177,7 @@ void *mca_allocator_basic_alloc(
/* normalize size so we don't end up with seg_addr on an odd boundary */
size += sizeof(size_t) - (size & (sizeof(size_t) - 1));
/* search the list for a segment of the required size */
for(item = (ompi_free_list_item_t*) opal_list_get_first(&module->seg_list);
item != (ompi_free_list_item_t*) opal_list_get_end(&module->seg_list);
item = (ompi_free_list_item_t*) opal_list_get_next(&item->super)) {
seg = (mca_allocator_basic_segment_t*)item;
OPAL_LIST_FOREACH(seg, &module->seg_list, mca_allocator_basic_segment_t) {
/* split the segment */
if(seg->seg_size > size) {
addr = seg->seg_addr;
@ -190,8 +188,8 @@ void *mca_allocator_basic_alloc(
return addr+sizeof(size_t);
} else if (seg->seg_size == size) {
addr = seg->seg_addr;
opal_list_remove_item(&module->seg_list, &item->super);
OMPI_FREE_LIST_RETURN_MT(&module->seg_descriptors, item);
opal_list_remove_item(&module->seg_list, (opal_list_item_t *) seg);
opal_free_list_return (&module->seg_descriptors, (opal_free_list_item_t *) seg);
OPAL_THREAD_UNLOCK(&module->seg_lock);
*(size_t*)addr = size;
return addr+sizeof(size_t);
@ -207,15 +205,14 @@ void *mca_allocator_basic_alloc(
/* create a segment for any extra allocation */
if(allocated_size > size) {
OMPI_FREE_LIST_GET_MT(&module->seg_descriptors, item);
if(NULL == item) {
seg = (mca_allocator_basic_segment_t *) opal_free_list_get (&module->seg_descriptors);
if (NULL == seg) {
OPAL_THREAD_UNLOCK(&module->seg_lock);
return NULL;
}
seg = (mca_allocator_basic_segment_t*)item;
seg->seg_addr = addr + size;
seg->seg_size = allocated_size - size;
opal_list_append(&module->seg_list, &item->super);
opal_list_append (&module->seg_list, (opal_list_item_t *) seg);
}
*(size_t*)addr = size;
@ -274,17 +271,12 @@ void mca_allocator_basic_free(
{
mca_allocator_basic_module_t* module = (mca_allocator_basic_module_t*)base;
mca_allocator_basic_segment_t* seg;
ompi_free_list_item_t *item;
unsigned char* addr = (unsigned char*)ptr - sizeof(size_t);
size_t size = *(size_t*)addr;
OPAL_THREAD_LOCK(&module->seg_lock);
/* maintain the free list in sorted order by address */
for(item = (ompi_free_list_item_t*) opal_list_get_first(&module->seg_list);
item != (ompi_free_list_item_t*) opal_list_get_end(&module->seg_list);
item = (ompi_free_list_item_t*) opal_list_get_next((&item->super))) {
seg = (mca_allocator_basic_segment_t*)item;
OPAL_LIST_FOREACH(seg, &module->seg_list, mca_allocator_basic_segment_t) {
if (seg->seg_addr < addr) {
/* can we grow the current entry */
@ -309,15 +301,15 @@ void mca_allocator_basic_free(
/* insert before larger entry */
} else {
mca_allocator_basic_segment_t* new_seg;
OMPI_FREE_LIST_GET_MT(&module->seg_descriptors, item);
if(NULL == item) {
new_seg = (mca_allocator_basic_segment_t *)
opal_free_list_get (&module->seg_descriptors);
if(NULL == new_seg) {
OPAL_THREAD_UNLOCK(&module->seg_lock);
return;
}
new_seg = (mca_allocator_basic_segment_t*)item;
new_seg->seg_addr = addr;
new_seg->seg_size = size;
opal_list_insert_pos(&module->seg_list, &seg->seg_item.super, &item->super);
opal_list_insert_pos(&module->seg_list, &seg->seg_item.super, (opal_list_item_t *) new_seg);
OPAL_THREAD_UNLOCK(&module->seg_lock);
return;
}
@ -325,15 +317,14 @@ void mca_allocator_basic_free(
}
/* append to the end of the list */
OMPI_FREE_LIST_GET_MT(&module->seg_descriptors, item);
if(NULL == item) {
seg = (mca_allocator_basic_segment_t *) opal_free_list_get (&module->seg_descriptors);
if(NULL == seg) {
OPAL_THREAD_UNLOCK(&module->seg_lock);
return;
}
seg = (mca_allocator_basic_segment_t*)item;
seg->seg_addr = addr;
seg->seg_size = size;
opal_list_append(&module->seg_list, &item->super);
opal_list_append(&module->seg_list, (opal_list_item_t *) seg);
OPAL_THREAD_UNLOCK(&module->seg_lock);
}

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

@ -1,4 +1,5 @@
/**
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
@ -9,6 +10,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -27,7 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include "opal/threads/mutex.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "opal/mca/allocator/allocator.h"
@ -36,7 +39,7 @@
*/
struct mca_allocator_basic_segment_t {
ompi_free_list_item_t seg_item;
opal_free_list_item_t seg_item;
unsigned char* seg_addr;
size_t seg_size;
};
@ -53,7 +56,7 @@ struct mca_allocator_basic_module_t {
mca_allocator_base_component_segment_free_fn_t seg_free;
opal_list_t seg_list;
opal_mutex_t seg_lock;
ompi_free_list_t seg_descriptors;
opal_free_list_t seg_descriptors;
};
typedef struct mca_allocator_basic_module_t mca_allocator_basic_module_t;

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

@ -380,7 +380,7 @@ typedef struct mca_btl_base_segment_t mca_btl_base_segment_t;
*/
struct mca_btl_base_descriptor_t {
ompi_free_list_item_t super;
opal_free_list_item_t super;
mca_btl_base_segment_t *des_segments; /**< local segments */
size_t des_segment_count; /**< number of local segments */
mca_btl_base_completion_fn_t des_cbfunc; /**< local callback function */

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2007-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2008-2012 Oracle and/or its affiliates. All rights reserved.
@ -636,8 +636,8 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
}
for (int qp_index = 0 ; qp_index < mca_btl_openib_component.num_qps ; qp_index++) {
OBJ_CONSTRUCT(&device->qps[qp_index].send_free, ompi_free_list_t);
OBJ_CONSTRUCT(&device->qps[qp_index].recv_free, ompi_free_list_t);
OBJ_CONSTRUCT(&device->qps[qp_index].send_free, opal_free_list_t);
OBJ_CONSTRUCT(&device->qps[qp_index].recv_free, opal_free_list_t);
}
if(mca_btl_openib_component.use_async_event_thread) {
@ -726,13 +726,13 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
init_data->order = MCA_BTL_NO_ORDER;
init_data->list = &device->send_free_control;
rc = ompi_free_list_init_ex_new(&device->send_free_control,
rc = opal_free_list_init(&device->send_free_control,
sizeof(mca_btl_openib_send_control_frag_t), opal_cache_line_size,
OBJ_CLASS(mca_btl_openib_send_control_frag_t), length,
mca_btl_openib_component.buffer_alignment,
mca_btl_openib_component.ib_free_list_num, -1,
mca_btl_openib_component.ib_free_list_inc,
device->mpool, mca_btl_openib_frag_init,
device->mpool, 0, NULL, mca_btl_openib_frag_init,
init_data);
if (OPAL_SUCCESS != rc) {
/* If we're "out of memory", this usually means that we ran
@ -741,7 +741,7 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
OPAL_ERR_TEMP_OUT_OF_RESOURCE == rc) {
errno = ENOMEM;
mca_btl_openib_show_init_error(__FILE__, __LINE__,
"ompi_free_list_init_ex_new",
"opal_free_list_init",
ibv_get_device_name(device->ib_dev));
}
return rc;
@ -765,15 +765,15 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
init_data->order = qp;
init_data->list = &device->qps[qp].send_free;
rc = ompi_free_list_init_ex_new(init_data->list,
rc = opal_free_list_init (init_data->list,
sizeof(mca_btl_openib_send_frag_t), opal_cache_line_size,
OBJ_CLASS(mca_btl_openib_send_frag_t), length,
mca_btl_openib_component.buffer_alignment,
mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
device->mpool, mca_btl_openib_frag_init,
init_data);
device->mpool, 0, NULL, mca_btl_openib_frag_init,
init_data);
if (OPAL_SUCCESS != rc) {
/* If we're "out of memory", this usually means that we
ran out of registered memory, so show that error
@ -782,7 +782,7 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
OPAL_ERR_TEMP_OUT_OF_RESOURCE == rc) {
errno = ENOMEM;
mca_btl_openib_show_init_error(__FILE__, __LINE__,
"ompi_free_list_init_ex_new",
"opal_free_list_init",
ibv_get_device_name(device->ib_dev));
}
return OPAL_ERROR;
@ -798,14 +798,14 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
init_data->order = qp;
init_data->list = &device->qps[qp].recv_free;
if(OPAL_SUCCESS != ompi_free_list_init_ex_new(init_data->list,
if(OPAL_SUCCESS != opal_free_list_init (init_data->list,
sizeof(mca_btl_openib_recv_frag_t), opal_cache_line_size,
OBJ_CLASS(mca_btl_openib_recv_frag_t),
length, mca_btl_openib_component.buffer_alignment,
mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
device->mpool, mca_btl_openib_frag_init,
device->mpool, 0, NULL, mca_btl_openib_frag_init,
init_data)) {
return OPAL_ERROR;
}
@ -1117,11 +1117,11 @@ ib_frag_alloc(mca_btl_openib_module_t *btl, size_t size, uint8_t order,
uint32_t flags)
{
int qp;
ompi_free_list_item_t* item = NULL;
opal_free_list_item_t* item = NULL;
for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) {
if(mca_btl_openib_component.qp_infos[qp].size >= size) {
OMPI_FREE_LIST_GET_MT(&btl->device->qps[qp].send_free, item);
item = opal_free_list_get (&btl->device->qps[qp].send_free);
if(item)
break;
}
@ -1547,7 +1547,7 @@ int mca_btl_openib_sendi( struct mca_btl_base_module_t* btl,
prio = flags & MCA_BTL_DES_FLAGS_PRIORITY,
ib_rc;
bool do_rdma = false;
ompi_free_list_item_t* item = NULL;
opal_free_list_item_t* item = NULL;
mca_btl_openib_frag_t *frag;
mca_btl_openib_header_t *hdr;
int send_signaled;
@ -1577,7 +1577,7 @@ int mca_btl_openib_sendi( struct mca_btl_base_module_t* btl,
}
/* Allocate fragment */
OMPI_FREE_LIST_GET_MT(&obtl->device->qps[qp].send_free, item);
item = opal_free_list_get (&obtl->device->qps[qp].send_free);
if(OPAL_UNLIKELY(NULL == item)) {
/* we don't return NULL because maybe later we will try to coalesce */
goto cant_send_wqe;

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

@ -38,7 +38,6 @@
#include <infiniband/verbs.h>
/* Open MPI includes */
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_pointer_array.h"
#include "opal/class/opal_hash_table.h"
#include "opal/util/output.h"
@ -285,11 +284,11 @@ struct mca_btl_openib_component_t {
int credits_qp; /* qp used for software flow control */
bool cpc_explicitly_defined;
/**< free list of frags only; used for pining user memory */
ompi_free_list_t send_user_free;
opal_free_list_t send_user_free;
/**< free list of frags only; used for pining user memory */
ompi_free_list_t recv_user_free;
opal_free_list_t recv_user_free;
/**< frags for coalesced massages */
ompi_free_list_t send_free_coalesced;
opal_free_list_t send_free_coalesced;
/** Default receive queues */
char* default_recv_qps;
/** GID index to use */
@ -358,8 +357,8 @@ typedef struct mca_btl_openib_modex_message_t {
} while (0)
typedef struct mca_btl_openib_device_qp_t {
ompi_free_list_t send_free; /**< free lists of send buffer descriptors */
ompi_free_list_t recv_free; /**< free lists of receive buffer descriptors */
opal_free_list_t send_free; /**< free lists of send buffer descriptors */
opal_free_list_t recv_free; /**< free lists of receive buffer descriptors */
} mca_btl_openib_device_qp_t;
struct mca_btl_base_endpoint_t;
@ -403,7 +402,7 @@ typedef struct mca_btl_openib_device_t {
int32_t eager_rdma_buffers_count;
struct mca_btl_base_endpoint_t **eager_rdma_buffers;
/**< frags for control massages */
ompi_free_list_t send_free_control;
opal_free_list_t send_free_control;
/* QP types and attributes that will be used on this device */
mca_btl_openib_device_qp_t *qps;
/* Maximum value supported by this device for max_inline_data */

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

@ -12,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved.
@ -919,7 +919,7 @@ static void device_construct(mca_btl_openib_device_t *device)
mca_btl_openib_component.async_comp_pipe[0] =
mca_btl_openib_component.async_comp_pipe[1] = -1;
OBJ_CONSTRUCT(&device->device_lock, opal_mutex_t);
OBJ_CONSTRUCT(&device->send_free_control, ompi_free_list_t);
OBJ_CONSTRUCT(&device->send_free_control, opal_free_list_t);
device->max_inline_data = 0;
device->ready_for_use = false;
}
@ -2566,9 +2566,9 @@ btl_openib_component_init(int *num_btl_modules,
}
}
OBJ_CONSTRUCT(&mca_btl_openib_component.send_free_coalesced, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_openib_component.send_user_free, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_openib_component.recv_user_free, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_openib_component.send_free_coalesced, opal_free_list_t);
OBJ_CONSTRUCT(&mca_btl_openib_component.send_user_free, opal_free_list_t);
OBJ_CONSTRUCT(&mca_btl_openib_component.recv_user_free, opal_free_list_t);
init_data = (mca_btl_openib_frag_init_data_t *) malloc(sizeof(mca_btl_openib_frag_init_data_t));
if (NULL == init_data) {
@ -2583,7 +2583,7 @@ btl_openib_component_init(int *num_btl_modules,
occur on some 32-bit platforms. Depending on the size of the fragment this
will waste 2-6 bytes of space per frag. In most cases this shouldn't waste
any space. */
if (OPAL_SUCCESS != ompi_free_list_init_ex_new(
if (OPAL_SUCCESS != opal_free_list_init (
&mca_btl_openib_component.send_user_free,
sizeof(mca_btl_openib_put_frag_t), 8,
OBJ_CLASS(mca_btl_openib_put_frag_t),
@ -2591,7 +2591,7 @@ btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
NULL, mca_btl_openib_frag_init, init_data)) {
NULL, 0, NULL, mca_btl_openib_frag_init, init_data)) {
goto no_btls;
}
@ -2604,7 +2604,7 @@ btl_openib_component_init(int *num_btl_modules,
init_data->order = mca_btl_openib_component.rdma_qp;
init_data->list = &mca_btl_openib_component.recv_user_free;
if(OPAL_SUCCESS != ompi_free_list_init_ex_new(
if(OPAL_SUCCESS != opal_free_list_init (
&mca_btl_openib_component.recv_user_free,
sizeof(mca_btl_openib_get_frag_t), 8,
OBJ_CLASS(mca_btl_openib_get_frag_t),
@ -2612,7 +2612,7 @@ btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
NULL, mca_btl_openib_frag_init, init_data)) {
NULL, 0, NULL, mca_btl_openib_frag_init, init_data)) {
goto no_btls;
}
@ -2625,13 +2625,13 @@ btl_openib_component_init(int *num_btl_modules,
init_data->list = &mca_btl_openib_component.send_free_coalesced;
if(OPAL_SUCCESS != ompi_free_list_init_ex(
if(OPAL_SUCCESS != opal_free_list_init (
&mca_btl_openib_component.send_free_coalesced,
length, 8, OBJ_CLASS(mca_btl_openib_coalesced_frag_t),
mca_btl_openib_component.ib_free_list_num,
0, 0, mca_btl_openib_component.ib_free_list_num,
mca_btl_openib_component.ib_free_list_max,
mca_btl_openib_component.ib_free_list_inc,
NULL, mca_btl_openib_frag_init, init_data)) {
NULL, 0, NULL, mca_btl_openib_frag_init, init_data)) {
goto no_btls;
}
@ -3819,8 +3819,8 @@ int mca_btl_openib_post_srr(mca_btl_openib_module_t* openib_btl, const int qp)
}
for(i = 0; i < num_post; i++) {
ompi_free_list_item_t* item;
OMPI_FREE_LIST_WAIT_MT(&openib_btl->device->qps[qp].recv_free, item);
opal_free_list_item_t* item;
item = opal_free_list_wait (&openib_btl->device->qps[qp].recv_free);
to_base_frag(item)->base.order = qp;
to_com_frag(item)->endpoint = NULL;
if(NULL == wr)

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2006-2009 Mellanox Technologies, Inc. All rights reserved.
@ -43,7 +43,7 @@
#include "opal/util/output.h"
#include "opal/util/proc.h"
#include "opal/util/show_help.h"
#include "opal/class/ompi_free_list.h"
#include "opal/class/opal_free_list.h"
#include "btl_openib_endpoint.h"
#include "btl_openib_proc.h"
@ -908,11 +908,11 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
sizeof(mca_btl_openib_header_t);
for(i = 0; i < mca_btl_openib_component.eager_rdma_num; i++) {
ompi_free_list_item_t *item;
opal_free_list_item_t *item;
mca_btl_openib_recv_frag_t * frag;
mca_btl_openib_frag_init_data_t init_data;
item = (ompi_free_list_item_t*)&headers_buf[i];
item = (opal_free_list_item_t*)&headers_buf[i];
item->registration = (mca_mpool_base_registration_t *)endpoint->eager_rdma_local.reg;
item->ptr = buf + i * openib_btl->eager_rdma_frag_size;
OBJ_CONSTRUCT(item, mca_btl_openib_recv_frag_t);

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

@ -11,7 +11,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2007-2009 Mellanox Technologies. All rights reserved.
@ -369,8 +369,8 @@ static inline int post_recvs(mca_btl_base_endpoint_t *ep, const int qp,
return OPAL_SUCCESS;
for(i = 0; i < num_post; i++) {
ompi_free_list_item_t* item;
OMPI_FREE_LIST_WAIT_MT(&openib_btl->device->qps[qp].recv_free, item);
opal_free_list_item_t* item;
item = opal_free_list_wait (&openib_btl->device->qps[qp].recv_free);
to_base_frag(item)->base.order = qp;
to_com_frag(item)->endpoint = ep;
if(NULL == wr)

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -9,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2006-2007 Voltaire All rights reserved.
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
@ -24,7 +25,7 @@
#include "btl_openib_frag.h"
#include "btl_openib_eager_rdma.h"
void mca_btl_openib_frag_init(ompi_free_list_item_t* item, void* ctx)
int mca_btl_openib_frag_init(opal_free_list_item_t* item, void* ctx)
{
mca_btl_openib_frag_init_data_t* init_data = (mca_btl_openib_frag_init_data_t *) ctx;
mca_btl_openib_frag_t *frag = to_base_frag(item);
@ -42,6 +43,8 @@ void mca_btl_openib_frag_init(ompi_free_list_item_t* item, void* ctx)
to_send_frag(frag)->qp_idx = init_data->order;
frag->list = init_data->list;
return OPAL_SUCCESS;
}
static void base_constructor(mca_btl_openib_frag_t *frag)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше