Skip to content

Commit 7572c8b

Browse files
committed
btl: use flag enumerator for btl_*_flags and btl_*_atomic_flags
This commit uses the new flag "enumerator" to support comma-delimited lists of flags for both the btl and btl atomic flags. After this commit is is valid to specify something like -mca btl_foo_flags self,put,get,in-place. All non-deprecated flags are supported by the enumerator. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent b15a450 commit 7572c8b

File tree

2 files changed

+56
-28
lines changed

2 files changed

+56
-28
lines changed

opal/mca/btl/base/btl_base_frame.c

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
12
/*
23
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
34
* University Research and Technology
@@ -13,6 +14,8 @@
1314
* Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved.
1415
* Copyright (c) 2015 Research Organization for Information Science
1516
* and Technology (RIST). All rights reserved.
17+
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
18+
* reserved.
1619
* $COPYRIGHT$
1720
*
1821
* Additional copyrights may follow
@@ -30,6 +33,39 @@
3033
#include "opal/mca/btl/btl.h"
3134
#include "opal/mca/btl/base/base.h"
3235

36+
mca_base_var_enum_flag_t *mca_btl_base_flag_enum = NULL;
37+
mca_base_var_enum_flag_t *mca_btl_base_atomic_enum = NULL;
38+
39+
mca_base_var_enum_value_flag_t mca_btl_base_flag_enum_flags[] = {
40+
{MCA_BTL_FLAGS_SEND, "send", 0},
41+
{MCA_BTL_FLAGS_PUT, "put", 0},
42+
{MCA_BTL_FLAGS_GET, "get", 0},
43+
{MCA_BTL_FLAGS_SEND_INPLACE, "inplace", 0},
44+
{MCA_BTL_FLAGS_SIGNALED, "signaled", 0},
45+
{MCA_BTL_FLAGS_ATOMIC_OPS, "atomics", 0},
46+
{MCA_BTL_FLAGS_ATOMIC_FOPS, "fetching-atomics", 0},
47+
{MCA_BTL_FLAGS_SINGLE_ADD_PROCS, "static", 0},
48+
{MCA_BTL_FLAGS_CUDA_PUT, "cuda-put", 0},
49+
{MCA_BTL_FLAGS_CUDA_GET, "cuda-get", 0},
50+
{MCA_BTL_FLAGS_CUDA_COPY_ASYNC_SEND, "cuda-async-send", 0},
51+
{MCA_BTL_FLAGS_CUDA_COPY_ASYNC_RECV, "cuda-async-recv", 0},
52+
{MCA_BTL_FLAGS_FAILOVER_SUPPORT, "failover", 0},
53+
{MCA_BTL_FLAGS_NEED_ACK, "need-ack", 0},
54+
{MCA_BTL_FLAGS_NEED_CSUM, "need-csum", 0},
55+
{MCA_BTL_FLAGS_HETEROGENEOUS_RDMA, "hetero-rdma", 0},
56+
{0, NULL, 0}
57+
};
58+
59+
mca_base_var_enum_value_flag_t mca_btl_base_atomic_enum_flags[] = {
60+
{MCA_BTL_ATOMIC_SUPPORTS_ADD, "add", 0},
61+
{MCA_BTL_ATOMIC_SUPPORTS_AND, "and", 0},
62+
{MCA_BTL_ATOMIC_SUPPORTS_OR, "or", 0},
63+
{MCA_BTL_ATOMIC_SUPPORTS_XOR, "xor", 0},
64+
{MCA_BTL_ATOMIC_SUPPORTS_CSWAP, "compare-and-swap", 0},
65+
{MCA_BTL_ATOMIC_SUPPORTS_GLOB, "global"},
66+
{0, NULL, 0}
67+
};
68+
3369
mca_btl_active_message_callback_t mca_btl_base_active_message_trigger[MCA_BTL_TAG_MAX] = {{0}};
3470

3571
/*
@@ -104,6 +140,9 @@ static int mca_btl_base_register(mca_base_register_flag_t flags)
104140
MCA_BASE_VAR_SCOPE_READONLY,
105141
&mca_btl_base_warn_component_unused);
106142

143+
(void) mca_base_var_enum_create_flag ("btl_flags", mca_btl_base_flag_enum_flags, &mca_btl_base_flag_enum);
144+
(void) mca_base_var_enum_create_flag ("btl_atomic_flags", mca_btl_base_atomic_enum_flags, &mca_btl_base_atomic_enum);
145+
107146
return OPAL_SUCCESS;
108147
}
109148

@@ -159,6 +198,14 @@ static int mca_btl_base_close(void)
159198

160199
OBJ_DESTRUCT(&mca_btl_base_modules_initialized);
161200

201+
if (mca_btl_base_flag_enum) {
202+
OBJ_RELEASE(mca_btl_base_flag_enum);
203+
}
204+
205+
if (mca_btl_base_atomic_enum) {
206+
OBJ_RELEASE(mca_btl_base_atomic_enum);
207+
}
208+
162209
#if 0
163210
/* restore event processing */
164211
opal_event_enable();

opal/mca/btl/base/btl_base_mca.c

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
1616
* Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
17+
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights
18+
* reserved.
1719
*
1820
* $COPYRIGHT$
1921
*
@@ -34,8 +36,6 @@
3436
int mca_btl_base_param_register(mca_base_component_t *version,
3537
mca_btl_base_module_t *module)
3638
{
37-
char *msg;
38-
3939
/* If this is ever triggered change the uint32_ts in mca_btl_base_module_t to unsigned ints */
4040
assert(sizeof(unsigned int) == sizeof(uint32_t));
4141

@@ -46,33 +46,14 @@ int mca_btl_base_param_register(mca_base_component_t *version,
4646
MCA_BASE_VAR_SCOPE_READONLY,
4747
&module->btl_exclusivity);
4848

49-
asprintf(&msg, "BTL bit flags (general flags: SEND=%d, PUT=%d, GET=%d, SEND_INPLACE=%d, HETEROGENEOUS_RDMA=%d, "
50-
"ATOMIC_OPS=%d; flags only used by the \"dr\" PML (ignored by others): ACK=%d, CHECKSUM=%d, "
51-
"RDMA_COMPLETION=%d; flags only used by the \"bfo\" PML (ignored by others): FAILOVER_SUPPORT=%d)",
52-
MCA_BTL_FLAGS_SEND,
53-
MCA_BTL_FLAGS_PUT,
54-
MCA_BTL_FLAGS_GET,
55-
MCA_BTL_FLAGS_SEND_INPLACE,
56-
MCA_BTL_FLAGS_HETEROGENEOUS_RDMA,
57-
MCA_BTL_FLAGS_ATOMIC_OPS,
58-
MCA_BTL_FLAGS_NEED_ACK,
59-
MCA_BTL_FLAGS_NEED_CSUM,
60-
MCA_BTL_FLAGS_RDMA_COMPLETION,
61-
MCA_BTL_FLAGS_FAILOVER_SUPPORT);
62-
(void) mca_base_component_var_register(version, "flags", msg,
63-
MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0,
64-
OPAL_INFO_LVL_5,
65-
MCA_BASE_VAR_SCOPE_READONLY,
66-
&module->btl_flags);
67-
free(msg);
68-
69-
asprintf (&msg, "BTL atomic bit flags (general flags: ADD=%d, AND=%d, OR=%d, XOR=%d",
70-
MCA_BTL_ATOMIC_SUPPORTS_ADD, MCA_BTL_ATOMIC_SUPPORTS_AND, MCA_BTL_ATOMIC_SUPPORTS_OR,
71-
MCA_BTL_ATOMIC_SUPPORTS_XOR);
72-
(void) mca_base_component_var_register(version, "atomic_flags", msg, MCA_BASE_VAR_TYPE_UNSIGNED_INT,
73-
NULL, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, OPAL_INFO_LVL_5,
49+
(void) mca_base_component_var_register(version, "flags", "BTL bit flags (general flags: send, put, get, in-place, hetero-rdma, "
50+
"atomics, fetching-atomics)", MCA_BASE_VAR_TYPE_UNSIGNED_INT,
51+
&mca_btl_base_flag_enum->super, 0, 0, OPAL_INFO_LVL_5,
52+
MCA_BASE_VAR_SCOPE_READONLY, &module->btl_flags);
53+
54+
(void) mca_base_component_var_register(version, "atomic_flags", "BTL atomic support flags", MCA_BASE_VAR_TYPE_UNSIGNED_INT,
55+
&mca_btl_base_atomic_enum->super, 0, MCA_BASE_VAR_FLAG_DEFAULT_ONLY, OPAL_INFO_LVL_5,
7456
MCA_BASE_VAR_SCOPE_CONSTANT, &module->btl_atomic_flags);
75-
free(msg);
7657

7758
(void) mca_base_component_var_register(version, "rndv_eager_limit", "Size (in bytes, including header) of \"phase 1\" fragment sent for all large messages (must be >= 0 and <= eager_limit)",
7859
MCA_BASE_VAR_TYPE_SIZE_T, NULL, 0, 0,

0 commit comments

Comments
 (0)