1
1

btl: Use C99 sub-object naming when initializing BTL components

Two things to note:

 - This change will allow us to expand the BTL interface without
   having to worry about modifying BTLs that will not support the new
   interfaces. More on this will come later this year as part of the
   1.9 series.

 - C99 guarantees that uninitialed members of structs declared outside
   of functions (DATA binary section) will be initialized with
   0's. This allows us to drop stuff like .btl_flags = 0, or .btl_get
   = NULL.

This commit was SVN r31388.
Этот коммит содержится в:
Nathan Hjelm 2014-04-14 19:29:26 +00:00
родитель 1cddb2aae8
Коммит ccb33ff811
10 изменённых файлов: 145 добавлений и 275 удалений

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

@ -89,36 +89,23 @@
#endif
mca_btl_openib_module_t mca_btl_openib_module = {
{
&mca_btl_openib_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* exclusivity */
0, /* latency */
0, /* bandwidth */
0, /* TODO this should be PUT btl flags */
0, /* segment size */
mca_btl_openib_add_procs,
mca_btl_openib_del_procs,
NULL,
mca_btl_openib_finalize,
.super = {
.btl_component = &mca_btl_openib_component.super,
.btl_add_procs = mca_btl_openib_add_procs,
.btl_del_procs = mca_btl_openib_del_procs,
.btl_finalize = mca_btl_openib_finalize,
/* we need alloc free, pack */
mca_btl_openib_alloc,
mca_btl_openib_free,
mca_btl_openib_prepare_src,
mca_btl_openib_prepare_dst,
mca_btl_openib_send,
mca_btl_openib_sendi, /* send immediate */
mca_btl_openib_put,
mca_btl_openib_get,
mca_btl_base_dump,
NULL, /* mpool */
mca_btl_openib_register_error_cb, /* error call back registration */
mca_btl_openib_ft_event
.btl_alloc = mca_btl_openib_alloc,
.btl_free = mca_btl_openib_free,
.btl_prepare_src = mca_btl_openib_prepare_src,
.btl_prepare_dst = mca_btl_openib_prepare_dst,
.btl_send = mca_btl_openib_send,
.btl_sendi = mca_btl_openib_sendi, /* send immediate */
.btl_put = mca_btl_openib_put,
.btl_get = mca_btl_openib_get,
.btl_dump = mca_btl_base_dump,
.btl_register_error = mca_btl_openib_register_error_cb, /* error call back registration */
.btl_ft_event = mca_btl_openib_ft_event
}
};

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

@ -39,40 +39,22 @@
#include "btl_portals4_recv.h"
mca_btl_portals4_module_t mca_btl_portals4_module = {
{
&mca_btl_portals4_component.super,
.super = {
.btl_component = &mca_btl_portals4_component.super,
/* NOTE: All these default values are set in
/* NOTE: All the default values are set in
component_open() */
0, /* max size of first frag */
0, /* min send size */
0, /* max send size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* exclusivity - higher than sm, lower than self */
0, /* latency */
0, /* bandwidth */
0, /* btl flags */
0, /* btl segment size */
mca_btl_portals4_add_procs,
mca_btl_portals4_del_procs,
NULL, /* btl_register */
mca_btl_portals4_finalize,
mca_btl_portals4_alloc,
mca_btl_portals4_free,
mca_btl_portals4_prepare_src,
mca_btl_portals4_prepare_dst,
mca_btl_portals4_send,
NULL, /* mca_btl_portals4_sendi, */
NULL, /* mca_btl_portals4_put, */
mca_btl_portals4_get,
mca_btl_base_dump,
NULL, /* mpool */
NULL, /* register error */
NULL
.btl_add_procs = mca_btl_portals4_add_procs,
.btl_del_procs = mca_btl_portals4_del_procs,
.btl_finalize = mca_btl_portals4_finalize,
.btl_alloc = mca_btl_portals4_alloc,
.btl_free = mca_btl_portals4_free,
.btl_prepare_src = mca_btl_portals4_prepare_src,
.btl_prepare_dst = mca_btl_portals4_prepare_dst,
.btl_send = mca_btl_portals4_send,
.btl_get = mca_btl_portals4_get,
.btl_dump = mca_btl_base_dump,
},
};

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

@ -1,6 +1,6 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
@ -42,7 +42,6 @@ mca_btl_scif_module_t mca_btl_scif_module = {
.btl_component = &mca_btl_scif_component.super,
.btl_add_procs = mca_btl_scif_add_procs,
.btl_del_procs = mca_btl_scif_del_procs,
.btl_register = NULL,
.btl_finalize = mca_btl_scif_module_finalize,
.btl_alloc = mca_btl_scif_alloc,
.btl_free = mca_btl_scif_free,
@ -52,10 +51,6 @@ mca_btl_scif_module_t mca_btl_scif_module = {
.btl_sendi = mca_btl_scif_sendi,
.btl_put = mca_btl_scif_put,
.btl_get = mca_btl_scif_get,
.btl_dump = NULL,
.btl_mpool = NULL,
.btl_register_error = NULL,
.btl_ft_event = NULL,
}
};

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

@ -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) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -32,34 +35,18 @@
#include "ompi/proc/proc.h"
mca_btl_sctp_module_t mca_btl_sctp_module = {
{
&mca_btl_sctp_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* exclusivity */
0, /* latency */
0, /* bandwidth */
0, /* flags */
0, /* segment size */
mca_btl_sctp_add_procs,
mca_btl_sctp_del_procs,
NULL,
mca_btl_sctp_finalize,
mca_btl_sctp_alloc,
mca_btl_sctp_free,
mca_btl_sctp_prepare_src,
mca_btl_sctp_prepare_dst,
mca_btl_sctp_send,
NULL, /* send immediate */
mca_btl_sctp_put,
NULL, /* get */
mca_btl_base_dump,
NULL, /* mpool */
NULL /* register error */
.super = {
.btl_component = &mca_btl_sctp_component.super,
.btl_add_procs = mca_btl_sctp_add_procs,
.btl_del_procs = mca_btl_sctp_del_procs,
.btl_finalize = mca_btl_sctp_finalize,
.btl_alloc = mca_btl_sctp_alloc,
.btl_free = mca_btl_sctp_free,
.btl_prepare_src = mca_btl_sctp_prepare_src,
.btl_prepare_dst = mca_btl_sctp_prepare_dst,
.btl_send = mca_btl_sctp_send,
.btl_put = mca_btl_sctp_put,
.btl_dump = mca_btl_base_dump,
}
};

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

@ -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) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -35,34 +38,19 @@
#include "ompi/proc/proc.h"
mca_btl_base_module_t mca_btl_self = {
&mca_btl_self_component.super,
0, /* btl_eager_limit */
0, /* btl_rndv_eager_limit */
0, /* btl_max_send_size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* btl_exclusivity */
0, /* btl_latency */
0, /* btl_bandwidth */
0, /* btl flags */
0, /* btl segment size */
mca_btl_self_add_procs,
mca_btl_self_del_procs,
NULL,
mca_btl_self_finalize,
mca_btl_self_alloc,
mca_btl_self_free,
mca_btl_self_prepare_src,
mca_btl_self_prepare_dst,
mca_btl_self_send,
NULL, /* send immediate */
mca_btl_self_rdma, /* put */
mca_btl_self_rdma, /* get */
mca_btl_base_dump,
NULL, /* mpool */
NULL, /* register error cb */
mca_btl_self_ft_event
.btl_component = &mca_btl_self_component.super,
.btl_add_procs = mca_btl_self_add_procs,
.btl_del_procs = mca_btl_self_del_procs,
.btl_finalize = mca_btl_self_finalize,
.btl_alloc = mca_btl_self_alloc,
.btl_free = mca_btl_self_free,
.btl_prepare_src = mca_btl_self_prepare_src,
.btl_prepare_dst = mca_btl_self_prepare_dst,
.btl_send = mca_btl_self_send,
.btl_put = mca_btl_self_rdma,
.btl_get = mca_btl_self_rdma,
.btl_dump = mca_btl_base_dump,
.btl_ft_event = mca_btl_self_ft_event,
};

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -11,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2006-2007 Voltaire. All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2013 Los Alamos National Security, LLC.
* Copyright (c) 2010-2014 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2010-2012 IBM Corporation. All rights reserved.
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
@ -69,39 +70,22 @@
#include "ompi/proc/proc.h"
mca_btl_sm_t mca_btl_sm = {
{
&mca_btl_sm_component.super,
0, /* btl_eager_limit */
0, /* btl_rndv_eager_limit */
0, /* btl_max_send_size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* btl_exclusivity */
0, /* btl_latency */
0, /* btl_bandwidth */
0, /* btl flags */
0, /* btl segment size */
mca_btl_sm_add_procs,
mca_btl_sm_del_procs,
NULL,
mca_btl_sm_finalize,
mca_btl_sm_alloc,
mca_btl_sm_free,
mca_btl_sm_prepare_src,
.super = {
.btl_component = &mca_btl_sm_component.super,
.btl_add_procs = mca_btl_sm_add_procs,
.btl_del_procs = mca_btl_sm_del_procs,
.btl_finalize = mca_btl_sm_finalize,
.btl_alloc = mca_btl_sm_alloc,
.btl_free = mca_btl_sm_free,
.btl_prepare_src = mca_btl_sm_prepare_src,
#if OMPI_BTL_SM_HAVE_KNEM || OMPI_BTL_SM_HAVE_CMA
mca_btl_sm_prepare_dst,
#else /* OMPI_BTL_SM_HAVE_KNEM || OMPI_BTL_SM_HAVE_CMA */
NULL,
.btl_prepare_dst = mca_btl_sm_prepare_dst,
#endif /* OMPI_BTL_SM_HAVE_KNEM || OMPI_BTL_SM_HAVE_CMA */
mca_btl_sm_send,
mca_btl_sm_sendi,
NULL, /* put */
NULL, /* get -- optionally filled during initialization */
mca_btl_sm_dump,
NULL, /* mpool */
mca_btl_sm_register_error_cb, /* register error */
mca_btl_sm_ft_event
.btl_send = mca_btl_sm_send,
.btl_sendi = mca_btl_sm_sendi,
.btl_dump = mca_btl_sm_dump,
.btl_register_error = mca_btl_sm_register_error_cb, /* register error */
.btl_ft_event = mca_btl_sm_ft_event
}
};

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -11,7 +12,7 @@
* All rights reserved.
* Copyright (c) 2006-2007 Voltaire. All rights reserved.
* Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2012 Los Alamos National Security, LLC.
* Copyright (c) 2010-2014 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2012-2013 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
@ -71,39 +72,22 @@
#include "ompi/proc/proc.h"
mca_btl_smcuda_t mca_btl_smcuda = {
{
&mca_btl_smcuda_component.super,
0, /* btl_eager_limit */
0, /* btl_rndv_eager_limit */
0, /* btl_max_send_size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* btl_exclusivity */
0, /* btl_latency */
0, /* btl_bandwidth */
0, /* btl flags */
0, /* btl segment size */
mca_btl_smcuda_add_procs,
mca_btl_smcuda_del_procs,
NULL,
mca_btl_smcuda_finalize,
mca_btl_smcuda_alloc,
mca_btl_smcuda_free,
mca_btl_smcuda_prepare_src,
.super = {
.btl_component = &mca_btl_smcuda_component.super,
.btl_add_procs = mca_btl_smcuda_add_procs,
.btl_del_procs = mca_btl_smcuda_del_procs,
.btl_finalize = mca_btl_smcuda_finalize,
.btl_alloc = mca_btl_smcuda_alloc,
.btl_free = mca_btl_smcuda_free,
.btl_prepare_src = mca_btl_smcuda_prepare_src,
#if OPAL_CUDA_SUPPORT || OMPI_BTL_SM_HAVE_KNEM || OMPI_BTL_SM_HAVE_CMA
mca_btl_smcuda_prepare_dst,
#else
NULL,
#endif /* OPAL_CUDA_SUPPORT */
mca_btl_smcuda_send,
mca_btl_smcuda_sendi,
NULL, /* put */
NULL, /* get -- optionally filled during initialization */
mca_btl_smcuda_dump,
NULL, /* mpool */
mca_btl_smcuda_register_error_cb, /* register error */
mca_btl_smcuda_ft_event
.btl_prepare_dst = mca_btl_smcuda_prepare_dst,
#endif /* OPAL_CUDA_SUPPORT || OMPI_BTL_SM_HAVE_KNEM || OMPI_BTL_SM_HAVE_CMA */
.btl_send = mca_btl_smcuda_send,
.btl_sendi = mca_btl_smcuda_sendi,
.btl_dump = mca_btl_smcuda_dump,
.btl_register_error_cb = mca_btl_smcuda_register_error_cb,
.btl_ft_event = mca_btl_smcuda_ft_event
}
};

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

@ -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,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 Los Alamos National Security, LLC. All rights
* Copyright (c) 2006-2014 Los Alamos National Security, LLC. All rights
* reserved.
*
* $COPYRIGHT$
@ -34,35 +35,19 @@
#include "ompi/proc/proc.h"
mca_btl_tcp_module_t mca_btl_tcp_module = {
{
&mca_btl_tcp_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
0, /* btl_rdma_pipeline_send_length */
0, /* btl_rdma_pipeline_frag_size */
0, /* btl_min_rdma_pipeline_size */
0, /* exclusivity */
0, /* latency */
0, /* bandwidth */
0, /* flags */
0, /* segment size */
mca_btl_tcp_add_procs,
mca_btl_tcp_del_procs,
NULL,
mca_btl_tcp_finalize,
mca_btl_tcp_alloc,
mca_btl_tcp_free,
mca_btl_tcp_prepare_src,
mca_btl_tcp_prepare_dst,
mca_btl_tcp_send,
NULL, /* send immediate */
mca_btl_tcp_put,
NULL, /* get */
mca_btl_base_dump,
NULL, /* mpool */
NULL, /* register error */
mca_btl_tcp_ft_event
.super = {
.btl_component = &mca_btl_tcp_component.super,
.btl_add_procs = mca_btl_tcp_add_procs,
.btl_del_procs = mca_btl_tcp_del_procs,
.btl_finalize = mca_btl_tcp_finalize,
.btl_alloc = mca_btl_tcp_alloc,
.btl_free = mca_btl_tcp_free,
.btl_prepare_src = mca_btl_tcp_prepare_src,
.btl_prepare_dst = mca_btl_tcp_prepare_dst,
.btl_send = mca_btl_tcp_send,
.btl_put = mca_btl_tcp_put,
.btl_dump = mca_btl_base_dump,
.btl_ft_event = mca_btl_tcp_ft_event
}
};

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

@ -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) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -31,35 +34,19 @@
mca_btl_template_module_t mca_btl_template_module = {
{
&mca_btl_template_component.super,
0, /* max size of first fragment */
0, /* min send fragment size */
0, /* max send fragment size */
0, /* rdma pipeline offset */
0, /* rdma pipeline frag size */
0, /* min rdma pipeline size */
0, /* exclusivity */
0, /* latency */
0, /* bandwidth */
0, /* flags */
0, /* segment size */
mca_btl_template_add_procs,
mca_btl_template_del_procs,
mca_btl_template_register,
mca_btl_template_finalize,
mca_btl_template_alloc,
mca_btl_template_free,
mca_btl_template_prepare_src,
mca_btl_template_prepare_dst,
mca_btl_template_send,
NULL, /* send immediate */
mca_btl_template_put,
NULL, /* get */
NULL, /*dump */
NULL, /* mpool */
NULL, /* register error cb */
mca_btl_template_ft_event
.super = {
.btl_component = &mca_btl_template_component.super,
.btl_add_procs = mca_btl_template_add_procs,
.btl_del_procs = mca_btl_template_del_procs,
.btl_register = mca_btl_template_register,
.btl_finalize = mca_btl_template_finalize,
.btl_alloc = mca_btl_template_alloc,
.btl_free = mca_btl_template_free,
.btl_prepare_src = mca_btl_template_prepare_src,
.btl_prepare_dst = mca_btl_template_prepare_dst,
.btl_send = mca_btl_template_send,
.btl_put = mca_btl_template_put,
.btl_ft_event = mca_btl_template_ft_event
}
};

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

@ -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
@ -12,6 +13,8 @@
* Copyright (c) 2006 Sandia National Laboratories. All rights
* reserved.
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -2191,38 +2194,26 @@ static int usnic_ft_event(int state)
ompi_btl_usnic_module_t ompi_btl_usnic_module_template = {
{
&mca_btl_usnic_component.super,
0, /* eager_limit */
0, /* min_send_size */
0, /* max_send_size */
0, /* rdma_pipeline_send_length */
0, /* rdma_pipeline_frag_size */
0, /* min_rdma_pipeline_size */
MCA_BTL_EXCLUSIVITY_DEFAULT,
0, /* latency */
0, /* bandwidth */
MCA_BTL_FLAGS_SEND |
.super = {
.btl_component = &mca_btl_usnic_component.super,
.btl_exclusivity = MCA_BTL_EXCLUSIVITY_DEFAULT,
.btl_flags = MCA_BTL_FLAGS_SEND |
MCA_BTL_FLAGS_PUT |
MCA_BTL_FLAGS_SEND_INPLACE,
#ifndef OMPI_BTL_USNIC_CISCO_V1_6
sizeof(mca_btl_base_segment_t), /* seg size */
.btl_seg_size = sizeof(mca_btl_base_segment_t), /* seg size */
#endif
usnic_add_procs,
usnic_del_procs,
NULL, /*ompi_btl_usnic_register*/
usnic_finalize,
usnic_alloc,
usnic_free,
usnic_prepare_src,
usnic_prepare_dst,
usnic_send,
NULL, /* ompi_btl_usnic_sendi */
usnic_put,
NULL, /*ompi_btl_usnic_get */
mca_btl_base_dump,
NULL, /* mpool -- to be filled in later */
usnic_register_pml_err_cb,
usnic_ft_event
.btl_add_procs = usnic_add_procs,
.btl_del_procs = usnic_del_procs,
.btl_finalize = usnic_finalize,
.btl_alloc = usnic_alloc,
.btl_free = usnic_free,
.btl_prepare_src = usnic_prepare_src,
.btl_prepare_dst = usnic_prepare_dst,
.btl_send = usnic_send,
.btl_put = usnic_put,
.btl_dump = mca_btl_base_dump,
.btl_register_error = usnic_register_pml_err_cb,
.btl_ft_event = usnic_ft_event
}
};