2011-11-02 15:07:57 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2011-10-20 21:39:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2013-07-04 08:34:37 +00:00
|
|
|
* Copyright (c) 2004-2013 The University of Tennessee and The University
|
2011-10-20 21:39:44 +00:00
|
|
|
* 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) 2008 Sun Microsystems, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
2013-03-27 22:10:02 +00:00
|
|
|
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
|
2011-10-20 21:39:44 +00:00
|
|
|
* reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_BTL_VADER_SEND_FRAG_H
|
|
|
|
#define MCA_BTL_VADER_SEND_FRAG_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2011-10-25 18:38:42 +00:00
|
|
|
#define MCA_BTL_VADER_FLAG_INLINE 0
|
|
|
|
#define MCA_BTL_VADER_FLAG_SINGLE_COPY 1
|
2011-10-27 20:22:46 +00:00
|
|
|
#define MCA_BTL_VADER_FLAG_FBOX 2
|
2011-10-25 18:38:42 +00:00
|
|
|
|
2011-10-20 21:39:44 +00:00
|
|
|
struct mca_btl_vader_hdr_t {
|
2012-03-15 20:12:59 +00:00
|
|
|
volatile intptr_t next; /* next item in fifo. many peers may touch this */
|
2011-10-25 19:21:45 +00:00
|
|
|
volatile bool complete; /* fragment completion (usually 1 byte) */
|
|
|
|
mca_btl_base_tag_t tag; /* tag associated with this fragment (used to lookup callback) */
|
2011-10-25 18:38:42 +00:00
|
|
|
int flags; /* vader send flags */
|
2011-10-25 19:21:45 +00:00
|
|
|
int my_smp_rank; /* smp rank of owning process */
|
|
|
|
size_t len; /* length of data following this header */
|
2012-12-13 23:18:53 +00:00
|
|
|
struct iovec sc_iov; /* io vector containing pointer to single-copy data */
|
2011-10-20 21:39:44 +00:00
|
|
|
};
|
|
|
|
typedef struct mca_btl_vader_hdr_t mca_btl_vader_hdr_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* shared memory send fragment derived type.
|
|
|
|
*/
|
|
|
|
struct mca_btl_vader_frag_t {
|
|
|
|
mca_btl_base_descriptor_t base;
|
2012-12-13 23:18:53 +00:00
|
|
|
mca_btl_base_segment_t segments[2];
|
2011-10-20 21:39:44 +00:00
|
|
|
struct mca_btl_base_endpoint_t *endpoint;
|
2012-02-22 18:32:40 +00:00
|
|
|
mca_btl_vader_hdr_t *hdr; /* in the shared memory region */
|
2011-10-20 21:39:44 +00:00
|
|
|
ompi_free_list_t *my_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct mca_btl_vader_frag_t mca_btl_vader_frag_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_vader_frag_t);
|
|
|
|
|
2012-03-15 20:12:46 +00:00
|
|
|
static inline int mca_btl_vader_frag_alloc (mca_btl_vader_frag_t **frag, ompi_free_list_t *list) {
|
|
|
|
ompi_free_list_item_t *item;
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-07-08 22:07:52 +00:00
|
|
|
OMPI_FREE_LIST_GET_MT(list, item);
|
2012-03-15 20:12:46 +00:00
|
|
|
*frag = (mca_btl_vader_frag_t *) item;
|
|
|
|
if (OPAL_LIKELY(NULL != item)) {
|
2013-03-27 22:10:02 +00:00
|
|
|
if (NULL == (*frag)->hdr) {
|
2013-07-08 22:07:52 +00:00
|
|
|
OMPI_FREE_LIST_RETURN_MT(list, (ompi_free_list_item_t *)*frag);
|
2013-03-27 22:10:02 +00:00
|
|
|
*frag = NULL;
|
|
|
|
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2012-03-15 20:12:46 +00:00
|
|
|
(*frag)->hdr->complete = false;
|
|
|
|
(*frag)->hdr->flags = MCA_BTL_VADER_FLAG_INLINE;
|
2012-12-13 23:18:53 +00:00
|
|
|
(*frag)->segments[0].seg_addr.pval = (char *)((*frag)->hdr + 1);
|
2012-03-15 20:12:46 +00:00
|
|
|
(*frag)->my_list = list;
|
|
|
|
}
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-07-04 08:34:37 +00:00
|
|
|
return OMPI_SUCCESS;
|
2012-03-15 20:12:46 +00:00
|
|
|
}
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-03-27 22:10:02 +00:00
|
|
|
void mca_btl_vader_frag_return (mca_btl_vader_frag_t *frag);
|
|
|
|
|
2012-03-15 20:12:46 +00:00
|
|
|
#define MCA_BTL_VADER_FRAG_ALLOC_EAGER(frag) \
|
|
|
|
mca_btl_vader_frag_alloc (&(frag), &mca_btl_vader_component.vader_frags_eager)
|
|
|
|
#define MCA_BTL_VADER_FRAG_ALLOC_USER(frag) \
|
|
|
|
mca_btl_vader_frag_alloc (&(frag), &mca_btl_vader_component.vader_frags_user)
|
2013-03-27 22:10:02 +00:00
|
|
|
#define MCA_BTL_VADER_FRAG_RETURN(frag) mca_btl_vader_frag_return(frag)
|
|
|
|
|
2012-03-15 20:12:46 +00:00
|
|
|
|
|
|
|
static inline void mca_btl_vader_frag_complete (mca_btl_vader_frag_t *frag) {
|
|
|
|
if (OPAL_UNLIKELY(MCA_BTL_DES_SEND_ALWAYS_CALLBACK & frag->base.des_flags)) {
|
|
|
|
/* completion callback */
|
|
|
|
frag->base.des_cbfunc(&mca_btl_vader.super, frag->endpoint,
|
|
|
|
&frag->base, OMPI_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OPAL_LIKELY(frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) {
|
|
|
|
MCA_BTL_VADER_FRAG_RETURN(frag);
|
|
|
|
}
|
|
|
|
}
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-03-27 22:10:02 +00:00
|
|
|
void mca_btl_vader_frag_init (ompi_free_list_item_t *item, void *ctx);
|
|
|
|
|
2011-10-20 21:39:44 +00:00
|
|
|
#endif /* MCA_BTL_VADER_SEND_FRAG_H */
|