diff --git a/.gitignore b/.gitignore index 871ce51cad1..7d6c21547f2 100644 --- a/.gitignore +++ b/.gitignore @@ -426,6 +426,8 @@ Makefile.am-stamp /src/binding/fortran/use_mpi/mpif90type.h /src/binding/fortran/use_mpi/mpi_constants.f90 /src/binding/fortran/use_mpi/mpifnoext.h +/src/binding/fortran/use_mpi/pmpi_base.f90 +/src/binding/fortran/use_mpi/pmpi_base.mod-stamp # generated by src/binding/fortran/use_mpi_f08/buildiface /src/binding/fortran/use_mpi_f08/mpi_f08_compile_constants.f90 @@ -446,6 +448,9 @@ Makefile.am-stamp # generated by maint/gen_coll.py /src/mpi/coll/mpir_coll.c /src/mpi/coll/include/coll_algos.h +/src/mpi/coll/src/csel_constants_gen.h +/src/mpi/coll/src/csel_env.c +/src/mpi/coll/include/csel_container_gen.h # /src/env/ /src/env/mpicc @@ -615,6 +620,14 @@ Makefile.am-stamp /src/mpid/ch4/shm/stubshm/shm_inline.h /src/mpid/ch4/shm/stubshm/shm_noinline.h /src/mpid/ch4/shm/stubshm/stubshm_noinline.c +/src/mpid/ch4/shm/posix/eager/include/posix_eager.h +/src/mpid/ch4/shm/posix/eager/iqueue/func_table.c +/src/mpid/ch4/shm/posix/eager/iqueue/iqueue_noinline.h +/src/mpid/ch4/shm/posix/eager/src/posix_eager_impl.c +/src/mpid/ch4/shm/posix/eager/stub/func_table.c +/src/mpid/ch4/shm/posix/eager/stub/stub_inline.h +/src/mpid/ch4/shm/posix/eager/stub/stub_noinline.c +/src/mpid/ch4/shm/posix/eager/stub/stub_noinline.h src/pm/hydra/lib/tools/bootstrap/src/bsci_init.c src/pmi/aclocal.m4 diff --git a/maint/gen_csel.py b/maint/gen_csel.py new file mode 100644 index 00000000000..6c10a9e366a --- /dev/null +++ b/maint/gen_csel.py @@ -0,0 +1,846 @@ +## +## Copyright (C) by Argonne National Laboratory +## See COPYRIGHT in top-level directory +## + +from local_python import MPI_API_Global as G +from local_python import RE +from local_python.mpi_api import * +from local_python.binding_common import * +import json +import subprocess + +enums = [] +enum_str = [] +cvars = [] + +def PS(buf): + for line in buf: + print(line) + +def main(): + binding_dir = G.get_srcdir_path("src/binding") + c_dir = "src/binding/c" + func_list = load_C_func_list(binding_dir, silent=True) + G.algos = load_coll_algos("src/mpi/coll/coll_algorithms.txt") + + coll_names = sorted([ + "barrier", + "bcast", + "gather", + "gatherv", + "scatter", + "scatterv", + "allgather", + "allgatherv", + "alltoall", + "alltoallv", + "alltoallw", + "reduce", + "allreduce", + "reduce_scatter", + "reduce_scatter_block", + "scan", + "exscan", + "neighbor_allgather", + "neighbor_allgatherv", + "neighbor_alltoall", + "neighbor_alltoallv", + "neighbor_alltoallw" + ]) + + G.out = [] + + # generate MPII_CSEL_ enums for MPIR_ algorithms + # print(json.dumps(G.algos)) + + G.prototypes_hash = {} + G.prototypes = [] + G.out.append(""" + #include "mpiimpl.h" + #include "mpl.h" + #include "mpir_csel.h" + #include "csel_internal.h" + """) + + G.out.append(f""" + void MPIR_Csel_process_env(void *csel_) + {{ + csel_s * csel = (csel_s *) csel_; + csel_node_s * tree_root = csel->u.root.tree; + """) + + for a in coll_names: + dump_coll(a, "blocking") + dump_coll(a, "nonblocking") + + for item in enum_str: + enums.append(f"MPII_CSEL_CONTAINER_TYPE__ALGORITHM__{item}") + + G.out.append(f""" + }} + """) + + # PS(G.out) + + with open("src/mpi/coll/include/csel_container_gen.h", "w") as f: + for e in enums: + print(f"{e},", file=f) + + with open("src/mpi/coll/src/csel_constants_gen.h", "w") as f: + for s in enum_str: + print(f'"{s}",', file=f) + # dump_coll(a, "persistent") + # print(G.out) + dump_c_file("src/mpi/coll/src/csel_env.c", G.out) + subprocess.run(["./maint/code-cleanup.bash", "src/mpi/coll/src/csel_env.c"]) + # dump_prototypes("src/mpi/coll/include/coll_algos.h", G.prototypes) + +def add_prototype(l): + if RE.match(r'int\s+(\w+)\(', l): + func_name = RE.m.group(1) + if func_name not in G.prototypes_hash: + G.prototypes_hash[func_name] = 1 + G.prototypes.append(l) + else: + pass + +def load_coll_algos(algo_txt): + All = {} + with open(algo_txt) as In: + (func_commkind, algo_list, algo) = (None, None, None) + for line in In: + if RE.match(r'(\w+-(intra|inter)):', line): + func_commkind = RE.m.group(1) + algo_list = [] + All[func_commkind] = algo_list + elif RE.match(r'\s+(\w+)\s*$', line): + algo = {"name": RE.m.group(1), "func-commkind": func_commkind} + algo_list.append(algo) + elif RE.match(r'\s+(\w+):\s*(.+)', line): + (key, value) = RE.m.group(1,2) + algo[key] = value + return All + +def dump_coll(name, blocking_type): + if blocking_type == "blocking": + gen_alg_names(name, blocking_type) + dump_mpir_impl_blocking(name) + # gen_mpir_cvars_blocking(name) + elif blocking_type == "nonblocking": + pass + # dump_sched_impl(name) + # dump_mpir_impl_nonblocking(name) + # elif blocking_type == "persistent": + # dump_mpir_impl_persistent(name) + else: + raise Exception("Wrong blocking_type") + # print(enum_str) + # dump_mpir(name, blocking_type) + +def gen_alg_names(name, blocking_type): + """ Generate names for MPIR collective algorithms """ + + # e.g. ibcast, Ibcast, IBCAST + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + + for commkind in ("intra", "inter"): + if commkind == "inter" and re.match(r'(scan|exscan|neighbor_)', name): + continue + for algo in G.algos[func_name + "-" + commkind]: + if "allcomm" in algo: + if commkind == "intra": + commkind = "allcomm" + else: + # skip inter since it is covered already + continue + enum_str.append(f"MPIR_{Name}_{commkind}_{algo["name"]}") + if blocking_type == "blocking": + enum_str.append(f"MPIR_{Name}_allcomm_nb") + +def dump_mpir_impl_blocking(name): + """ MPIR_Xxx_impl - """ + blocking_type = "blocking" + func = G.FUNCS["mpi_" + name] + params, args = get_params_and_args(func) + func_params = get_func_params(params, name, "blocking") + func_args = get_func_args(args, name, "blocking") + + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + NAME = func_name.upper() + + need_fallback = False + + def dump_algo(algo, commkind): + if "allcomm" in algo: + commkind = "allcomm" + # algo_name = get_algo_name(algo) + algo_name = algo["name"] + + G.out.append(f""" + csel_node_s * alg_env = csel_node_create(CSEL_NODE_TYPE__CONTAINER); + CSEL_CONTAINER(alg_env)->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_{Name}_{commkind}_{algo_name}; + """) + + if "extra_params" in algo: + params = algo["extra_params"].split(", ") + cvars = algo["cvar_params"].split(", ") + for idx, p in enumerate(params): + if cvars[idx] == "-": + continue + G.out.append(f""" + CSEL_CONTAINER(alg_env)->u.{name}.{commkind}_{algo_name}.{p} = MPIR_CVAR_{name.upper()}_{cvars[idx]}; + """) + + def dump_cases(commkind): + nonlocal need_fallback + CVAR_PREFIX = "MPIR_CVAR_%s_%s_ALGORITHM" % (NAME, commkind.upper()) + for algo in G.algos[func_name + '-' + commkind]: + if algo['name'] != "auto" and algo['name'] != "nb": + G.out.append(f""" + case {CVAR_PREFIX}_{algo["name"]}: {{ + csel_node_s * algo_node = csel_tree_find(tree_root, is_{name}); + algo_node = csel_tree_find(algo_node, is_{commkind}_comm); + """) + + dump_algo(algo, commkind) + + # generate nodes to handle restrictions + if 'restrictions' in algo: + restrictions = algo["restrictions"].replace('-', '_').split(", ") + idx = 0; + for r in restrictions: + G.out.append(f""" + csel_node_s * cond_{idx} = csel_node_create__{r}(); + + csel_node_s * alg_fallback_{idx} = csel_node_create(CSEL_NODE_TYPE__CONTAINER); + CSEL_CONTAINER(alg_fallback_{idx})->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_{Name}_allcomm_nb; + + cond_{idx}->failure = alg_fallback_{idx}; + """) + if idx > 0: + G.out.append(f""" + cond_{idx - 1}->success = cond_{idx}; + """) + idx = idx + 1 + + G.out.append(f""" + cond_{idx - 1}->success = alg_env; + csel_node_s * new_succ = cond_0; + """) + + else: + G.out.append(f""" + csel_node_s * new_succ = alg_env; + """) + + G.out.append(f""" + csel_node_s * old = csel_node_swap_success(tree_root, new_succ); + csel_tree_free(&old); + break; + }} + """) + + G.out.append(f""" + case {CVAR_PREFIX}_nb: {{ + csel_node_s * algo_node = csel_tree_find(tree_root, is_{name}); + csel_node_s * algo_env = csel_node_create(CSEL_NODE_TYPE__CONTAINER); + CSEL_CONTAINER(algo_env)->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_{Name}_allcomm_nb; + csel_node_s * old = csel_node_swap_success(algo_node, algo_env); + csel_tree_free(&old); + break; + }} + case {CVAR_PREFIX}_auto: + break; + default: + MPIR_Assert(0); + """) + + # ---------------- + + G.out.append(f""" + switch (MPIR_CVAR_{NAME}_INTRA_ALGORITHM) {{ + """) + dump_cases("intra") + G.out.append(f""" + }} + """) + if re.match(r'(scan|exscan|neighbor_)', name): + return + # G.out.append("MPIR_Assert_error(\"Only intra-communicator allowed\");") + else: + G.out.append(f""" + switch (MPIR_CVAR_{NAME}_INTER_ALGORITHM) {{ + """) + dump_cases("inter") + G.out.append(f""" + }} + """) + +def gen_mpir_cvars_blocking(name): + """ MPIR_Xxx_impl - """ + blocking_type = "blocking" + func = G.FUNCS["mpi_" + name] + params, args = get_params_and_args(func) + func_params = get_func_params(params, name, "blocking") + func_args = get_func_args(args, name, "blocking") + + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + NAME = func_name.upper() + + need_fallback = False + + def dump_algo(algo, commkind): + if "allcomm" in algo: + commkind = "allcomm" + algo_name = get_algo_name(algo) + algo_args = get_algo_args(args, algo, "cvar") + dump_split(3, "mpi_errno = MPIR_%s_%s_%s(%s);" % (Name, commkind, algo_name, algo_args)) + + def dump_cases(commkind): + nonlocal need_fallback + CVAR_PREFIX = f"MPIR_CVAR_{NAME}_{commkind.upper()}_ALGORITHM" + G.out.append(f""" + switch ({CVAR_PREFIX}) {{ + """) + for algo in G.algos[func_name + '-' + commkind]: + if algo['name'] != "auto" and algo['name'] != "nb": + print(f"case {CVAR_PREFIX}_{algo['name']}: {{") + if 'restrictions' in algo: + dump_fallback(algo) + need_fallback = True + dump_algo(algo, commkind) + G.out.append(f""" + break; + }} + """); + PS(G.out) + G.out.append("case %s_nb:" % CVAR_PREFIX) + dump_split(3, " mpi_errno = MPIR_%s_allcomm_nb(%s);" % (Name, func_args)) + G.out.append(" break;"); + G.out.append("case %s_auto:" % CVAR_PREFIX) + if commkind == "intra": + G.out.append("#ifdef MPIR_%s_fallback" % (Name)) + G.out.append(" if (!comm_ptr->csel_comm) {") + G.out.append(" mpi_errno = MPIR_%s_fallback(%s);" % (Name, func_args)) + G.out.append(" break;") + G.out.append(" }") + G.out.append("#endif"); + dump_split(3, " mpi_errno = MPIR_%s_allcomm_auto(%s);" % (Name, func_args)) + G.out.append(" break;"); + G.out.append("default:") + G.out.append(" MPIR_Assert(0);") + + # ---------------- + G.out.append("") + add_prototype("int MPIR_%s_impl(%s)" % (Name, func_params)) + dump_split(0, "int MPIR_%s_impl(%s)" % (Name, func_params)) + dump_open('{') + G.out.append("int mpi_errno = MPI_SUCCESS;") + G.out.append("") + + dump_open("if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM) {") + dump_open("switch (MPIR_CVAR_%s_INTRA_ALGORITHM) {" % NAME) + dump_cases("intra") + dump_close("}") + dump_else() + if re.match(r'(scan|exscan|neighbor_)', name): + G.out.append("MPIR_Assert_error(\"Only intra-communicator allowed\");") + else: + dump_open("switch (MPIR_CVAR_%s_INTER_ALGORITHM) {" % NAME) + dump_cases("inter") + dump_close("}") + dump_close("}") + + G.out.append("MPIR_ERR_CHECK(mpi_errno);") + if need_fallback: + G.out.append("goto fn_exit;") + G.out.append("") + G.out.append("fallback:") + dump_split(1, "mpi_errno = MPIR_%s_allcomm_auto(%s);" % (Name, func_args)) + G.out.append("") + dump_fn_exit() + dump_close("}") + +def dump_sched_impl(name): + """ MPIR_Xxx_impl - """ + blocking_type = "nonblocking" + func = G.FUNCS["mpi_" + name] + params, args = get_params_and_args(func) + func_params = get_func_params(params, name, "sched_impl") + + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + NAME = func_name.upper() + + need_fallback = False + + def dump_algo_tsp(algo, commkind): + G.out.append("MPII_GENTRAN_CREATE_SCHED_P();") + algo_name = get_algo_name(algo) + algo_args = get_algo_args(args, algo, "cvar") + if "allcomm" in algo: + commkind = "allcomm" + dump_split(3, "mpi_errno = MPIR_TSP_%s_sched_%s_%s(%s);" % (Name, commkind, algo_name, algo_args)) + + def dump_algo_sched(algo, commkind): + G.out.append("MPII_SCHED_CREATE_SCHED_P();") + algo_name = get_algo_name(algo) + algo_args = get_algo_args(args, algo, "cvar") + if "allcomm" in algo: + commkind = "allcomm" + dump_split(3, "mpi_errno = MPIR_%s_%s_%s(%s);" % (Name, commkind, algo_name, algo_args)) + + def dump_cases(commkind): + nonlocal need_fallback + CVAR_PREFIX = "MPIR_CVAR_%s_%s_ALGORITHM" % (NAME, commkind.upper()) + for algo in G.algos[func_name + '-' + commkind]: + if algo['name'] != "auto" and algo['name'] != "nb": + G.out.append("case %s_%s:" % (CVAR_PREFIX, algo['name'])) + G.out.append("INDENT") + if 'restrictions' in algo: + dump_fallback(algo) + need_fallback = True + if algo['name'].startswith('tsp_'): + dump_algo_tsp(algo, commkind) + else: + dump_algo_sched(algo, commkind) + G.out.append("break;"); + G.out.append("DEDENT") + G.out.append("case %s_auto:" % CVAR_PREFIX) + func_args = get_func_args(args, name, "allcomm_sched_auto") + dump_split(3, " mpi_errno = MPIR_%s_allcomm_sched_auto(%s);" % (Name, func_args)) + G.out.append(" break;"); + G.out.append("default:") + G.out.append(" MPIR_Assert(0);") + + # ---------------- + G.out.append("") + add_prototype("int MPIR_%s_sched_impl(%s)" % (Name, func_params)) + dump_split(0, "int MPIR_%s_sched_impl(%s)" % (Name, func_params)) + dump_open('{') + G.out.append("int mpi_errno = MPI_SUCCESS;") + G.out.append("") + + dump_open("if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM) {") + dump_open("switch (MPIR_CVAR_%s_INTRA_ALGORITHM) {" % NAME) + dump_cases("intra") + dump_close("}") + dump_else() + if re.match(r'(scan|exscan|neighbor_)', name): + G.out.append("MPIR_Assert_error(\"Only intra-communicator allowed\");") + else: + dump_open("switch (MPIR_CVAR_%s_INTER_ALGORITHM) {" % NAME) + dump_cases("inter") + dump_close("}") + dump_close("}") + + G.out.append("MPIR_ERR_CHECK(mpi_errno);") + if need_fallback: + G.out.append("goto fn_exit;") + G.out.append("") + G.out.append("fallback:") + func_args = get_func_args(args, name, "allcomm_sched_auto") + dump_split(1, "mpi_errno = MPIR_%s_allcomm_sched_auto(%s);" % (Name, func_args)) + G.out.append("") + dump_fn_exit() + dump_close("}") + +def dump_mpir_impl_nonblocking(name): + blocking_type = "nonblocking" + func = G.FUNCS["mpi_" + name] + params, args = get_params_and_args(func) + func_params = get_func_params(params, name, "nonblocking") + + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + NAME = func_name.upper() + + G.out.append("") + add_prototype("int MPIR_%s_impl(%s)" % (Name, func_params)) + dump_split(0, "int MPIR_%s_impl(%s)" % (Name, func_params)) + dump_open('{') + G.out.append("int mpi_errno = MPI_SUCCESS;") + G.out.append("enum MPIR_sched_type sched_type;") + G.out.append("void *sched;") + G.out.append("") + G.out.append("*request = NULL;") + func_args = get_func_args(args, name, "mpir_impl_nonblocking") + dump_split(1, "mpi_errno = MPIR_%s_sched_impl(%s);" % (Name, func_args)) + G.out.append("MPIR_ERR_CHECK(mpi_errno);") + G.out.append("MPII_SCHED_START(sched_type, sched, comm_ptr, request);") + G.out.append("") + G.out.append("fn_exit:") + G.out.append("return mpi_errno;") + G.out.append("fn_fail:") + G.out.append("goto fn_exit;") + dump_close("}") + +def dump_mpir_impl_persistent(name): + blocking_type = "persistent" + func = G.FUNCS["mpi_" + name] + params, args = get_params_and_args(func) + func_params = get_func_params(params, name, "persistent") + + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + NAME = func_name.upper() + + G.out.append("") + add_prototype("int MPIR_%s_impl(%s)" % (Name, func_params)) + dump_split(0, "int MPIR_%s_impl(%s)" % (Name, func_params)) + dump_open('{') + G.out.append("int mpi_errno = MPI_SUCCESS;") + G.out.append("") + G.out.append("MPIR_Request *req = MPIR_Request_create(MPIR_REQUEST_KIND__PREQUEST_COLL);") + G.out.append("MPIR_ERR_CHKANDJUMP(!req, mpi_errno, MPI_ERR_OTHER, \"**nomem\");") + G.out.append("MPIR_Comm_add_ref(comm_ptr);") + G.out.append("req->comm = comm_ptr;") + G.out.append("MPIR_Comm_save_inactive_request(comm_ptr, req);") + G.out.append("req->u.persist_coll.sched_type = MPIR_SCHED_INVALID;") + G.out.append("req->u.persist_coll.real_request = NULL;") + + func_args = get_func_args(args, name, "mpir_impl_persistent") + dump_split(1, "mpi_errno = MPIR_I%s_sched_impl(%s);" % (name, func_args)) + G.out.append("MPIR_ERR_CHECK(mpi_errno);") + G.out.append("") + G.out.append("*request = req;") + G.out.append("") + G.out.append("fn_exit:") + G.out.append("return mpi_errno;") + G.out.append("fn_fail:") + G.out.append("goto fn_exit;") + dump_close("}") + +def dump_mpir(name, blocking_type): + """ MPIR_Xxx - """ + func = G.FUNCS["mpi_" + name] + params, args = get_params_and_args(func) + func_params = get_func_params(params, name, blocking_type) + func_args = get_func_args(args, name, blocking_type) + + func_name = get_func_name(name, blocking_type) + Name = func_name.capitalize() + NAME = func_name.upper() + + def dump_buffer_swap_pre(): + G.out.append("void *in_recvbuf = recvbuf;") + G.out.append("void *host_sendbuf = NULL;") + G.out.append("void *host_recvbuf = NULL;") + G.out.append("") + if name == "reduce_scatter": + G.out.append("MPI_Aint count = 0;") + G.out.append("for (int i = 0; i < MPIR_Comm_size(comm_ptr); i++) {") + G.out.append(" count += recvcounts[i];") + G.out.append("}") + G.out.append("") + elif name == "reduce_scatter_block": + G.out.append("MPI_Aint count = MPIR_Comm_size(comm_ptr) * recvcount;") + + if name == "reduce": + use_recvbuf = "(comm_ptr->rank == root || root == MPI_ROOT) ? recvbuf : NULL" + else: + use_recvbuf = "recvbuf" + + G.out.append("if(!MPIR_Typerep_reduce_is_supported(op, count, datatype))") + G.out.append(" MPIR_Coll_host_buffer_alloc(sendbuf, %s, count, datatype, &host_sendbuf, &host_recvbuf);" % use_recvbuf) + G.out.append("") + + for buf in ("sendbuf", "recvbuf"): + G.out.append("if (host_%s) {" % buf); + G.out.append(" %s = host_%s;" % (buf, buf)); + G.out.append("}") + G.out.append("") + + def dump_buffer_swap_post(): + count = "count" + if name == "reduce_scatter": + count = "recvcounts[comm_ptr->rank]" + elif name == "reduce_scatter_block": + count = "recvcount" + + if blocking_type == "blocking": + G.out.append("if (host_recvbuf) {") + G.out.append(" recvbuf = in_recvbuf;") + G.out.append(" MPIR_Localcopy(host_recvbuf, count, datatype, recvbuf, count, datatype);") + G.out.append("}") + G.out.append("MPIR_Coll_host_buffer_free(host_sendbuf, host_recvbuf);") + elif blocking_type == "nonblocking": + G.out.append("MPIR_Coll_host_buffer_swap_back(host_sendbuf, host_recvbuf, in_recvbuf, %s, datatype, *request);" % count) + elif blocking_type == "persistent": + G.out.append("MPIR_Coll_host_buffer_persist_set(host_sendbuf, host_recvbuf, in_recvbuf, %s, datatype, *request);" % count) + + G.out.append("") + add_prototype("int MPIR_%s(%s)" % (Name, func_params)) + dump_split(0, "int MPIR_%s(%s)" % (Name, func_params)) + dump_open('{') + G.out.append("int mpi_errno = MPI_SUCCESS;") + G.out.append("") + + need_buffer_swap = False + if re.match(r'(reduce|allreduce|scan|exscan|reduce_scatter)', name): + need_buffer_swap = True + if need_buffer_swap: + dump_buffer_swap_pre() + + cond1 = "MPIR_CVAR_DEVICE_COLLECTIVES == MPIR_CVAR_DEVICE_COLLECTIVES_all" + cond2 = "MPIR_CVAR_DEVICE_COLLECTIVES == MPIR_CVAR_DEVICE_COLLECTIVES_percoll" + cond3 = "MPIR_CVAR_%s_DEVICE_COLLECTIVE" % NAME + G.out.append("if ((%s) ||" % cond1) + G.out.append(" ((%s) &&" % cond2) + G.out.append(" %s)) {" % cond3) + G.out.append("INDENT") + dump_split(2, "mpi_errno = MPID_%s(%s);" % (Name, func_args)) + dump_else() + dump_split(2, "mpi_errno = MPIR_%s_impl(%s);" % (Name, func_args)) + dump_close("}") + if need_buffer_swap: + dump_buffer_swap_post() + G.out.append("") + G.out.append("return mpi_errno;") + dump_close("}") + +# ---- +def dump_fallback(algo): + cond_list = [] + for a in algo['restrictions'].replace(" ","").split(','): + if a == "inplace": + cond_list.append("sendbuf == MPI_IN_PLACE") + elif a == "noinplace": + cond_list.append("sendbuf != MPI_IN_PLACE") + elif a == "power-of-two": + cond_list.append("MPL_is_pof2(comm_ptr->local_size)") + elif a == "size-ge-pof2": + cond_list.append("count >= MPL_pof2(comm_ptr->local_size)") + elif a == "commutative": + cond_list.append("MPIR_Op_is_commutative(op)") + elif a== "builtin-op": + cond_list.append("HANDLE_IS_BUILTIN(op)") + elif a == "parent-comm": + cond_list.append("MPIR_Comm_is_parent_comm(comm_ptr)") + elif a == "node-consecutive": + cond_list.append("MPII_Comm_is_node_consecutive(comm_ptr)") + elif a == "displs-ordered": + # assume it's allgatherv + cond_list.append("MPII_Iallgatherv_is_displs_ordered(comm_ptr->local_size, recvcounts, displs)") + else: + raise Exception("Unsupported restrictions - %s" % a) + (func_name, commkind) = algo['func-commkind'].split('-') + G.out.append("MPII_COLLECTIVE_FALLBACK_CHECK(comm_ptr->rank, %s, mpi_errno," % ' && '.join(cond_list)) + G.out.append(" \"%s %s cannot be applied.\\n\");" % (func_name.capitalize(), algo['name'])) + +# ---- +def get_func_name(name, blocking_type): + if blocking_type == "blocking": + return name + elif blocking_type == "nonblocking": + return 'i' + name + elif blocking_type == "persistent": + return name + "_init" + +def get_params_and_args(func): + mapping = G.MAPS['SMALL_C_KIND_MAP'] + + params = [] + args = [] + for p in func['parameters']: + if p['name'] == 'comm': + params.append("MPIR_Comm * comm_ptr") + args.append("comm_ptr") + else: + s = get_C_param(p, func, mapping) + if p['kind'].startswith('POLY'): + s = re.sub(r'\bint ', 'MPI_Aint ', s) + params.append(s) + args.append(p['name']) + + return (', '.join(params), ', '.join(args)) + +def get_algo_extra_args(algo, kind): + (func_name, commkind) = algo['func-commkind'].split('-') + extra_params = algo['extra_params'].replace(' ', '').split(',') + cvar_params = algo['cvar_params'].replace(' ', '').split(',') + if len(extra_params) != len(cvar_params): + raise Exception("algorithm %s-%s-%s: extra_params and cvar_params sizes mismatch!" % (func_name, commkind, algo['name'])) + + out_list = [] + for i in range(len(extra_params)): + if RE.match(r'\w+=(.+)', extra_params[i]): + # constant parameter + out_list.append(RE.m.group(1)) + else: + if kind == "csel": + prefix = "cnt->u.%s.%s_%s." % (func_name, commkind, algo['name']) + out_list.append(prefix + extra_params[i]) + elif kind == "cvar": + prefix = "MPIR_CVAR_%s_" % func_name.upper() + tmp = prefix + cvar_params[i] + if re.match(r"%sTREE_TYPE" % prefix, tmp): + newname = "MPIR_%s_tree_type" % func_name.capitalize() + tmp = re.sub(r"%sTREE_TYPE" % prefix, newname, tmp) + elif re.match(r"%sTHROTTLE" % prefix, tmp): + newname = "MPIR_CVAR_ALLTOALL_THROTTLE" + tmp = re.sub(r"%sTHROTTLE" % prefix, newname, tmp) + out_list.append(tmp) + else: + raise Exception("Wrong kind!") + + return ', '.join(out_list) + +def get_algo_extra_params(algo): + extra_params = algo['extra_params'].replace(' ', '').split(',') + out_list = [] + for a in extra_params: + if RE.match(r'(\w+)=.+', a): + # constant parameter + out_list.append("int " + RE.m.group(1)) + else: + out_list.append("int " + a) + return ', '.join(out_list) + +# additional wrappers +def get_algo_args(args, algo, kind): + algo_args = args + if 'extra_params' in algo: + algo_args += ", " + get_algo_extra_args(algo, kind) + + if algo['name'].startswith('tsp_'): + algo_args += ", *sched_p" + elif algo['func-commkind'].startswith('i'): + algo_args += ", *sched_p" + elif not algo['func-commkind'].startswith('neighbor_'): + algo_args += ", coll_attr" + + return algo_args + +def get_algo_params(params, algo): + algo_params = params + if 'extra_params' in algo: + algo_params += ", " + get_algo_extra_params(algo) + + if algo['name'].startswith('tsp_'): + algo_params += ", MPIR_TSP_sched_t sched" + elif algo['func-commkind'].startswith('i'): + algo_params += ", MPIR_Sched_t s" + elif not algo['func-commkind'].startswith('neighbor_'): + algo_params += ", int coll_attr" + + return algo_params + +def get_algo_name(algo): + # the name used in algo function name + if "func_name" in algo: + return algo['func_name'] + elif algo['name'].startswith('tsp_'): + return algo['name'][4:] + else: + return algo['name'] + +def get_func_params(params, name, kind): + func_params = params + if kind == "blocking": + if not name.startswith('neighbor_'): + func_params += ", int coll_attr" + elif kind == "nonblocking": + func_params += ", MPIR_Request ** request" + elif kind == "persistent": + func_params += ", MPIR_Info * info_ptr, MPIR_Request ** request" + elif kind == "sched_auto": + func_params += ", MPIR_Sched_t s" + elif kind == "allcomm_sched_auto": + func_params += ", bool is_persistent, void **sched_p, enum MPIR_sched_type *sched_type_p" + elif kind == "sched_impl": + func_params += ", bool is_persistent, void **sched_p, enum MPIR_sched_type *sched_type_p" + else: + raise Exception("get_func_params - unexpected kind = %s" % kind) + + return func_params + +def get_func_args(args, name, kind): + func_args = args + if kind == "blocking": + if not name.startswith('neighbor_'): + func_args += ", coll_attr" + elif kind == "nonblocking": + func_args += ", request" + elif kind == "persistent": + func_args += ", info_ptr, request" + elif kind == "allcomm_sched_auto": + func_args += ", is_persistent, sched_p, sched_type_p" + elif kind == "mpir_impl_nonblocking": + func_args += ", false, &sched, &sched_type" + elif kind == "mpir_impl_persistent": + func_args += ", true, &req->u.persist_coll.sched, &req->u.persist_coll.sched_type" + else: + raise Exception("get_func_args - unexpected kind = %s" % kind) + + return func_args + +# ---------------------- +def dump_c_file(f, lines): + print(" --> [%s]" % f) + with open(f, "w") as Out: + indent = 0 + for l in G.copyright_c: + print(l, file=Out) + for l in lines: + if RE.match(r'(INDENT|DEDENT)', l): + # indentations + a = RE.m.group(1) + if a == "INDENT": + indent += 1 + else: + indent -= 1 + elif RE.match(r'\s*(fn_exit|fn_fail|fallback):', l): + # labels + print(" %s:" % RE.m.group(1), file=Out) + else: + # print the line with correct indentations + if indent > 0 and not RE.match(r'#(if|endif)', l): + print(" " * indent, end='', file=Out) + print(l, file=Out) + +def dump_prototypes(f, prototypes): + print(" --> [%s]" % f) + with open(f, "w") as Out: + for l in G.copyright_c: + print(l, file=Out) + print("#ifndef COLL_ALGOS_H_INCLUDED", file=Out) + print("#define COLL_ALGOS_H_INCLUDED", file=Out) + print("", file=Out) + for l in prototypes: + lines = split_line_with_break(l + ';', '', 80) + for l2 in lines: + print(l2, file=Out) + print("#endif /* COLL_ALGOS_H_INCLUDED */", file=Out) + +def dump_open(line): + G.out.append(line) + G.out.append("INDENT") + +def dump_close(line): + G.out.append("DEDENT") + G.out.append(line) + +def dump_else(): + G.out.append("DEDENT") + G.out.append("} else {") + G.out.append("INDENT") + +def dump_fn_exit(): + G.out.append("") + G.out.append("fn_exit:") + G.out.append("return mpi_errno;") + G.out.append("fn_fail:") + G.out.append("goto fn_exit;") + +def dump_split(indent, l): + tlist = split_line_with_break(l, "", 100 - indent * 4) + G.out.extend(tlist) + +# --------------------------------------------------------- +if __name__ == "__main__": + main() diff --git a/src/include/mpir_csel.h b/src/include/mpir_csel.h index 07f061e98ef..ebcd8c144eb 100644 --- a/src/include/mpir_csel.h +++ b/src/include/mpir_csel.h @@ -57,6 +57,14 @@ typedef enum { MPIR_CSEL_COLL_TYPE__END, } MPIR_Csel_coll_type_e; +typedef enum { + MPIR_CSEL_COMM_HIERARCHY__FLAT = 0, + MPIR_CSEL_COMM_HIERARCHY__NODE, + MPIR_CSEL_COMM_HIERARCHY__NODE_ROOTS, + MPIR_CSEL_COMM_HIERARCHY__PARENT, + MPIR_CSEL_COMM_HIERARCHY__END, +} MPIR_Csel_comm_hierarchy_e; + typedef struct { MPIR_Csel_coll_type_e coll_type; MPIR_Comm *comm_ptr; @@ -205,8 +213,11 @@ int MPIR_Csel_create_from_file(const char *json_file, void *(*create_container) (struct json_object *), void **csel); int MPIR_Csel_create_from_buf(const char *json, void *(*create_container) (struct json_object *), void **csel); +void MPIR_Csel_process_env(void *csel_); int MPIR_Csel_free(void *csel); int MPIR_Csel_prune(void *root_csel, MPIR_Comm * comm_ptr, void **comm_csel); void *MPIR_Csel_search(void *csel, MPIR_Csel_coll_sig_s coll_sig); +void MPIR_Csel_debug_summary(const char *name, void *csel_); + #endif /* MPIR_CSEL_H_INCLUDED */ diff --git a/src/mpi/coll/include/csel_container.h b/src/mpi/coll/include/csel_container.h index fae6ea479e4..e5c8f34ffbf 100644 --- a/src/mpi/coll/include/csel_container.h +++ b/src/mpi/coll/include/csel_container.h @@ -11,66 +11,7 @@ void *MPII_Create_container(struct json_object *obj); typedef enum { - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_brucks, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_k_brucks, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_ring, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_recexch_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_recexch_halving, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_inter_local_gather_remote_bcast, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_intra_brucks, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_intra_ring, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_inter_remote_gather_local_bcast, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_recursive_multiplying, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_reduce_scatter_allgather, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_smp, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_tree, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_recexch, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_ring, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_k_reduce_scatter_allgather, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_ccl, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_inter_reduce_exchange_bcast, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_brucks, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_k_brucks, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_pairwise, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_pairwise_sendrecv_replace, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_scattered, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_inter_pairwise_exchange, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_intra_pairwise_sendrecv_replace, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_intra_scattered, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_inter_pairwise_exchange, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_intra_pairwise_sendrecv_replace, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_intra_scattered, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_inter_pairwise_exchange, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_intra_k_dissemination, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_intra_recexch, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_intra_smp, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_inter_bcast, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_binomial, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_scatter_recursive_doubling_allgather, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_scatter_ring_allgather, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_smp, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_tree, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_pipelined_tree, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_inter_remote_send_local_bcast, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Exscan_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Exscan_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_intra_binomial, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_inter_linear, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_inter_local_gather_remote_send, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gatherv_allcomm_linear, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gatherv_allcomm_nb, +#include "csel_container_gen.h" MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_tsp_brucks, MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_sched_brucks, MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_sched_recursive_doubling, @@ -173,37 +114,50 @@ typedef enum { MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatter_inter_sched_remote_send_local_scatter, MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatterv_allcomm_tsp_linear, MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatterv_allcomm_sched_linear, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_allgather_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_allgatherv_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_alltoall_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_alltoallv_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_alltoallw_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_intra_binomial, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_intra_reduce_scatter_gather, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_intra_smp, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_inter_local_reduce_remote_send, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_noncommutative, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_pairwise, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_recursive_halving, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_inter_remote_reduce_local_scatter, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_noncommutative, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_pairwise, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_recursive_halving, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_inter_remote_reduce_local_scatter, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scan_intra_recursive_doubling, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scan_intra_smp, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scan_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_intra_binomial, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_inter_linear, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_inter_remote_send_local_scatter, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_allcomm_nb, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatterv_allcomm_linear, - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatterv_allcomm_nb, + + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_release_gather, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_ipc_read, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_impl, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_barrier_release_gather, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_impl, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_allreduce_release_gather, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_impl, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_reduce_release_gather, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_impl, + + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_gamma, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_delta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_gamma, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_gamma, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_delta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallv_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallw_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgatherv_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gather_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gatherv_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatter_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatterv_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_block_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_alpha, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_beta, + MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Exscan_intra_composition_alpha, + + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_OFI_Bcast_intra_triggered_tagged, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_OFI_Bcast_intra_triggered_rma, + MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count, } MPII_Csel_container_type_e; @@ -325,6 +279,14 @@ typedef struct { int chunk_size; int recv_pre_posted; } intra_pipelined_tree; + struct { + int k; + int tree_type; + } triggered_tagged; + struct { + int k; + int tree_type; + } triggered_rma; } bcast; struct { struct { diff --git a/src/mpi/coll/src/Makefile.mk b/src/mpi/coll/src/Makefile.mk index 1dd1b78b204..9282d1bbf42 100644 --- a/src/mpi/coll/src/Makefile.mk +++ b/src/mpi/coll/src/Makefile.mk @@ -10,5 +10,9 @@ mpi_core_sources += \ src/mpi/coll/src/coll_impl.c \ src/mpi/coll/src/csel.c \ + src/mpi/coll/src/csel_print.c \ + src/mpi/coll/src/csel_tree.c \ + src/mpi/coll/src/csel_env.c \ + src/mpi/coll/src/csel_constants.c \ src/mpi/coll/src/csel_container.c \ src/mpi/coll/src/csel_json_autogen.c diff --git a/src/mpi/coll/src/coll_impl.c b/src/mpi/coll/src/coll_impl.c index 41f528301bd..953edf99964 100644 --- a/src/mpi/coll/src/coll_impl.c +++ b/src/mpi/coll/src/coll_impl.c @@ -198,6 +198,7 @@ int MPII_Coll_init(void) MPII_Create_container, &MPIR_Csel_root); MPIR_Csel_source = MPIR_CVAR_COLL_SELECTION_TUNING_JSON_FILE; } + MPIR_Csel_debug_summary(MPIR_Csel_source, MPIR_Csel_root); MPIR_ERR_CHECK(mpi_errno); fn_exit: diff --git a/src/mpi/coll/src/csel.c b/src/mpi/coll/src/csel.c index b2712350764..78bdcc887ec 100644 --- a/src/mpi/coll/src/csel.c +++ b/src/mpi/coll/src/csel.c @@ -6,255 +6,32 @@ #include "mpiimpl.h" #include "mpl.h" #include "mpir_csel.h" +#include "csel_internal.h" #include /* open */ #include /* mmap */ #include #include -typedef enum { - /* global operator types */ - CSEL_NODE_TYPE__OPERATOR__IS_MULTI_THREADED = 0, - - /* comm-specific operator types */ - CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTRA, - CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTER, - - CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE, - CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT, - CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_NODE_COMM_SIZE, - CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_POW2, - - CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY, - CSEL_NODE_TYPE__OPERATOR__IS_NODE_CONSECUTIVE, - - CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE, - CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT, - - /* collective selection operator */ - CSEL_NODE_TYPE__OPERATOR__COLLECTIVE, - - /* message-specific operator types */ - CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE, - CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT, - CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE, - CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT, - - CSEL_NODE_TYPE__OPERATOR__COUNT_LE, - CSEL_NODE_TYPE__OPERATOR__COUNT_LT_POW2, - - CSEL_NODE_TYPE__OPERATOR__IS_SBUF_INPLACE, - CSEL_NODE_TYPE__OPERATOR__IS_BLOCK_REGULAR, - CSEL_NODE_TYPE__OPERATOR__IS_COMMUTATIVE, - CSEL_NODE_TYPE__OPERATOR__IS_OP_BUILT_IN, - - /* any - has to be the last branch in an array */ - CSEL_NODE_TYPE__OPERATOR__ANY, - - /* container type */ - CSEL_NODE_TYPE__CONTAINER, -} csel_node_type_e; - -typedef struct csel_node { - csel_node_type_e type; - - union { - /* global types */ - struct { - int val; - } is_multi_threaded; - - /* comm-specific operator types */ - struct { - int val; - } comm_size_le; - struct { - int val; - } comm_size_lt; - - /* collective selection operator */ - struct { - MPIR_Csel_coll_type_e coll_type; - } collective; - - /* message-specific operator types */ - struct { - int val; - } avg_msg_size_le; - struct { - int val; - } avg_msg_size_lt; - struct { - int val; - } total_msg_size_le; - struct { - int val; - } total_msg_size_lt; - struct { - int val; - } count_le; - struct { - bool val; - } is_commutative; - struct { - bool val; - } is_sbuf_inplace; - struct { - bool val; - } is_op_built_in; - struct { - bool val; - } is_block_regular; - struct { - bool val; - } is_node_consecutive; - struct { - int val; - } comm_avg_ppn_le; - struct { - int val; - } comm_avg_ppn_lt; - struct { - bool val; - } comm_hierarchy; - struct { - void *container; - } cnt; - } u; - - struct csel_node *success; - struct csel_node *failure; -} csel_node_s; - -typedef enum { - CSEL_TYPE__ROOT, - CSEL_TYPE__PRUNED, -} csel_type_e; - -typedef struct { - csel_type_e type; - - union { - struct { - csel_node_s *tree; - } root; - struct { - /* one tree for each collective */ - csel_node_s *coll_trees[MPIR_CSEL_COLL_TYPE__END]; - } pruned; - } u; -} csel_s; - -static int nesting = -1; -#define nprintf(...) \ - do { \ - for (int i = 0; i < nesting; i++) \ - printf(" "); \ - printf(__VA_ARGS__); \ - } while (0) - -static void print_tree(csel_node_s * node) ATTRIBUTE((unused)); -static void print_tree(csel_node_s * node) -{ - nesting++; - - if (node == NULL) - return; - - switch (node->type) { - case CSEL_NODE_TYPE__OPERATOR__IS_MULTI_THREADED: - nprintf("MPI library is multithreaded\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTRA: - nprintf("comm_type is intra\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTER: - nprintf("comm_type is inter\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COLLECTIVE: - nprintf("collective: %d\n", node->u.collective.coll_type); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE: - nprintf("comm_size <= %d\n", node->u.comm_size_le.val); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT: - nprintf("comm_size < %d\n", node->u.comm_size_lt.val); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_POW2: - nprintf("comm_size is power-of-two\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_NODE_COMM_SIZE: - nprintf("comm_size is the same as node_comm_size\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE: - nprintf("avg_msg_size <= %d\n", node->u.avg_msg_size_le.val); - break; - case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT: - nprintf("avg_msg_size < %d\n", node->u.avg_msg_size_lt.val); - break; - case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE: - nprintf("total_msg_size <= %d\n", node->u.total_msg_size_le.val); - break; - case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT: - nprintf("total_msg_size < %d\n", node->u.total_msg_size_lt.val); - break; - case CSEL_NODE_TYPE__CONTAINER: - nprintf("container\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COUNT_LE: - nprintf("count <= %d\n", node->u.count_le.val); - break; - case CSEL_NODE_TYPE__OPERATOR__COUNT_LT_POW2: - nprintf("count < nearest power-of-two less than comm size\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__IS_SBUF_INPLACE: - nprintf("source buffer is MPI_IN_PLACE\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__IS_BLOCK_REGULAR: - nprintf("all blocks have the same count\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY: - if (node->u.comm_hierarchy.val) - nprintf("communicator has hierarchical structure\n"); - else - nprintf("communicator does not have hierarchical structure\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__IS_NODE_CONSECUTIVE: - nprintf("process ranks are consecutive on the node\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE: - nprintf("communicator's avg ppn <= %d\n", node->u.comm_avg_ppn_le.val); - break; - case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT: - nprintf("communicator's avg ppn < %d\n", node->u.comm_avg_ppn_lt.val); - break; - case CSEL_NODE_TYPE__OPERATOR__IS_COMMUTATIVE: - if (node->u.is_commutative.val == true) - nprintf("operation is commutative\n"); - else - nprintf("operation is not commutative\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__IS_OP_BUILT_IN: - nprintf("other operators\n"); - break; - case CSEL_NODE_TYPE__OPERATOR__ANY: - nprintf("any\n"); - break; - default: - nprintf("unknown operator\n"); - MPIR_Assert(0); - } - - if (node->type != CSEL_NODE_TYPE__CONTAINER) { - print_tree(node->success); - if (node->failure) { - nesting--; - print_tree(node->failure); - nesting++; - } - } - - nesting--; -} +/* +=== BEGIN_MPI_T_CVAR_INFO_BLOCK === + +cvars: + - name : MPIR_CVAR_COLLECTIVE_SELECTION_REPORT + category : COLLECTIVE + type : enum + default : none + class : none + verbosity : MPI_T_VERBOSITY_USER_BASIC + scope : MPI_T_SCOPE_ALL_EQ + description : |- + Variable to select report type. + none - No print out + summary - Print a summary of each algorithm + tree - Print the collective selection tree + all - Print both tree and summary + +=== END_MPI_T_CVAR_INFO_BLOCK === +*/ static void validate_tree(csel_node_s * node) { @@ -282,6 +59,16 @@ static void validate_tree(csel_node_s * node) fprintf(stderr, "unexpected non-NULL failure path for coll %d\n", coll); MPIR_Assert(0); } + } else if (node->type == CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE || + node->type == CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE || + node->type == CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE || + node->type == CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE || + node->type == CSEL_NODE_TYPE__OPERATOR__COUNT_LE) { + if (node->u.value_le.val < INT_MAX && node->failure == NULL) { + fprintf(stderr, "unexpected NULL failure path for non-max LE node value_le.val %d\n", + node->u.value_le.val); + MPIR_Assert(0); + } } else if (node->type != CSEL_NODE_TYPE__OPERATOR__IS_MULTI_THREADED && node->type != CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTRA && node->type != CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTER && @@ -336,6 +123,8 @@ static csel_node_s *parse_json_tree(struct json_object *obj, !strncmp(ckey, "algorithm=", strlen("algorithm="))) { tmp->type = CSEL_NODE_TYPE__CONTAINER; tmp->u.cnt.container = create_container(obj); + tmp->success = NULL; + tmp->failure = NULL; MPL_free(ckey); return tmp; } @@ -350,7 +139,27 @@ static csel_node_s *parse_json_tree(struct json_object *obj, prevnode->failure = tmp; prevnode = tmp; - if (!strcmp(ckey, "is_multi_threaded=yes")) { + /* =any condition must be checked first */ + if (key_is_any(ckey)) { + if (!strncmp(ckey, "comm_size=", strlen("comm_size="))) { + tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE; + tmp->u.value_le.val = INT_MAX; + } else if (!strncmp(ckey, "avg_msg_size=", strlen("avg_msg_size="))) { + tmp->type = CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE; + tmp->u.value_le.val = INT_MAX; + } else if (!strncmp(ckey, "total_msg_size=", strlen("total_msg_size="))) { + tmp->type = CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE; + tmp->u.value_le.val = INT_MAX; + } else if (!strncmp(ckey, "comm_avg_ppn=", strlen("comm_avg_ppn="))) { + tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE; + tmp->u.value_le.val = INT_MAX; + } else if (!strncmp(ckey, "count=", strlen("count="))) { + tmp->type = CSEL_NODE_TYPE__OPERATOR__COUNT_LE; + tmp->u.value_le.val = INT_MAX; + } else { + tmp->type = CSEL_NODE_TYPE__OPERATOR__ANY; + } + } else if (!strcmp(ckey, "is_multi_threaded=yes")) { tmp->type = CSEL_NODE_TYPE__OPERATOR__IS_MULTI_THREADED; tmp->u.is_multi_threaded.val = true; } else if (!strcmp(ckey, "is_multi_threaded=no")) { @@ -364,95 +173,16 @@ static csel_node_s *parse_json_tree(struct json_object *obj, tmp->type = CSEL_NODE_TYPE__OPERATOR__COLLECTIVE; char *str = ckey + strlen("collective="); - if (!strcmp(str, "allgather")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ALLGATHER; - else if (!strcmp(str, "allgatherv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ALLGATHERV; - else if (!strcmp(str, "allreduce")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ALLREDUCE; - else if (!strcmp(str, "alltoall")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ALLTOALL; - else if (!strcmp(str, "alltoallv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ALLTOALLV; - else if (!strcmp(str, "alltoallw")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ALLTOALLW; - else if (!strcmp(str, "barrier")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__BARRIER; - else if (!strcmp(str, "bcast")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__BCAST; - else if (!strcmp(str, "exscan")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__EXSCAN; - else if (!strcmp(str, "gather")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__GATHER; - else if (!strcmp(str, "gatherv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__GATHERV; - else if (!strcmp(str, "iallgather")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IALLGATHER; - else if (!strcmp(str, "iallgatherv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IALLGATHERV; - else if (!strcmp(str, "iallreduce")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IALLREDUCE; - else if (!strcmp(str, "ialltoall")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IALLTOALL; - else if (!strcmp(str, "ialltoallv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IALLTOALLV; - else if (!strcmp(str, "ialltoallw")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IALLTOALLW; - else if (!strcmp(str, "ibarrier")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IBARRIER; - else if (!strcmp(str, "ibcast")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IBCAST; - else if (!strcmp(str, "iexscan")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IEXSCAN; - else if (!strcmp(str, "igather")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IGATHER; - else if (!strcmp(str, "igatherv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IGATHERV; - else if (!strcmp(str, "ineighbor_allgather")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLGATHER; - else if (!strcmp(str, "ineighbor_allgatherv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLGATHERV; - else if (!strcmp(str, "ineighbor_alltoall")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLTOALL; - else if (!strcmp(str, "ineighbor_alltoallv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLTOALLV; - else if (!strcmp(str, "ineighbor_alltoallw")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLTOALLW; - else if (!strcmp(str, "ireduce")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IREDUCE; - else if (!strcmp(str, "ireduce_scatter")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IREDUCE_SCATTER; - else if (!strcmp(str, "ireduce_scatter_block")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__IREDUCE_SCATTER_BLOCK; - else if (!strcmp(str, "iscan")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ISCAN; - else if (!strcmp(str, "iscatter")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ISCATTER; - else if (!strcmp(str, "iscatterv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__ISCATTERV; - else if (!strcmp(str, "neighbor_allgather")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLGATHER; - else if (!strcmp(str, "neighbor_allgatherv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLGATHERV; - else if (!strcmp(str, "neighbor_alltoall")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLTOALL; - else if (!strcmp(str, "neighbor_alltoallv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLTOALLV; - else if (!strcmp(str, "neighbor_alltoallw")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLTOALLW; - else if (!strcmp(str, "reduce")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__REDUCE; - else if (!strcmp(str, "reduce_scatter")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__REDUCE_SCATTER; - else if (!strcmp(str, "reduce_scatter_block")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__REDUCE_SCATTER_BLOCK; - else if (!strcmp(str, "scan")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__SCAN; - else if (!strcmp(str, "scatter")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__SCATTER; - else if (!strcmp(str, "scatterv")) - tmp->u.collective.coll_type = MPIR_CSEL_COLL_TYPE__SCATTERV; - else { + + bool matched = false; + for (int idx = 0; idx < MPIR_CSEL_COLL_TYPE__END; idx++) { + if (strcmp(str, Csel_coll_type_str[idx]) == 0) { + tmp->u.collective.coll_type = idx; + matched = true; + break; + } + } + if (!matched) { MPIR_Assert(0); } } else if (!strcmp(ckey, "comm_size=pow2")) { @@ -461,27 +191,27 @@ static csel_node_s *parse_json_tree(struct json_object *obj, tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_NODE_COMM_SIZE; } else if (!strncmp(ckey, "comm_size<=", strlen("comm_size<="))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE; - tmp->u.comm_size_le.val = atoi(ckey + strlen("comm_size<=")); + tmp->u.value_le.val = atoi(ckey + strlen("comm_size<=")); } else if (!strncmp(ckey, "comm_size<", strlen("comm_size<"))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT; - tmp->u.comm_size_lt.val = atoi(ckey + strlen("comm_size<")); + tmp->u.value_lt.val = atoi(ckey + strlen("comm_size<")); } else if (!strncmp(ckey, "count<=", strlen("count<="))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__COUNT_LE; - tmp->u.count_le.val = atoi(ckey + strlen("count<=")); + tmp->u.value_lt.val = atoi(ckey + strlen("count<=")); } else if (!strcmp(ckey, "counttype = CSEL_NODE_TYPE__OPERATOR__COUNT_LT_POW2; } else if (!strncmp(ckey, "avg_msg_size<=", strlen("avg_msg_size<="))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE; - tmp->u.avg_msg_size_le.val = atoi(ckey + strlen("avg_msg_size<=")); + tmp->u.value_le.val = atoi(ckey + strlen("avg_msg_size<=")); } else if (!strncmp(ckey, "avg_msg_size<", strlen("avg_msg_size<"))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT; - tmp->u.avg_msg_size_lt.val = atoi(ckey + strlen("avg_msg_size<")); + tmp->u.value_lt.val = atoi(ckey + strlen("avg_msg_size<")); } else if (!strncmp(ckey, "total_msg_size<=", strlen("total_msg_size<="))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE; - tmp->u.total_msg_size_le.val = atoi(ckey + strlen("total_msg_size<=")); + tmp->u.value_le.val = atoi(ckey + strlen("total_msg_size<=")); } else if (!strncmp(ckey, "total_msg_size<", strlen("total_msg_size<"))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT; - tmp->u.total_msg_size_lt.val = atoi(ckey + strlen("total_msg_size<")); + tmp->u.value_lt.val = atoi(ckey + strlen("total_msg_size<")); } else if (!strcmp(ckey, "is_commutative=yes")) { tmp->type = CSEL_NODE_TYPE__OPERATOR__IS_COMMUTATIVE; tmp->u.is_commutative.val = true; @@ -514,24 +244,21 @@ static csel_node_s *parse_json_tree(struct json_object *obj, tmp->u.is_node_consecutive.val = false; } else if (!strncmp(ckey, "comm_avg_ppn<=", strlen("comm_avg_ppn<="))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE; - tmp->u.comm_avg_ppn_le.val = atoi(ckey + strlen("comm_avg_ppn<=")); + tmp->u.value_le.val = atoi(ckey + strlen("comm_avg_ppn<=")); } else if (!strncmp(ckey, "comm_avg_ppn<", strlen("comm_avg_ppn<"))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT; - tmp->u.comm_avg_ppn_le.val = atoi(ckey + strlen("comm_avg_ppn<")); - } else if (!strcmp(ckey, "comm_hierarchy=parent")) { - tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY; - tmp->u.comm_hierarchy.val = true; - } else if (!strcmp(ckey, "comm_hierarchy=node_roots")) { - tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY; - tmp->u.comm_hierarchy.val = false; - } else if (!strcmp(ckey, "comm_hierarchy=node")) { - tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY; - tmp->u.comm_hierarchy.val = false; - } else if (!strcmp(ckey, "comm_hierarchy=flat")) { + tmp->u.value_le.val = atoi(ckey + strlen("comm_avg_ppn<")); + } else if (!strncmp(ckey, "comm_hierarchy=", strlen("comm_hierarchy="))) { tmp->type = CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY; - tmp->u.comm_hierarchy.val = false; - } else if (key_is_any(ckey)) { - tmp->type = CSEL_NODE_TYPE__OPERATOR__ANY; + + char *str = ckey + strlen("comm_hierarchy="); + + for (int idx = 0; idx < MPIR_CSEL_COMM_HIERARCHY__END; idx++) { + if (strcmp(str, Csel_comm_hierarchy_str[idx]) == 0) { + tmp->u.comm_hierarchy.val = idx; + break; + } + } } else { fprintf(stderr, "unknown key %s\n", key); fflush(stderr); @@ -560,6 +287,8 @@ int MPIR_Csel_create_from_buf(const char *json, if (csel->u.root.tree) validate_tree(csel->u.root.tree); + csel_tree_optimize(&csel->u.root.tree); + json_object_put(tree); fn_exit: @@ -567,6 +296,29 @@ int MPIR_Csel_create_from_buf(const char *json, return 0; } +void MPIR_Csel_debug_summary(const char *name, void *csel_) +{ + csel_s *csel = (csel_s *) csel_; + if (MPIR_Process.rank != 0) { + return; + } + + if (MPIR_CVAR_COLLECTIVE_SELECTION_REPORT == MPIR_CVAR_COLLECTIVE_SELECTION_REPORT_tree + || MPIR_CVAR_COLLECTIVE_SELECTION_REPORT == MPIR_CVAR_COLLECTIVE_SELECTION_REPORT_all) { + printf("Processed Collective Selection Tree for %s:\n", name); + printf("============================================================\n"); + Csel_print_tree(csel->u.root.tree); + printf("============================================================\n"); + } + if (MPIR_CVAR_COLLECTIVE_SELECTION_REPORT == MPIR_CVAR_COLLECTIVE_SELECTION_REPORT_summary + || MPIR_CVAR_COLLECTIVE_SELECTION_REPORT == MPIR_CVAR_COLLECTIVE_SELECTION_REPORT_all) { + printf("Summary of rules per collective algorithm for %s:\n", name); + printf("============================================================\n"); + Csel_print_rules(csel->u.root.tree); + printf("============================================================\n"); + } +} + int MPIR_Csel_create_from_file(const char *json_file, void *(*create_container) (struct json_object *), void **csel_) { @@ -610,14 +362,14 @@ static csel_node_s *prune_tree(csel_node_s * root, MPIR_Comm * comm_ptr) break; case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE: - if (comm_ptr->local_size <= node->u.comm_size_le.val) + if (comm_ptr->local_size <= node->u.value_le.val) node = node->success; else node = node->failure; break; case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT: - if (comm_ptr->local_size < node->u.comm_size_lt.val) + if (comm_ptr->local_size < node->u.value_lt.val) node = node->success; else node = node->failure; @@ -638,7 +390,8 @@ static csel_node_s *prune_tree(csel_node_s * root, MPIR_Comm * comm_ptr) break; case CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY: - if (MPIR_Comm_is_parent_comm(comm_ptr) == node->u.comm_hierarchy.val) + if (MPIR_Comm_is_parent_comm(comm_ptr) + && (node->u.comm_hierarchy.val == MPIR_CSEL_COMM_HIERARCHY__PARENT)) node = node->success; else node = node->failure; @@ -653,7 +406,7 @@ static csel_node_s *prune_tree(csel_node_s * root, MPIR_Comm * comm_ptr) case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE: if ((comm_ptr->attr & MPIR_COMM_ATTR__HIERARCHY) && - comm_ptr->local_size <= node->u.comm_avg_ppn_le.val * comm_ptr->num_external) + comm_ptr->local_size <= node->u.value_le.val * comm_ptr->num_external) node = node->success; else node = node->failure; @@ -661,7 +414,7 @@ static csel_node_s *prune_tree(csel_node_s * root, MPIR_Comm * comm_ptr) case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT: if ((comm_ptr->attr & MPIR_COMM_ATTR__HIERARCHY) && - comm_ptr->local_size < node->u.comm_avg_ppn_le.val * comm_ptr->num_external) + comm_ptr->local_size < node->u.value_le.val * comm_ptr->num_external) node = node->success; else node = node->failure; @@ -718,27 +471,13 @@ int MPIR_Csel_prune(void *root_csel, MPIR_Comm * comm_ptr, void **comm_csel_) return mpi_errno; } -static void free_tree(csel_node_s * node) -{ - if (node->type == CSEL_NODE_TYPE__CONTAINER) { - MPL_free(node->u.cnt.container); - MPL_free(node); - } else { - if (node->success) - free_tree(node->success); - if (node->failure) - free_tree(node->failure); - MPL_free(node); - } -} - int MPIR_Csel_free(void *csel_) { int mpi_errno = MPI_SUCCESS; csel_s *csel = (csel_s *) csel_; if (csel->type == CSEL_TYPE__ROOT && csel->u.root.tree) - free_tree(csel->u.root.tree); + csel_tree_free(&csel->u.root.tree); MPL_free(csel); return mpi_errno; @@ -1210,14 +949,14 @@ void *MPIR_Csel_search(void *csel_, MPIR_Csel_coll_sig_s coll_info) break; case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE: - if (comm_ptr->local_size <= node->u.comm_size_le.val) + if (comm_ptr->local_size <= node->u.value_le.val) node = node->success; else node = node->failure; break; case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT: - if (comm_ptr->local_size <= node->u.comm_size_lt.val) + if (comm_ptr->local_size <= node->u.value_lt.val) node = node->success; else node = node->failure; @@ -1245,35 +984,35 @@ void *MPIR_Csel_search(void *csel_, MPIR_Csel_coll_sig_s coll_info) break; case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE: - if (get_avg_msgsize(coll_info) <= node->u.avg_msg_size_le.val) + if (get_avg_msgsize(coll_info) <= node->u.value_le.val) node = node->success; else node = node->failure; break; case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT: - if (get_avg_msgsize(coll_info) < node->u.avg_msg_size_lt.val) + if (get_avg_msgsize(coll_info) < node->u.value_lt.val) node = node->success; else node = node->failure; break; case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE: - if (get_total_msgsize(coll_info) <= node->u.total_msg_size_le.val) + if (get_total_msgsize(coll_info) <= node->u.value_le.val) node = node->success; else node = node->failure; break; case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT: - if (get_total_msgsize(coll_info) < node->u.total_msg_size_lt.val) + if (get_total_msgsize(coll_info) < node->u.value_lt.val) node = node->success; else node = node->failure; break; case CSEL_NODE_TYPE__OPERATOR__COUNT_LE: - if (get_count(coll_info) <= node->u.count_le.val) + if (get_count(coll_info) <= node->u.value_lt.val) node = node->success; else node = node->failure; @@ -1324,7 +1063,7 @@ void *MPIR_Csel_search(void *csel_, MPIR_Csel_coll_sig_s coll_info) case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE: if ((comm_ptr->attr & MPIR_COMM_ATTR__HIERARCHY) && - comm_ptr->local_size <= node->u.comm_avg_ppn_le.val * comm_ptr->num_external) + comm_ptr->local_size <= node->u.value_le.val * comm_ptr->num_external) node = node->success; else node = node->failure; @@ -1332,12 +1071,39 @@ void *MPIR_Csel_search(void *csel_, MPIR_Csel_coll_sig_s coll_info) case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT: if ((comm_ptr->attr & MPIR_COMM_ATTR__HIERARCHY) && - comm_ptr->local_size < node->u.comm_avg_ppn_le.val * comm_ptr->num_external) + comm_ptr->local_size < node->u.value_le.val * comm_ptr->num_external) node = node->success; else node = node->failure; break; + case CSEL_NODE_TYPE__OPERATOR__RANGE_SET: + switch (node->u.range_set.nodes[0]->type) { + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_RANGE: + node = csel_tree_range_match(node, comm_ptr->local_size); + break; + case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_RANGE: + node = csel_tree_range_match(node, get_avg_msgsize(coll_info)); + break; + case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_RANGE: + node = csel_tree_range_match(node, get_total_msgsize(coll_info)); + break; + case CSEL_NODE_TYPE__OPERATOR__COUNT_RANGE: + node = csel_tree_range_match(node, get_count(coll_info)); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_RANGE: + if (comm_ptr->attr & MPIR_COMM_ATTR__HIERARCHY) { + node = csel_tree_range_match(node, comm_ptr->local_size + / comm_ptr->num_external); + } else { + node = node->failure; + } + break; + default: + MPIR_Assert(0); + } + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY: if (MPIR_Comm_is_parent_comm(comm_ptr) == node->u.comm_hierarchy.val) node = node->success; diff --git a/src/mpi/coll/src/csel_constants.c b/src/mpi/coll/src/csel_constants.c new file mode 100644 index 00000000000..e6812356ee1 --- /dev/null +++ b/src/mpi/coll/src/csel_constants.c @@ -0,0 +1,149 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +/* TODO: this file should be generated */ + +#include "csel_internal.h" + +const char *Csel_coll_type_str[] = { + /* MPIR_CSEL_COLL_TYPE__ALLGATHER */ "allgather", + /* MPIR_CSEL_COLL_TYPE__ALLGATHERV */ "allgatherv", + /* MPIR_CSEL_COLL_TYPE__ALLREDUCE */ "allreduce", + /* MPIR_CSEL_COLL_TYPE__ALLTOALL */ "alltoall", + /* MPIR_CSEL_COLL_TYPE__ALLTOALLV */ "alltoallv", + /* MPIR_CSEL_COLL_TYPE__ALLTOALLW */ "alltoallw", + /* MPIR_CSEL_COLL_TYPE__BARRIER */ "barrier", + /* MPIR_CSEL_COLL_TYPE__BCAST */ "bcast", + /* MPIR_CSEL_COLL_TYPE__EXSCAN */ "exscan", + /* MPIR_CSEL_COLL_TYPE__GATHER */ "gather", + /* MPIR_CSEL_COLL_TYPE__GATHERV */ "gatherv", + /* MPIR_CSEL_COLL_TYPE__IALLGATHER */ "iallgather", + /* MPIR_CSEL_COLL_TYPE__IALLGATHERV */ "iallgatherv", + /* MPIR_CSEL_COLL_TYPE__IALLREDUCE */ "iallreduce", + /* MPIR_CSEL_COLL_TYPE__IALLTOALL */ "ialltoall", + /* MPIR_CSEL_COLL_TYPE__IALLTOALLV */ "ialltoallv", + /* MPIR_CSEL_COLL_TYPE__IALLTOALLW */ "ialltoallw", + /* MPIR_CSEL_COLL_TYPE__IBARRIER */ "ibarrier", + /* MPIR_CSEL_COLL_TYPE__IBCAST */ "ibcast", + /* MPIR_CSEL_COLL_TYPE__IEXSCAN */ "iexscan", + /* MPIR_CSEL_COLL_TYPE__IGATHER */ "igather", + /* MPIR_CSEL_COLL_TYPE__IGATHERV */ "igatherv", + /* MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLGATHER */ "ineighbor_allgather", + /* MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLGATHERV */ "ineighbor_allgatherv", + /* MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLTOALL */ "ineighbor_alltoall", + /* MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLTOALLV */ "ineighbor_alltoallv", + /* MPIR_CSEL_COLL_TYPE__INEIGHBOR_ALLTOALLW */ "ineighbor_alltoallw", + /* MPIR_CSEL_COLL_TYPE__IREDUCE */ "ireduce", + /* MPIR_CSEL_COLL_TYPE__IREDUCE_SCATTER */ "ireduce_scatter", + /* MPIR_CSEL_COLL_TYPE__IREDUCE_SCATTER_BLOCK */ "ireduce_scatter_block", + /* MPIR_CSEL_COLL_TYPE__ISCAN */ "iscan", + /* MPIR_CSEL_COLL_TYPE__ISCATTER */ "iscatter", + /* MPIR_CSEL_COLL_TYPE__ISCATTERV */ "iscatterv", + /* MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLGATHER */ "neighbor_allgather", + /* MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLGATHERV */ "neighbor_allgatherv", + /* MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLTOALL */ "neighbor_alltoall", + /* MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLTOALLV */ "neighbor_alltoallv", + /* MPIR_CSEL_COLL_TYPE__NEIGHBOR_ALLTOALLW */ "neighbor_alltoallw", + /* MPIR_CSEL_COLL_TYPE__REDUCE */ "reduce", + /* MPIR_CSEL_COLL_TYPE__REDUCE_SCATTER */ "reduce_scatter", + /* MPIR_CSEL_COLL_TYPE__REDUCE_SCATTER_BLOCK */ "reduce_scatter_block", + /* MPIR_CSEL_COLL_TYPE__SCAN */ "scan", + /* MPIR_CSEL_COLL_TYPE__SCATTER */ "scatter", + /* MPIR_CSEL_COLL_TYPE__SCATTERV */ "scatterv", + /* MPIR_CSEL_COLL_TYPE__END */ "!END_OF_COLLECTIVE" +}; + +const char *Csel_comm_hierarchy_str[] = { + /* MPIR_CSEL_COMM_HIERARCHY__FLAT */ "flat", + /* MPIR_CSEL_COMM_HIERARCHY__NODE */ "node", + /* MPIR_CSEL_COMM_HIERARCHY__NODE_ROOTS */ "node_roots", + /* MPIR_CSEL_COMM_HIERARCHY__PARENT */ "parent", + /* MPIR_CSEL_COMM_HIERARCHY__END */ "!END_OF_COMM_HIERARCHY" +}; + +const char *Csel_container_type_str[] = { +#include "csel_constants_gen.h" + + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_release_gather */ + "MPIDI_POSIX_mpi_bcast_release_gather", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_ipc_read */ + "MPIDI_POSIX_mpi_bcast_ipc_read", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_impl */ "MPIR_Bcast_impl", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_barrier_release_gather */ + "MPIDI_POSIX_mpi_barrier_release_gather", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_impl */ "MPIR_Barrier_impl", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_allreduce_release_gather */ + "MPIDI_POSIX_mpi_allreduce_release_gather", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_impl */ "MPIR_Allreduce_impl", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_reduce_release_gather */ + "MPIDI_POSIX_mpi_reduce_release_gather", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_impl */ "MPIR_Reduce_impl", + + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_alpha */ + "MPIDI_Barrier_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_beta */ + "MPIDI_Barrier_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_alpha */ + "MPIDI_Bcast_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_beta */ + "MPIDI_Bcast_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_gamma */ + "MPIDI_Bcast_intra_composition_gamma", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_delta */ + "MPIDI_Bcast_intra_composition_delta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_alpha */ + "MPIDI_Reduce_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_beta */ + "MPIDI_Reduce_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_gamma */ + "MPIDI_Reduce_intra_composition_gamma", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_alpha */ + "MPIDI_Allreduce_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_beta */ + "MPIDI_Allreduce_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_gamma */ + "MPIDI_Allreduce_intra_composition_gamma", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_delta */ + "MPIDI_Allreduce_intra_composition_delta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_alpha */ + "MPIDI_Alltoall_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_beta */ + "MPIDI_Alltoall_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallv_intra_composition_alpha */ + "MPIDI_Alltoallv_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallw_intra_composition_alpha */ + "MPIDI_Alltoallw_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_alpha */ + "MPIDI_Allgather_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_beta */ + "MPIDI_Allgather_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgatherv_intra_composition_alpha */ + "MPIDI_Allgatherv_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gather_intra_composition_alpha */ + "MPIDI_Gather_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gatherv_intra_composition_alpha */ + "MPIDI_Gatherv_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatter_intra_composition_alpha */ + "MPIDI_Scatter_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatterv_intra_composition_alpha */ + "MPIDI_Scatterv_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_intra_composition_alpha */ + "MPIDI_Reduce_scatter_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_block_intra_composition_alpha */ + "MPIDI_Reduce_scatter_block_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_alpha */ + "MPIDI_Scan_intra_composition_alpha", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_beta */ + "MPIDI_Scan_intra_composition_beta", + /* MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Exscan_intra_composition_alpha */ + "MPIDI_Exscan_intra_composition_alpha", + + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_OFI_Bcast_intra_triggered_tagged */ + "MPIDI_OFI_Bcast_intra_triggered_tagged", + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_OFI_Bcast_intra_triggered_rma */ + "MPIDI_OFI_Bcast_intra_triggered_rma", + + /* MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count */ "END_OF_MPIR_ALGO" +}; diff --git a/src/mpi/coll/src/csel_container.c b/src/mpi/coll/src/csel_container.c index 92563c69d43..91488dd8aa2 100644 --- a/src/mpi/coll/src/csel_container.c +++ b/src/mpi/coll/src/csel_container.c @@ -6,6 +6,7 @@ #include "mpiimpl.h" #include "coll_impl.h" #include "csel_container.h" +#include "csel_internal.h" #include "mpl.h" static void parse_container_params(struct json_object *obj, MPII_Csel_container_s * cnt) @@ -380,466 +381,35 @@ void *MPII_Create_container(struct json_object *obj) json_object_object_foreach(obj, key, val) { char *ckey = MPL_strdup_no_spaces(key); - if (!strcmp(ckey, "algorithm=MPIR_Allgather_intra_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_intra_k_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_k_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_intra_recursive_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_intra_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_intra_recexch_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_recexch_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_intra_recexch_halving")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_intra_recexch_halving; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_inter_local_gather_remote_bcast")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_inter_local_gather_remote_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Allgather_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgather_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Allgatherv_intra_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_intra_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Allgatherv_intra_recursive_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Allgatherv_intra_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_intra_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Allgatherv_inter_remote_gather_local_bcast")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_inter_remote_gather_local_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Allgatherv_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allgatherv_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_recursive_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_recursive_multiplying")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_recursive_multiplying; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_reduce_scatter_allgather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_reduce_scatter_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_recexch")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_recexch; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_intra_k_reduce_scatter_allgather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_intra_k_reduce_scatter_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_inter_reduce_exchange_bcast")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_inter_reduce_exchange_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Allreduce_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_intra_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_intra_k_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_k_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_intra_pairwise")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_pairwise; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_intra_pairwise_sendrecv_replace")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_pairwise_sendrecv_replace; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_intra_scattered")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_intra_scattered; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_inter_pairwise_exchange")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_inter_pairwise_exchange; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoall_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoall_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallv_intra_pairwise_sendrecv_replace")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_intra_pairwise_sendrecv_replace; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallv_intra_scattered")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_intra_scattered; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallv_inter_pairwise_exchange")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_inter_pairwise_exchange; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallv_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallv_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallw_intra_pairwise_sendrecv_replace")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_intra_pairwise_sendrecv_replace; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallw_intra_scattered")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_intra_scattered; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallw_inter_pairwise_exchange")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_inter_pairwise_exchange; - else if (!strcmp(ckey, "algorithm=MPIR_Alltoallw_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Alltoallw_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Barrier_intra_k_dissemination")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_intra_k_dissemination; - else if (!strcmp(ckey, "algorithm=MPIR_Barrier_intra_recexch")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_intra_recexch; - else if (!strcmp(ckey, "algorithm=MPIR_Barrier_intra_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_intra_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Barrier_inter_bcast")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_inter_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Barrier_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_intra_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_intra_scatter_recursive_doubling_allgather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_scatter_recursive_doubling_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_intra_scatter_ring_allgather")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_scatter_ring_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_intra_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_intra_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_intra_pipelined_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_intra_pipelined_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_inter_remote_send_local_bcast")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_inter_remote_send_local_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Bcast_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Exscan_intra_recursive_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Exscan_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Exscan_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Exscan_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Gather_intra_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_intra_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Gather_inter_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_inter_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Gather_inter_local_gather_remote_send")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_inter_local_gather_remote_send; - else if (!strcmp(ckey, "algorithm=MPIR_Gather_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gather_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Gatherv_allcomm_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gatherv_allcomm_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Gatherv_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Gatherv_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_tsp_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_tsp_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_sched_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_sched_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_sched_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_sched_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_tsp_recexch_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_tsp_recexch_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_tsp_recexch_halving")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_tsp_recexch_halving; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_intra_tsp_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_intra_tsp_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgather_inter_sched_local_gather_remote_bcast")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgather_inter_sched_local_gather_remote_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_tsp_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_tsp_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_sched_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_sched_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_sched_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_sched_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_tsp_recexch_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_tsp_recexch_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_tsp_recexch_halving")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_tsp_recexch_halving; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_intra_tsp_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_intra_tsp_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Iallgatherv_inter_sched_remote_gather_local_bcast")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallgatherv_inter_sched_remote_gather_local_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_sched_naive")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_sched_naive; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_sched_reduce_scatter_allgather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_sched_reduce_scatter_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_tsp_recexch_single_buffer")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_tsp_recexch_single_buffer; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_tsp_recexch_multiple_buffer")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_tsp_recexch_multiple_buffer; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_tsp_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_tsp_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_tsp_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_tsp_ring; - else if (!strcmp - (ckey, - "algorithm=MPIR_Iallreduce_intra_tsp_recexch_reduce_scatter_recexch_allgatherv")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_tsp_recexch_reduce_scatter_recexch_allgatherv; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_intra_sched_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_intra_sched_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Iallreduce_inter_sched_remote_reduce_local_bcast")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iallreduce_inter_sched_remote_reduce_local_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_tsp_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_tsp_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_tsp_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_tsp_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_tsp_scattered")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_tsp_scattered; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_sched_brucks")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_sched_brucks; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_sched_inplace")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_sched_inplace; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_sched_pairwise")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_sched_pairwise; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_intra_sched_permuted_sendrecv")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_intra_sched_permuted_sendrecv; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoall_inter_sched_pairwise_exchange")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoall_inter_sched_pairwise_exchange; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallv_intra_sched_blocked")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallv_intra_sched_blocked; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallv_intra_sched_inplace")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallv_intra_sched_inplace; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallv_intra_tsp_scattered")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallv_intra_tsp_scattered; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallv_intra_tsp_blocked")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallv_intra_tsp_blocked; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallv_intra_tsp_inplace")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallv_intra_tsp_inplace; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallv_inter_sched_pairwise_exchange")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallv_inter_sched_pairwise_exchange; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallw_intra_tsp_blocked")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallw_intra_tsp_blocked; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallw_intra_tsp_inplace")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallw_intra_tsp_inplace; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallw_intra_sched_blocked")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallw_intra_sched_blocked; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallw_intra_sched_inplace")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallw_intra_sched_inplace; - else if (!strcmp(ckey, "algorithm=MPIR_Ialltoallw_inter_sched_pairwise_exchange")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ialltoallw_inter_sched_pairwise_exchange; - else if (!strcmp(ckey, "algorithm=MPIR_Ibarrier_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibarrier_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Ibarrier_intra_tsp_recexch")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibarrier_intra_tsp_recexch; - else if (!strcmp(ckey, "algorithm=MPIR_Ibarrier_intra_tsp_k_dissem")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibarrier_intra_tsp_k_dissemination; - else if (!strcmp(ckey, "algorithm=MPIR_Ibarrier_inter_sched_bcast")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibarrier_inter_sched_bcast; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_intra_tsp_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_intra_tsp_scatterv_recexch_allgatherv")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_scatterv_recexch_allgatherv; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_intra_tsp_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_tsp_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_intra_sched_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_sched_binomial; - else if (!strcmp - (ckey, "algorithm=MPIR_Ibcast_intra_sched_scatter_recursive_doubling_allgather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_sched_scatter_recursive_doubling_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_intra_sched_scatter_ring_allgather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_sched_scatter_ring_allgather; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_intra_sched_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_intra_sched_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Ibcast_inter_sched_flat")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ibcast_inter_sched_flat; - else if (!strcmp(ckey, "algorithm=MPIR_Iexscan_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iexscan_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Igather_intra_tsp_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Igather_intra_tsp_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Igather_intra_sched_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Igather_intra_sched_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Igather_inter_sched_long")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Igather_inter_sched_long; - else if (!strcmp(ckey, "algorithm=MPIR_Igather_inter_sched_short")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Igather_inter_sched_short; - else if (!strcmp(ckey, "algorithm=MPIR_Igatherv_allcomm_tsp_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Igatherv_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Igatherv_allcomm_sched_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Igatherv_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_allgather_allcomm_tsp_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_allgather_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_allgather_allcomm_sched_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_allgather_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_allgatherv_allcomm_tsp_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_allgatherv_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_allgatherv_allcomm_sched_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_allgatherv_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_alltoall_allcomm_tsp_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_alltoall_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_alltoall_allcomm_sched_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_alltoall_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_alltoallv_allcomm_tsp_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_alltoallv_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_alltoallv_allcomm_sched_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_alltoallv_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_alltoallw_allcomm_tsp_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_alltoallw_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ineighbor_alltoallw_allcomm_sched_linear")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ineighbor_alltoallw_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_intra_tsp_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_intra_tsp_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_intra_tsp_ring")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_intra_tsp_ring; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_intra_sched_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_intra_sched_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_intra_sched_reduce_scatter_gather")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_intra_sched_reduce_scatter_gather; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_intra_sched_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_intra_sched_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_inter_sched_local_reduce_remote_send")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_inter_sched_local_reduce_remote_send; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_intra_sched_noncommutative")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_intra_sched_noncommutative; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_intra_sched_pairwise")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_intra_sched_pairwise; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_intra_sched_recursive_halving")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_intra_sched_recursive_halving; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_intra_tsp_recexch")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_intra_tsp_recexch; - else if (!strcmp - (ckey, "algorithm=MPIR_Ireduce_scatter_inter_sched_remote_reduce_local_scatterv")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_inter_sched_remote_reduce_local_scatterv; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_block_intra_tsp_recexch")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_block_intra_tsp_recexch; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_block_intra_sched_noncommutative")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_block_intra_sched_noncommutative; - else if (!strcmp(ckey, "algorithm=MPIR_Ireduce_scatter_block_intra_sched_pairwise")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_block_intra_sched_pairwise; - else if (!strcmp - (ckey, "algorithm=MPIR_Ireduce_scatter_block_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_block_intra_sched_recursive_doubling; - else if (!strcmp - (ckey, "algorithm=MPIR_Ireduce_scatter_block_intra_sched_recursive_halving")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_block_intra_sched_recursive_halving; - else if (!strcmp - (ckey, - "algorithm=MPIR_Ireduce_scatter_block_inter_sched_remote_reduce_local_scatterv")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Ireduce_scatter_block_inter_sched_remote_reduce_local_scatterv; - else if (!strcmp(ckey, "algorithm=MPIR_Iscan_intra_sched_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscan_intra_sched_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iscan_intra_sched_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscan_intra_sched_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Iscan_intra_tsp_recursive_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscan_intra_tsp_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Iscatter_intra_tsp_tree")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatter_intra_tsp_tree; - else if (!strcmp(ckey, "algorithm=MPIR_Iscatter_intra_sched_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatter_intra_sched_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Iscatter_inter_sched_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatter_inter_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Iscatter_inter_sched_remote_send_local_scatter")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatter_inter_sched_remote_send_local_scatter; - else if (!strcmp(ckey, "algorithm=MPIR_Iscatterv_allcomm_tsp_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatterv_allcomm_tsp_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Iscatterv_allcomm_sched_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Iscatterv_allcomm_sched_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Neighbor_allgather_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_allgather_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Neighbor_allgatherv_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_allgatherv_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Neighbor_alltoall_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_alltoall_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Neighbor_alltoallv_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_alltoallv_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Neighbor_alltoallw_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Neighbor_alltoallw_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_intra_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_intra_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_intra_reduce_scatter_gather")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_intra_reduce_scatter_gather; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_intra_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_intra_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_inter_local_reduce_remote_send")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_inter_local_reduce_remote_send; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_intra_noncommutative")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_noncommutative; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_intra_pairwise")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_pairwise; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_intra_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_intra_recursive_halving")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_intra_recursive_halving; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_inter_remote_reduce_local_scatter")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_inter_remote_reduce_local_scatter; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_block_intra_noncommutative")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_noncommutative; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_block_intra_pairwise")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_pairwise; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_block_intra_recursive_doubling")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_block_intra_recursive_halving")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_intra_recursive_halving; - else if (!strcmp - (ckey, "algorithm=MPIR_Reduce_scatter_block_inter_remote_reduce_local_scatter")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_inter_remote_reduce_local_scatter; - else if (!strcmp(ckey, "algorithm=MPIR_Reduce_scatter_block_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_scatter_block_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Scan_intra_recursive_doubling")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scan_intra_recursive_doubling; - else if (!strcmp(ckey, "algorithm=MPIR_Scan_intra_smp")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scan_intra_smp; - else if (!strcmp(ckey, "algorithm=MPIR_Scan_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scan_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Scatter_intra_binomial")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_intra_binomial; - else if (!strcmp(ckey, "algorithm=MPIR_Scatter_inter_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_inter_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Scatter_inter_remote_send_local_scatter")) - cnt->id = - MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_inter_remote_send_local_scatter; - else if (!strcmp(ckey, "algorithm=MPIR_Scatter_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatter_allcomm_nb; - else if (!strcmp(ckey, "algorithm=MPIR_Scatterv_allcomm_linear")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatterv_allcomm_linear; - else if (!strcmp(ckey, "algorithm=MPIR_Scatterv_allcomm_nb")) - cnt->id = MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Scatterv_allcomm_nb; - else { + if (!strncmp(ckey, "algorithm=", strlen("algorithm="))) { + char *str = ckey + strlen("algorithm="); + + bool matched = false; + for (int idx = 0; idx < MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count; idx++) { + if (strcmp(str, Csel_container_type_str[idx]) == 0) { + cnt->id = idx; + matched = true; + break; + } + } + if (!matched) { + MPIR_Assert(0); + } + } else if (!strncmp(ckey, "composition=", strlen("composition="))) { + char *str = ckey + strlen("composition="); + + bool matched = false; + for (int idx = 0; idx < MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count; idx++) { + if (strcmp(str, Csel_container_type_str[idx]) == 0) { + cnt->id = idx; + matched = true; + break; + } + } + if (!matched) { + MPIR_Assert(0); + } + } else { fprintf(stderr, "unrecognized key %s\n", key); MPIR_Assert(0); } diff --git a/src/mpi/coll/src/csel_internal.h b/src/mpi/coll/src/csel_internal.h new file mode 100644 index 00000000000..ecbed43f6f7 --- /dev/null +++ b/src/mpi/coll/src/csel_internal.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#ifndef CSEL_INTERNAL_H_INCLUDED +#define CSEL_INTERNAL_H_INCLUDED + +#include "mpiimpl.h" +#include "mpir_csel.h" +#include + +typedef enum { + /* global operator types */ + CSEL_NODE_TYPE__OPERATOR__IS_MULTI_THREADED = 0, + + /* comm-specific operator types */ + CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTRA, + CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTER, + + CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE, + CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT, /* Deprecated */ + CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_RANGE, + CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_NODE_COMM_SIZE, + CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_POW2, + + CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY, + CSEL_NODE_TYPE__OPERATOR__IS_NODE_CONSECUTIVE, + + CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE, + CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT, /* Deprecated */ + CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_RANGE, + + /* collective selection operator */ + CSEL_NODE_TYPE__OPERATOR__COLLECTIVE, + + /* message-specific operator types */ + CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE, + CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT, /* Deprecated */ + CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_RANGE, + CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE, + CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT, /* Deprecated */ + CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_RANGE, + + CSEL_NODE_TYPE__OPERATOR__COUNT_LE, + CSEL_NODE_TYPE__OPERATOR__COUNT_RANGE, + CSEL_NODE_TYPE__OPERATOR__COUNT_LT_POW2, + + CSEL_NODE_TYPE__OPERATOR__IS_SBUF_INPLACE, + CSEL_NODE_TYPE__OPERATOR__IS_BLOCK_REGULAR, + CSEL_NODE_TYPE__OPERATOR__IS_COMMUTATIVE, + CSEL_NODE_TYPE__OPERATOR__IS_OP_BUILT_IN, + + /* any - has to be the last branch in an array */ + CSEL_NODE_TYPE__OPERATOR__ANY, + CSEL_NODE_TYPE__OPERATOR__RANGE_SET, + + /* container type */ + CSEL_NODE_TYPE__CONTAINER, +} csel_node_type_e; + +struct csel_node { + csel_node_type_e type; + + union { + /* global types */ + struct { + int val; + } is_multi_threaded; + + /* collective selection operator */ + struct { + MPIR_Csel_coll_type_e coll_type; + } collective; + + /* message-specific operator types */ + struct { + bool val; + } is_commutative; + struct { + bool val; + } is_sbuf_inplace; + struct { + bool val; + } is_op_built_in; + struct { + bool val; + } is_block_regular; + struct { + bool val; + } is_node_consecutive; + struct { + int val; + } comm_hierarchy; + struct { + void *container; + } cnt; + + /* value le lt node for comm_size, msg_size, ppn, count */ + struct { + int val; + } value_le; + struct { + int val; + } value_lt; + + /* range node for comm_size, msg_size, ppn, count */ + struct { + int size; + struct csel_node **nodes; + } range_set; + struct { + int val; + int prev_val; + } range; + } u; + + struct csel_node *success; + struct csel_node *failure; +}; + +typedef struct csel_node csel_node_s; + +typedef enum { + CSEL_TYPE__ROOT, + CSEL_TYPE__PRUNED, +} csel_type_e; + +typedef struct { + csel_type_e type; + + union { + struct { + csel_node_s *tree; + } root; + struct { + /* one tree for each collective */ + csel_node_s *coll_trees[MPIR_CSEL_COLL_TYPE__END]; + } pruned; + } u; +} csel_s; + +extern const char *Csel_coll_type_str[]; +extern const char *Csel_comm_hierarchy_str[]; +extern const char *Csel_container_type_str[]; + +#define CSEL_CONTAINER(node) ((MPII_Csel_container_s *) (node)->u.cnt.container) + +void Csel_print_node(csel_node_s * node); +void Csel_print_container(MPII_Csel_container_s * cnt); +void Csel_print_tree(csel_node_s * node); +void Csel_print_rules(csel_node_s * node); + +csel_node_s *csel_node_create(csel_node_type_e type); +void csel_node_free(csel_node_s ** node); +void csel_tree_free(csel_node_s ** node); +csel_node_s *csel_node_swap_success(csel_node_s * node, csel_node_s * new_succ); +csel_node_s *csel_node_swap_failure(csel_node_s * node, csel_node_s * new_fail); +void csel_node_update(csel_node_s * node, csel_node_s node_value); + +void csel_tree_optimize(csel_node_s ** node); + +csel_node_s *csel_tree_range_match(csel_node_s * node, int val); + +bool is_allreduce(csel_node_s * node); +bool is_barrier(csel_node_s * node); +bool is_intra_comm(csel_node_s * node); +bool is_inter_comm(csel_node_s * node); + +csel_node_s *csel_node_create__inplace(); +csel_node_s *csel_node_create__noinplace(); +csel_node_s *csel_node_create__commutative(); +csel_node_s *csel_node_create__parent_comm(); +csel_node_s *csel_node_create__builtin_op(); +csel_node_s *csel_node_create__node_consecutive(); +csel_node_s *csel_node_create__power_of_two(); + +#endif /* CSEL_INTERNAL_CONTAINER_H_INCLUDED */ diff --git a/src/mpi/coll/src/csel_print.c b/src/mpi/coll/src/csel_print.c new file mode 100644 index 00000000000..2ffe7f7c73b --- /dev/null +++ b/src/mpi/coll/src/csel_print.c @@ -0,0 +1,294 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpiimpl.h" +#include "csel_internal.h" +#include "utlist.h" + +static int nesting = 0; + +#define printf_indent(indent) \ + do { \ + for (int nindent = 0; nindent < (indent); nindent++) \ + printf(" "); \ + } while (0) + +#define printf_newline() \ + do { \ + printf("\n"); \ + } while (0) + +struct Csel_decision_rule; +typedef struct Csel_decision_rule { + int size; + int algorithm; + csel_node_s **path; + struct Csel_decision_rule *prev, *next; +} Csel_decision_rule; + +static void print_range_node(csel_node_s * node); + +void Csel_print_tree(csel_node_s * node) +{ + if (node == NULL) { + return; + } + + if (node->type == CSEL_NODE_TYPE__OPERATOR__RANGE_SET) { + Csel_print_node(node); + } else { + printf_indent(nesting); + Csel_print_node(node); + printf_newline(); + } + + if (node->success) { + nesting++; + Csel_print_tree(node->success); + nesting--; + } + if (node->failure) { + Csel_print_tree(node->failure); + } +} + +void Csel_print_container(MPII_Csel_container_s * cnt) +{ + printf("Algorithm: %s", Csel_container_type_str[cnt->id]); +} + +static void print_range_node(csel_node_s * node) +{ + switch (node->type) { + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_RANGE: + if (node->u.range.val == 0) { + printf("comm: size == %d", node->u.range.val); + } else { + printf("comm: %d < size <= %d", node->u.range.prev_val, node->u.range.val); + } + break; + case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_RANGE: + if (node->u.range.val == 0) { + printf("msg: avg_size == %d", node->u.range.val); + } else { + printf("msg: %d < avg_size <= %d", node->u.range.prev_val, node->u.range.val); + } + break; + case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_RANGE: + if (node->u.range.val == 0) { + printf("msg: total_size == %d", node->u.range.val); + } else { + printf("msg: %d < total_size <= %d", node->u.range.prev_val, node->u.range.val); + } + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_RANGE: + if (node->u.range.val == 0) { + printf("comm: avg_ppn == %d", node->u.range.val); + } else { + printf("comm: %d < ave_ppn <= %d", node->u.range.prev_val, node->u.range.val); + } + break; + case CSEL_NODE_TYPE__OPERATOR__COUNT_RANGE: + if (node->u.range.val == 0) { + printf("param: count == %d", node->u.range.val); + } else { + printf("param: %d < count <= %d", node->u.range.prev_val, node->u.range.val); + } + break; + default: + MPIR_Assert(0); + } +} + +void Csel_print_node(csel_node_s * node) +{ + if (node == NULL) { + return; + } + + switch (node->type) { + case CSEL_NODE_TYPE__OPERATOR__IS_MULTI_THREADED: + printf("MPI library is multithreaded"); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTRA: + printf("intra_comm"); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTER: + printf("inter_comm"); + break; + case CSEL_NODE_TYPE__OPERATOR__COLLECTIVE: + printf("collective: %s", Csel_coll_type_str[node->u.collective.coll_type]); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE: + printf("comm_size <= %d", node->u.value_le.val); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT: + printf("comm_size < %d", node->u.value_lt.val); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_POW2: + printf("comm_size is power-of-two"); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_NODE_COMM_SIZE: + printf("comm_size == node_comm_size"); + break; + case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE: + printf("avg_msg_size <= %d", node->u.value_le.val); + break; + case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT: + printf("avg_msg_size < %d", node->u.value_lt.val); + break; + case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE: + printf("total_msg_size <= %d", node->u.value_le.val); + break; + case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT: + printf("total_msg_size < %d", node->u.value_lt.val); + break; + case CSEL_NODE_TYPE__CONTAINER: + Csel_print_container(node->u.cnt.container); + break; + case CSEL_NODE_TYPE__OPERATOR__COUNT_LE: + printf("count <= %d", node->u.value_le.val); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_RANGE: + case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_RANGE: + case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_RANGE: + case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_RANGE: + case CSEL_NODE_TYPE__OPERATOR__COUNT_RANGE: + print_range_node(node); + break; + case CSEL_NODE_TYPE__OPERATOR__RANGE_SET:{ + if (nesting) { + for (int idx = 0; idx < node->u.range_set.size; idx++) { + Csel_print_tree(node->u.range_set.nodes[idx]); + } + } else { /* print only the range set node */ + printf("range_set:"); + for (int idx = 0; idx < node->u.range_set.size; idx++) { + printf(" %d", node->u.range_set.nodes[idx]->u.range.val); + } + } + break; + } + case CSEL_NODE_TYPE__OPERATOR__COUNT_LT_POW2: + printf("count < nearest power-of-two less than comm size"); + break; + case CSEL_NODE_TYPE__OPERATOR__IS_SBUF_INPLACE: + printf("source buffer is MPI_IN_PLACE"); + break; + case CSEL_NODE_TYPE__OPERATOR__IS_BLOCK_REGULAR: + printf("all blocks have the same count"); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY: + printf("comm hierarchy is: %s", Csel_comm_hierarchy_str[node->u.comm_hierarchy.val]); + break; + case CSEL_NODE_TYPE__OPERATOR__IS_NODE_CONSECUTIVE: + printf("process ranks are consecutive on the node"); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE: + printf("comm avg ppn <= %d", node->u.value_le.val); + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT: + printf("comm avg ppn < %d", node->u.value_lt.val); + break; + case CSEL_NODE_TYPE__OPERATOR__IS_COMMUTATIVE: + if (node->u.is_commutative.val == true) + printf("commutative OP"); + else + printf("not commutative OP"); + break; + case CSEL_NODE_TYPE__OPERATOR__IS_OP_BUILT_IN: + printf("built-in OP"); + break; + case CSEL_NODE_TYPE__OPERATOR__ANY: + printf("any"); + break; + default: + printf("unknown operator"); + MPIR_Assert(0); + } +} + +static csel_node_s *decision_path[128] = { 0 }; +static Csel_decision_rule *algorithms[MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count] = { 0 }; + +static void collect_rules(csel_node_s * node); + +void collect_rules(csel_node_s * node) +{ + if (node == NULL) { + return; + } + + if (node->type == CSEL_NODE_TYPE__CONTAINER) { + int alg_id = ((MPII_Csel_container_s *) node->u.cnt.container)->id; + /* save decision path */ + // for (int i = 0; i < nesting; i++) { + // Csel_print_node(decision_path[i]); + // } + // printf("--> %s\n", Csel_container_type_str[alg_id]); + Csel_decision_rule *new_rule = + (Csel_decision_rule *) MPL_malloc(sizeof(Csel_decision_rule), MPL_MEM_OTHER); + new_rule->size = nesting; + new_rule->algorithm = alg_id; + new_rule->path = + (csel_node_s **) MPL_malloc(sizeof(csel_node_s *) * nesting, MPL_MEM_OTHER); + memcpy(new_rule->path, decision_path, sizeof(csel_node_s *) * new_rule->size); + DL_APPEND(algorithms[alg_id], new_rule); + } + if (node->type == CSEL_NODE_TYPE__OPERATOR__RANGE_SET) { + for (int idx = 0; idx < node->u.range_set.size; idx++) { + collect_rules(node->u.range_set.nodes[idx]); + } + } else { + decision_path[nesting] = node; + nesting++; + collect_rules(node->success); + nesting--; + if (node->failure) { + collect_rules(node->failure); + } + } +} + +void Csel_print_rules(csel_node_s * node) +{ + memset(decision_path, 0, sizeof(csel_node_s *) * 128); + memset(algorithms, 0, + sizeof(Csel_decision_rule *) * MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count); + + collect_rules(node); + + for (int i = 0; i < MPII_CSEL_CONTAINER_TYPE__ALGORITHM__Algorithm_count; i++) { + if (algorithms[i] != NULL) { + printf("%s\n", Csel_container_type_str[i]); + if (algorithms[i] == NULL) { + continue; + } else { + Csel_decision_rule *iter = NULL, *temp = NULL; + if (algorithms[i]->size == 1) { + printf_indent(1); + printf(" && any\n"); + MPL_free(algorithms[i]->path); + MPL_free(algorithms[i]); + } else { + DL_FOREACH_SAFE(algorithms[i], iter, temp) { + printf_indent(1); + int j = 1; + Csel_print_node(iter->path[j]); + j++; + for (; j < iter->size; j++) { + printf(" && "); + Csel_print_node(iter->path[j]); + } + printf_newline(); + DL_DELETE(algorithms[i], iter); + MPL_free(iter->path); + MPL_free(iter); + } + } + } + } + } +} diff --git a/src/mpi/coll/src/csel_tree.c b/src/mpi/coll/src/csel_tree.c new file mode 100644 index 00000000000..449eb32e03b --- /dev/null +++ b/src/mpi/coll/src/csel_tree.c @@ -0,0 +1,377 @@ +/* + * Copyright (C) by Argonne National Laboratory + * See COPYRIGHT in top-level directory + */ + +#include "mpiimpl.h" +#include "csel_internal.h" + +csel_node_s *csel_node_create(csel_node_type_e type) +{ + csel_node_s *new_node = (csel_node_s *) MPL_malloc(sizeof(csel_node_s), MPL_MEM_OTHER); + + MPIR_Assert(new_node); + + new_node->type = type; + new_node->success = NULL; + new_node->failure = NULL; + + /* set further allocation and init */ + switch (type) { + case CSEL_NODE_TYPE__CONTAINER:{ + MPII_Csel_container_s *new_container = (MPII_Csel_container_s *) + MPL_malloc(sizeof(MPII_Csel_container_s), MPL_MEM_OTHER); + MPIR_Assert(new_container); + new_node->u.cnt.container = new_container; + break; + } + default: + break; + } + + return new_node; +} + +void csel_node_free(csel_node_s ** node) +{ + if (*node == NULL) { + return; + } + + MPIR_Assert((*node)->success == NULL); + MPIR_Assert((*node)->failure == NULL); + + switch ((*node)->type) { + case CSEL_NODE_TYPE__CONTAINER: + MPL_free((*node)->u.cnt.container); + break; + case CSEL_NODE_TYPE__OPERATOR__RANGE_SET: + for (int idx = 0; idx < (*node)->u.range_set.size; idx++) { + csel_tree_free(&(*node)->u.range_set.nodes[idx]); + } + MPL_free((*node)->u.range_set.nodes); + break; + default: + break; + } + MPL_free(*node); + *node = NULL; +} + +void csel_tree_free(csel_node_s ** node) +{ + if (*node == NULL) { + return; + } + + csel_tree_free(&(*node)->success); + csel_tree_free(&(*node)->failure); + + csel_node_free(node); +} + +csel_node_s *csel_node_swap_success(csel_node_s * node, csel_node_s * new_succ) +{ + MPIR_Assert(node); + csel_node_s *old_succ = node->success; + node->success = new_succ; + return old_succ; +} + +csel_node_s *csel_node_swap_failure(csel_node_s * node, csel_node_s * new_fail) +{ + MPIR_Assert(node); + csel_node_s *old_fail = node->failure; + node->failure = new_fail; + return old_fail; +} + +/* update node content without touching child nodes */ +void csel_node_update(csel_node_s * node, csel_node_s node_value) +{ + MPIR_Assert(node); + node->type = node_value.type; + node->u = node_value.u; +} + +static void csel_tree_merge_anys(csel_node_s ** node); +static void csel_tree_convert_lt2le(csel_node_s ** node); +static void csel_tree_merge_le2range(csel_node_s ** node, csel_node_type_e le_type, + csel_node_type_e range_type); +static void csel_tree_merge_comm_size_range(csel_node_s ** node); +static void csel_tree_merge_avg_msg_size_range(csel_node_s ** node); +static void csel_tree_merge_total_msg_size_range(csel_node_s ** node); +static void csel_tree_merge_count_range(csel_node_s ** node); +static void csel_tree_merge_comm_avg_ppn_range(csel_node_s ** node); + +static void csel_tree_apply(csel_node_s ** node, void (*func) (csel_node_s ** node)); + +static void csel_tree_merge_anys(csel_node_s ** node) +{ + while ((*node)->type == CSEL_NODE_TYPE__OPERATOR__ANY) { + csel_node_s *any_node = *node; + *node = any_node->success; + any_node->success = NULL; + csel_node_free(&any_node); + } +} + +static void csel_tree_convert_lt2le(csel_node_s ** node) +{ + int val = 0; + MPIR_Assert((*node)); + switch ((*node)->type) { + case CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LT: + val = (*node)->u.value_lt.val; + MPIR_Assert(val > 0); + (*node)->type = CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE; + (*node)->u.value_le.val = val - 1; + break; + case CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LT: + val = (*node)->u.value_lt.val; + MPIR_Assert(val > 0); + (*node)->type = CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE; + (*node)->u.value_le.val = val - 1; + break; + case CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LT: + val = (*node)->u.value_lt.val; + MPIR_Assert(val > 0); + (*node)->type = CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE; + (*node)->u.value_le.val = val - 1; + break; + case CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LT: + val = (*node)->u.value_lt.val; + MPIR_Assert(val > 0); + (*node)->type = CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE; + (*node)->u.value_le.val = val - 1; + break; + default: + break; + } +} + +static void csel_tree_merge_le2range(csel_node_s ** node, csel_node_type_e le_type, + csel_node_type_e range_type) +{ + if (*node == NULL) { + return; + } + + int node_count = 0; + int last_val = 0; + for (csel_node_s * iter = (*node); iter != NULL && iter->type == le_type; iter = iter->failure) { + node_count++; + last_val = iter->u.value_le.val; + } + + if (node_count == 0) { + return; + } + + if (node_count == 1 && last_val == INT_MAX) { + /* there is only one range from 0 to INT_MAX, prune this node */ + csel_node_s *tmp = *node; + *node = tmp->success; + tmp->success = NULL; + tmp->failure = NULL; + csel_node_free(&tmp); + return; + } + + csel_node_s *range_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__RANGE_SET); + if (last_val < INT_MAX) { + range_node->u.range_set.size = node_count + 1; + } else { + range_node->u.range_set.size = node_count; + } + range_node->u.range_set.nodes = MPL_malloc(sizeof(csel_node_s *) * range_node->u.range_set.size, + MPL_MEM_OTHER); + csel_node_s *curr = (*node); + int idx = 0; + int prev_val = 0; + for (; curr != NULL && curr->type == le_type; curr = curr->failure, idx++) { + range_node->u.range_set.nodes[idx] = csel_node_create(range_type); + range_node->u.range_set.nodes[idx]->u.range.val = curr->u.value_le.val; + range_node->u.range_set.nodes[idx]->u.range.prev_val = prev_val; + range_node->u.range_set.nodes[idx]->success = curr->success; + prev_val = curr->u.value_le.val; + } + MPIR_Assert(idx == node_count); + if (last_val < INT_MAX) { + /* extra node for value higher than UB, which points to failure path of UB node */ + range_node->u.range_set.nodes[node_count] = csel_node_create(range_type); + range_node->u.range_set.nodes[node_count]->u.range.val = INT_MAX; + range_node->u.range_set.nodes[node_count]->u.range.prev_val = prev_val; + range_node->u.range_set.nodes[node_count]->success = curr; + } + + csel_node_s *old_node = (*node); + *node = range_node; + + for (csel_node_s * tmp = NULL; old_node != NULL && old_node->type == le_type;) { + tmp = old_node; + old_node = old_node->failure; + tmp->success = NULL; + tmp->failure = NULL; + csel_node_free(&tmp); + } +} + +static void csel_tree_merge_comm_size_range(csel_node_s ** node) +{ + csel_tree_merge_le2range(node, CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_LE, + CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_RANGE); +} + +static void csel_tree_merge_avg_msg_size_range(csel_node_s ** node) +{ + csel_tree_merge_le2range(node, CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_LE, + CSEL_NODE_TYPE__OPERATOR__AVG_MSG_SIZE_RANGE); +} + +static void csel_tree_merge_total_msg_size_range(csel_node_s ** node) +{ + csel_tree_merge_le2range(node, CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_LE, + CSEL_NODE_TYPE__OPERATOR__TOTAL_MSG_SIZE_RANGE); +} + +static void csel_tree_merge_count_range(csel_node_s ** node) +{ + csel_tree_merge_le2range(node, CSEL_NODE_TYPE__OPERATOR__COUNT_LE, + CSEL_NODE_TYPE__OPERATOR__COUNT_RANGE); +} + +static void csel_tree_merge_comm_avg_ppn_range(csel_node_s ** node) +{ + csel_tree_merge_le2range(node, CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_LE, + CSEL_NODE_TYPE__OPERATOR__COMM_AVG_PPN_RANGE); +} + +static void csel_tree_apply(csel_node_s ** node, void (*func) (csel_node_s ** node)) +{ + if (*node == NULL) { + return; + } + + switch ((*node)->type) { + case CSEL_NODE_TYPE__OPERATOR__RANGE_SET: + for (int idx = 0; idx < (*node)->u.range_set.size; idx++) { + csel_tree_apply(&(*node)->u.range_set.nodes[idx], func); + } + break; + default: + func(node); + } + + if ((*node)->success) { + csel_tree_apply(&((*node)->success), func); + } + if ((*node)->failure) { + csel_tree_apply(&((*node)->failure), func); + } +} + +void csel_tree_optimize(csel_node_s ** node) +{ + csel_tree_apply(node, csel_tree_merge_anys); + csel_tree_apply(node, csel_tree_convert_lt2le); + csel_tree_apply(node, csel_tree_merge_comm_size_range); + csel_tree_apply(node, csel_tree_merge_avg_msg_size_range); + csel_tree_apply(node, csel_tree_merge_total_msg_size_range); + csel_tree_apply(node, csel_tree_merge_count_range); + csel_tree_apply(node, csel_tree_merge_comm_avg_ppn_range); +} + +csel_node_s *csel_tree_range_match(csel_node_s * node, int val) +{ + MPIR_Assert(node->type == CSEL_NODE_TYPE__OPERATOR__RANGE_SET); + + csel_node_s **array = node->u.range_set.nodes; + int left = 0, right = node->u.range_set.size - 1; + + int mid = (left + right) / 2; + + while (true) { + if (left == mid) { + if (val <= array[mid]->u.range.val) { + return array[mid]->success; + } else { + return array[mid + 1]->success; + } + } + + if (val > array[mid]->u.range.val) { + left = mid; + mid = (left + right) / 2; + } else if (val < array[mid]->u.range.val) { + right = mid; + mid = (left + right) / 2; + } else { + return array[mid]->success; + } + } +} + +bool is_barrier(csel_node_s * node) +{ + return node->type == CSEL_NODE_TYPE__OPERATOR__COLLECTIVE + && node->u.collective.coll_type == MPIR_CSEL_COLL_TYPE__BARRIER; +} + +bool is_intra_comm(csel_node_s * node) +{ + return node->type == CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTRA; +} + +bool is_inter_comm(csel_node_s * node) +{ + return node->type == CSEL_NODE_TYPE__OPERATOR__COMM_TYPE_INTER; +} + +csel_node_s *csel_node_create__inplace() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__IS_SBUF_INPLACE); + new_node->u.is_sbuf_inplace.val = true; + return new_node; +} + +csel_node_s *csel_node_create__noinplace() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__IS_SBUF_INPLACE); + new_node->u.is_sbuf_inplace.val = false; + return new_node; +} + +csel_node_s *csel_node_create__commutative() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__IS_COMMUTATIVE); + new_node->u.is_commutative.val = true; + return new_node; +} + +csel_node_s *csel_node_create__parent_comm() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__COMM_HIERARCHY); + new_node->u.comm_hierarchy.val = MPIR_CSEL_COMM_HIERARCHY__PARENT; + return new_node; +} + +csel_node_s *csel_node_create__builtin_op() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__IS_OP_BUILT_IN); + new_node->u.is_op_built_in.val = true; + return new_node; +} + +csel_node_s *csel_node_create__node_consecutive() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__IS_NODE_CONSECUTIVE); + new_node->u.is_node_consecutive.val = true; + return new_node; +} + +csel_node_s *csel_node_create__power_of_two() +{ + csel_node_s *new_node = csel_node_create(CSEL_NODE_TYPE__OPERATOR__COMM_SIZE_POW2); + return new_node; +} diff --git a/src/mpid/ch4/include/mpidpre.h b/src/mpid/ch4/include/mpidpre.h index 667751c705a..58d5827a1d7 100644 --- a/src/mpid/ch4/include/mpidpre.h +++ b/src/mpid/ch4/include/mpidpre.h @@ -21,7 +21,6 @@ #include "shmpre.h" #endif #include "uthash.h" -#include "ch4_csel_container.h" #define MPID_TAG_DEV_BITS 0 #define MPID_MAX_BC_SIZE 4096 diff --git a/src/mpid/ch4/netmod/ofi/ofi_csel_container.h b/src/mpid/ch4/netmod/ofi/ofi_csel_container.h deleted file mode 100644 index 9780b9d8424..00000000000 --- a/src/mpid/ch4/netmod/ofi/ofi_csel_container.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef OFI_CSEL_CONTAINER_H_INCLUDED -#define OFI_CSEL_CONTAINER_H_INCLUDED - -typedef enum { - MPIDI_OFI_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_OFI_Bcast_intra_triggered_tagged, - MPIDI_OFI_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_OFI_Bcast_intra_triggered_rma, - MPIDI_OFI_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_impl, - MPIDI_OFI_Algorithm_count, -} MPIDI_OFI_Csel_container_type_e; - -typedef struct { - MPIDI_OFI_Csel_container_type_e id; - - union { - struct { - struct { - int k; - int tree_type; - } triggered_tagged; - struct { - int k; - int tree_type; - } triggered_rma; - } bcast; - } u; -} MPIDI_OFI_csel_container_s; - -#endif /* OFI_CSEL_CONTAINER_H_INCLUDED */ diff --git a/src/mpid/ch4/netmod/ofi/ofi_init.c b/src/mpid/ch4/netmod/ofi/ofi_init.c index f6480e3c57c..e2beafa4e6a 100644 --- a/src/mpid/ch4/netmod/ofi/ofi_init.c +++ b/src/mpid/ch4/netmod/ofi/ofi_init.c @@ -8,7 +8,6 @@ #include "ofi_am_impl.h" #include "ofi_noinline.h" #include "mpir_hwtopo.h" -#include "ofi_csel_container.h" #include "ofi_init.h" /* diff --git a/src/mpid/ch4/shm/posix/posix_coll.h b/src/mpid/ch4/shm/posix/posix_coll.h index f45015d25f8..9f41f1b712b 100644 --- a/src/mpid/ch4/shm/posix/posix_coll.h +++ b/src/mpid/ch4/shm/posix/posix_coll.h @@ -10,7 +10,6 @@ #include "ch4_impl.h" #include "posix_coll_release_gather.h" #include "posix_coll_gpu_ipc.h" -#include "posix_csel_container.h" /* @@ -155,7 +154,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_barrier(MPIR_Comm * comm, int coll_ .coll_type = MPIR_CSEL_COLL_TYPE__BARRIER, .comm_ptr = comm, }; - MPIDI_POSIX_csel_container_s *cnt; + MPII_Csel_container_s *cnt; MPIR_FUNC_ENTER; @@ -175,11 +174,10 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_barrier(MPIR_Comm * comm, int coll_ goto fallback; switch (cnt->id) { - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_barrier_release_gather: - mpi_errno = - MPIDI_POSIX_mpi_barrier_release_gather(comm, coll_attr); + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_barrier_release_gather: + mpi_errno = MPIDI_POSIX_mpi_barrier_release_gather(comm, coll_attr); break; - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_impl: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_impl: goto fallback; default: MPIR_Assert(0); @@ -217,7 +215,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_bcast(void *buffer, MPI_Aint count, .u.bcast.datatype = datatype, .u.bcast.root = root, }; - MPIDI_POSIX_csel_container_s *cnt; + MPII_Csel_container_s *cnt; MPIR_FUNC_ENTER; @@ -255,17 +253,17 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_bcast(void *buffer, MPI_Aint count, goto fallback; switch (cnt->id) { - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_release_gather: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_release_gather: mpi_errno = MPIDI_POSIX_mpi_bcast_release_gather(buffer, count, datatype, root, comm, coll_attr); break; - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_ipc_read: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_ipc_read: mpi_errno = MPIDI_POSIX_mpi_bcast_gpu_ipc_read(buffer, count, datatype, root, comm, coll_attr); break; - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_impl: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_impl: goto fallback; default: MPIR_Assert(0); @@ -304,7 +302,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allreduce(const void *sendbuf, void .u.allreduce.datatype = datatype, .u.allreduce.op = op, }; - MPIDI_POSIX_csel_container_s *cnt; + MPII_Csel_container_s *cnt; MPIR_FUNC_ENTER; @@ -327,13 +325,13 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_allreduce(const void *sendbuf, void goto fallback; switch (cnt->id) { - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_allreduce_release_gather: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_allreduce_release_gather: mpi_errno = MPIDI_POSIX_mpi_allreduce_release_gather(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); break; - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_impl: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_impl: goto fallback; default: @@ -637,7 +635,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_reduce(const void *sendbuf, void *r .u.reduce.op = op, .u.reduce.root = root, }; - MPIDI_POSIX_csel_container_s *cnt; + MPII_Csel_container_s *cnt; MPIR_FUNC_ENTER; @@ -660,13 +658,13 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_POSIX_mpi_reduce(const void *sendbuf, void *r goto fallback; switch (cnt->id) { - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_reduce_release_gather: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_reduce_release_gather: mpi_errno = MPIDI_POSIX_mpi_reduce_release_gather(sendbuf, recvbuf, count, datatype, op, root, comm, coll_attr); break; - case MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_impl: + case MPII_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_impl: goto fallback; default: diff --git a/src/mpid/ch4/shm/posix/posix_csel_container.h b/src/mpid/ch4/shm/posix/posix_csel_container.h deleted file mode 100644 index 00fe8ece728..00000000000 --- a/src/mpid/ch4/shm/posix/posix_csel_container.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) by Argonne National Laboratory - * See COPYRIGHT in top-level directory - */ - -#ifndef POSIX_CSEL_CONTAINER_H_INCLUDED -#define POSIX_CSEL_CONTAINER_H_INCLUDED - -typedef struct { - enum { - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_release_gather, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_ipc_read, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Bcast_impl, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_barrier_release_gather, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Barrier_impl, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_allreduce_release_gather, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Allreduce_impl, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_reduce_release_gather, - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIR_Reduce_impl, - } id; -} MPIDI_POSIX_csel_container_s; - -#endif /* POSIX_CSEL_CONTAINER_H_INCLUDED */ diff --git a/src/mpid/ch4/shm/posix/posix_init.c b/src/mpid/ch4/shm/posix/posix_init.c index 5f4b82f36b6..26781e55b7f 100644 --- a/src/mpid/ch4/shm/posix/posix_init.c +++ b/src/mpid/ch4/shm/posix/posix_init.c @@ -56,7 +56,6 @@ #include "posix_eager.h" #include "posix_noinline.h" -#include "posix_csel_container.h" #include "mpidu_genq.h" #include "utarray.h" @@ -121,39 +120,6 @@ static int choose_posix_eager(void) goto fn_exit; } -static void *create_container(struct json_object *obj) -{ - MPIDI_POSIX_csel_container_s *cnt = - MPL_malloc(sizeof(MPIDI_POSIX_csel_container_s), MPL_MEM_COLL); - - json_object_object_foreach(obj, key, val) { - char *ckey = MPL_strdup_no_spaces(key); - - if (!strcmp(ckey, "algorithm=MPIDI_POSIX_mpi_bcast_release_gather")) - cnt->id = - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_release_gather; - else if (!strcmp(ckey, "algorithm=MPIDI_POSIX_mpi_bcast_ipc_read")) - cnt->id = MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_bcast_ipc_read; - else if (!strcmp(ckey, "algorithm=MPIDI_POSIX_mpi_barrier_release_gather")) - cnt->id = - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_barrier_release_gather; - else if (!strcmp(ckey, "algorithm=MPIDI_POSIX_mpi_allreduce_release_gather")) - cnt->id = - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_allreduce_release_gather; - else if (!strcmp(ckey, "algorithm=MPIDI_POSIX_mpi_reduce_release_gather")) - cnt->id = - MPIDI_POSIX_CSEL_CONTAINER_TYPE__ALGORITHM__MPIDI_POSIX_mpi_reduce_release_gather; - else { - fprintf(stderr, "unrecognized key %s\n", key); - MPIR_Assert(0); - } - - MPL_free(ckey); - } - - return cnt; -} - int MPIDI_POSIX_init_vci(int vci) { int mpi_errno = MPI_SUCCESS; @@ -413,29 +379,33 @@ static int posix_coll_init(void) /* Initialize collective selection */ if (!strcmp(MPIR_CVAR_CH4_POSIX_COLL_SELECTION_TUNING_JSON_FILE, "")) { - mpi_errno = MPIR_Csel_create_from_buf(MPIDI_POSIX_coll_generic_json, - create_container, &MPIDI_global.shm.posix.csel_root); + mpi_errno = MPIR_Csel_create_from_buf(MPIDI_POSIX_coll_generic_json, MPII_Create_container, + &MPIDI_global.shm.posix.csel_root); MPIDI_global.shm.posix.csel_source = "MPIDI_POSIX_coll_generic_json"; } else { mpi_errno = MPIR_Csel_create_from_file(MPIR_CVAR_CH4_POSIX_COLL_SELECTION_TUNING_JSON_FILE, - create_container, &MPIDI_global.shm.posix.csel_root); + MPII_Create_container, + &MPIDI_global.shm.posix.csel_root); MPIDI_global.shm.posix.csel_source = MPIR_CVAR_CH4_POSIX_COLL_SELECTION_TUNING_JSON_FILE; } + MPIR_Csel_debug_summary(MPIDI_global.shm.posix.csel_source, MPIDI_global.shm.posix.csel_root); MPIR_ERR_CHECK(mpi_errno); /* Initialize collective selection for gpu */ if (!strcmp(MPIR_CVAR_CH4_POSIX_COLL_SELECTION_TUNING_JSON_FILE_GPU, "")) { - mpi_errno = MPIR_Csel_create_from_buf(MPIDI_POSIX_coll_generic_json, - create_container, + mpi_errno = MPIR_Csel_create_from_buf(MPIDI_POSIX_coll_generic_json, MPII_Create_container, &MPIDI_global.shm.posix.csel_root_gpu); MPIDI_global.shm.posix.csel_source_gpu = "MPIDI_POSIX_coll_generic_json"; } else { mpi_errno = MPIR_Csel_create_from_file(MPIR_CVAR_CH4_POSIX_COLL_SELECTION_TUNING_JSON_FILE_GPU, - create_container, &MPIDI_global.shm.posix.csel_root_gpu); + MPII_Create_container, + &MPIDI_global.shm.posix.csel_root_gpu); MPIDI_global.shm.posix.csel_source_gpu = MPIR_CVAR_CH4_POSIX_COLL_SELECTION_TUNING_JSON_FILE_GPU; } + MPIR_Csel_debug_summary(MPIDI_global.shm.posix.csel_source_gpu, + MPIDI_global.shm.posix.csel_root_gpu); MPIR_ERR_CHECK(mpi_errno); fn_exit: diff --git a/src/mpid/ch4/src/ch4_coll.h b/src/mpid/ch4/src/ch4_coll.h index c16fceaa9bc..0a45953e943 100644 --- a/src/mpid/ch4/src/ch4_coll.h +++ b/src/mpid/ch4/src/ch4_coll.h @@ -102,7 +102,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Barrier_allcomm_composition_json(MPIR_Comm * comm, int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__BARRIER, @@ -118,10 +118,10 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Barrier_allcomm_composition_json(MPIR_Comm * } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_alpha: mpi_errno = MPIDI_Barrier_intra_composition_alpha(comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_beta: mpi_errno = MPIDI_Barrier_intra_composition_beta(comm, coll_attr); break; default: @@ -192,7 +192,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Bcast_allcomm_composition_json(void *buffer, .u.bcast.root = root, }; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; if (MPIR_CVAR_COLL_HYBRID_MEMORY) { cnt = MPIR_Csel_search(MPIDI_COMM(comm, csel_comm), coll_sig); @@ -213,19 +213,19 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Bcast_allcomm_composition_json(void *buffer, } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_alpha: mpi_errno = MPIDI_Bcast_intra_composition_alpha(buffer, count, datatype, root, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_beta: mpi_errno = MPIDI_Bcast_intra_composition_beta(buffer, count, datatype, root, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_gamma: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_gamma: mpi_errno = MPIDI_Bcast_intra_composition_gamma(buffer, count, datatype, root, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_delta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_delta: mpi_errno = MPIDI_Bcast_intra_composition_delta(buffer, count, datatype, root, comm, coll_attr); break; @@ -333,7 +333,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Allreduce_allcomm_composition_json(const void int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; int num_leads = 0, node_comm_size = 0; MPIR_Csel_coll_sig_s coll_sig = { @@ -356,22 +356,22 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Allreduce_allcomm_composition_json(const void } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_alpha: mpi_errno = MPIDI_Allreduce_intra_composition_alpha(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_beta: mpi_errno = MPIDI_Allreduce_intra_composition_beta(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_gamma: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_gamma: mpi_errno = MPIDI_Allreduce_intra_composition_gamma(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_delta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_delta: if (comm->comm_kind == MPIR_COMM_KIND__INTRACOMM) { MPIDI_Allreduce_fill_multi_leads_info(comm); if (comm->node_comm) @@ -527,7 +527,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Allgather_allcomm_composition_json(const void { int mpi_errno = MPI_SUCCESS; MPI_Aint type_size, data_size; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; if (sendbuf != MPI_IN_PLACE) { MPIR_Datatype_get_size_macro(sendtype, type_size); @@ -560,7 +560,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Allgather_allcomm_composition_json(const void } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_alpha: /* make sure that the algo can be run */ if (comm->comm_kind == MPIR_COMM_KIND__INTRACOMM) MPIDI_Allgather_fill_multi_leads_info(comm); @@ -573,7 +573,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Allgather_allcomm_composition_json(const void recvbuf, recvcount, recvtype, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_beta: MPII_COLLECTIVE_FALLBACK_CHECK(comm->rank, comm->comm_kind == MPIR_COMM_KIND__INTRACOMM, mpi_errno, "Allgather composition beta cannot be applied.\n"); @@ -683,7 +683,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Allgatherv(const void *sendbuf, MPI_Aint sendc MPI_Datatype recvtype, MPIR_Comm * comm, int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__ALLGATHERV, @@ -711,7 +711,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Allgatherv(const void *sendbuf, MPI_Aint sendc } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgatherv_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgatherv_intra_composition_alpha: mpi_errno = MPIDI_Allgatherv_intra_composition_alpha(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, @@ -736,7 +736,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Scatter(const void *sendbuf, MPI_Aint sendcoun int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__SCATTER, @@ -763,7 +763,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Scatter(const void *sendbuf, MPI_Aint sendcoun } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatter_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatter_intra_composition_alpha: mpi_errno = MPIDI_Scatter_intra_composition_alpha(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, coll_attr); @@ -787,7 +787,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Scatterv(const void *sendbuf, const MPI_Aint * int root, MPIR_Comm * comm, int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__SCATTERV, @@ -815,7 +815,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Scatterv(const void *sendbuf, const MPI_Aint * } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatterv_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatterv_intra_composition_alpha: mpi_errno = MPIDI_Scatterv_intra_composition_alpha(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, @@ -840,7 +840,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Gather(const void *sendbuf, MPI_Aint sendcount int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__GATHER, @@ -868,7 +868,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Gather(const void *sendbuf, MPI_Aint sendcount } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gather_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gather_intra_composition_alpha: mpi_errno = MPIDI_Gather_intra_composition_alpha(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, coll_attr); @@ -893,7 +893,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Gatherv(const void *sendbuf, MPI_Aint sendcoun int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__GATHERV, @@ -921,7 +921,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Gatherv(const void *sendbuf, MPI_Aint sendcoun } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gatherv_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gatherv_intra_composition_alpha: mpi_errno = MPIDI_Gatherv_intra_composition_alpha(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, @@ -978,7 +978,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Alltoall_allcomm_composition_json(const void data_size = recvcount * type_size; } - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__ALLTOALL, @@ -1002,7 +1002,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Alltoall_allcomm_composition_json(const void } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_alpha: if (comm->comm_kind == MPIR_COMM_KIND__INTRACOMM) MPIDI_Alltoall_fill_multi_leads_info(comm); MPII_COLLECTIVE_FALLBACK_CHECK(comm->rank, comm->comm_kind == MPIR_COMM_KIND__INTRACOMM @@ -1015,7 +1015,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Alltoall_allcomm_composition_json(const void coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_beta: MPII_COLLECTIVE_FALLBACK_CHECK(comm->rank, comm->comm_kind == MPIR_COMM_KIND__INTRACOMM, mpi_errno, "Alltoall composition beta cannot be applied.\n"); @@ -1124,7 +1124,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Alltoallv(const void *sendbuf, const MPI_Aint MPIR_Comm * comm, int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__ALLTOALLV, @@ -1153,7 +1153,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Alltoallv(const void *sendbuf, const MPI_Aint } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallv_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallv_intra_composition_alpha: mpi_errno = MPIDI_Alltoallv_intra_composition_alpha(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, @@ -1180,7 +1180,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Alltoallw(const void *sendbuf, const MPI_Aint int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__ALLTOALLW, @@ -1209,7 +1209,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Alltoallw(const void *sendbuf, const MPI_Aint } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallw_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallw_intra_composition_alpha: mpi_errno = MPIDI_Alltoallw_intra_composition_alpha(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, @@ -1235,7 +1235,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Reduce_allcomm_composition_json(const void *s int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__REDUCE, @@ -1258,17 +1258,17 @@ MPL_STATIC_INLINE_PREFIX int MPIDI_Reduce_allcomm_composition_json(const void *s } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_alpha: mpi_errno = MPIDI_Reduce_intra_composition_alpha(sendbuf, recvbuf, count, datatype, op, root, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_beta: mpi_errno = MPIDI_Reduce_intra_composition_beta(sendbuf, recvbuf, count, datatype, op, root, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_gamma: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_gamma: mpi_errno = MPIDI_Reduce_intra_composition_gamma(sendbuf, recvbuf, count, datatype, op, root, comm, coll_attr); @@ -1350,7 +1350,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Reduce_scatter(const void *sendbuf, void *recv MPI_Op op, MPIR_Comm * comm, int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__REDUCE_SCATTER, @@ -1375,7 +1375,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Reduce_scatter(const void *sendbuf, void *recv } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_intra_composition_alpha: mpi_errno = MPIDI_Reduce_scatter_intra_composition_alpha(sendbuf, recvbuf, recvcounts, datatype, op, comm, coll_attr); @@ -1398,7 +1398,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Reduce_scatter_block(const void *sendbuf, void MPI_Op op, MPIR_Comm * comm, int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__REDUCE_SCATTER_BLOCK, @@ -1424,7 +1424,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Reduce_scatter_block(const void *sendbuf, void } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_block_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_block_intra_composition_alpha: mpi_errno = MPIDI_Reduce_scatter_block_intra_composition_alpha(sendbuf, recvbuf, recvcount, datatype, op, comm, coll_attr); @@ -1447,7 +1447,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Scan(const void *sendbuf, void *recvbuf, MPI_A int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__SCAN, @@ -1471,12 +1471,12 @@ MPL_STATIC_INLINE_PREFIX int MPID_Scan(const void *sendbuf, void *recvbuf, MPI_A } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_alpha: mpi_errno = MPIDI_Scan_intra_composition_alpha(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); break; - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_beta: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_beta: mpi_errno = MPIDI_Scan_intra_composition_beta(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); @@ -1499,7 +1499,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Exscan(const void *sendbuf, void *recvbuf, MPI int coll_attr) { int mpi_errno = MPI_SUCCESS; - const MPIDI_Csel_container_s *cnt = NULL; + const MPII_Csel_container_s *cnt = NULL; MPIR_Csel_coll_sig_s coll_sig = { .coll_type = MPIR_CSEL_COLL_TYPE__EXSCAN, @@ -1523,7 +1523,7 @@ MPL_STATIC_INLINE_PREFIX int MPID_Exscan(const void *sendbuf, void *recvbuf, MPI } switch (cnt->id) { - case MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Exscan_intra_composition_alpha: + case MPII_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Exscan_intra_composition_alpha: mpi_errno = MPIDI_Exscan_intra_composition_alpha(sendbuf, recvbuf, count, datatype, op, comm, coll_attr); diff --git a/src/mpid/ch4/src/ch4_coll_impl.h b/src/mpid/ch4/src/ch4_coll_impl.h index af4fcb1379f..8c7801ae855 100644 --- a/src/mpid/ch4/src/ch4_coll_impl.h +++ b/src/mpid/ch4/src/ch4_coll_impl.h @@ -77,7 +77,6 @@ #ifndef CH4_COLL_IMPL_H_INCLUDED #define CH4_COLL_IMPL_H_INCLUDED -#include "ch4_csel_container.h" #include "ch4_comm.h" #include "algo_common.h" diff --git a/src/mpid/ch4/src/ch4_csel_container.h b/src/mpid/ch4/src/ch4_csel_container.h deleted file mode 100644 index 364c00ece87..00000000000 --- a/src/mpid/ch4/src/ch4_csel_container.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) by Argonne National Laboratory - * See COPYRIGHT in top-level directory - */ - -#ifndef CH4_CSEL_CONTAINER_H_INCLUDED -#define CH4_CSEL_CONTAINER_H_INCLUDED - -typedef struct { - enum { - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_alpha = 0, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_gamma, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_delta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_gamma, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_gamma, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_delta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallv_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallw_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgatherv_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gather_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gatherv_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatter_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatterv_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_block_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_alpha, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_beta, - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Exscan_intra_composition_alpha, - } id; -} MPIDI_Csel_container_s; - -#endif /* CH4_CSEL_CONTAINER_H_INCLUDED */ diff --git a/src/mpid/ch4/src/ch4_init.c b/src/mpid/ch4/src/ch4_init.c index c94c573cb1d..1e4d0afec2a 100644 --- a/src/mpid/ch4/src/ch4_init.c +++ b/src/mpid/ch4/src/ch4_init.c @@ -185,92 +185,6 @@ static const char *devcollstr(void) return NULL; } -static void *create_container(struct json_object *obj) -{ - MPIDI_Csel_container_s *cnt = MPL_malloc(sizeof(MPIDI_Csel_container_s), MPL_MEM_COLL); - - json_object_object_foreach(obj, key, val) { - char *ckey = MPL_strdup_no_spaces(key); - - if (!strcmp(ckey, "composition=MPIDI_Barrier_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Barrier_intra_composition_beta")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Barrier_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Bcast_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Bcast_intra_composition_beta")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Bcast_intra_composition_gamma")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_gamma; - else if (!strcmp(ckey, "composition=MPIDI_Bcast_intra_composition_delta")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Bcast_intra_composition_delta; - else if (!strcmp(ckey, "composition=MPIDI_Allreduce_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Allreduce_intra_composition_beta")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Allreduce_intra_composition_gamma")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allreduce_intra_composition_gamma; - else if (!strcmp(ckey, "composition=MPIDI_Reduce_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Reduce_intra_composition_beta")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Reduce_intra_composition_gamma")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_intra_composition_gamma; - else if (!strcmp(ckey, "composition=MPIDI_Alltoall_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Alltoall_intra_composition_beta")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoall_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Alltoallv_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallv_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Alltoallw_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Alltoallw_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Allgather_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Allgather_intra_composition_beta")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgather_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Allgatherv_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Allgatherv_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Gather_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gather_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Gatherv_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Gatherv_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Scatter_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatter_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Scatterv_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scatterv_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Reduce_scatter_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Reduce_scatter_block_intra_composition_alpha")) - cnt->id = - MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Reduce_scatter_block_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Scan_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_alpha; - else if (!strcmp(ckey, "composition=MPIDI_Scan_intra_composition_beta")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Scan_intra_composition_beta; - else if (!strcmp(ckey, "composition=MPIDI_Exscan_intra_composition_alpha")) - cnt->id = MPIDI_CSEL_CONTAINER_TYPE__COMPOSITION__MPIDI_Exscan_intra_composition_alpha; - else { - fprintf(stderr, "unrecognized key %s\n", ckey); - MPIR_Assert(0); - } - - MPL_free(ckey); - } - - return (void *) cnt; -} - static int choose_netmod(void); static int choose_netmod(void) @@ -561,25 +475,27 @@ int MPID_Init(int requested, int *provided) /* Initialize collective selection */ if (!strcmp(MPIR_CVAR_CH4_COLL_SELECTION_TUNING_JSON_FILE, "")) { mpi_errno = MPIR_Csel_create_from_buf(MPIDI_coll_generic_json, - create_container, &MPIDI_global.csel_root); + MPII_Create_container, &MPIDI_global.csel_root); MPIDI_global.csel_source = "MPIDI_coll_generic_json"; } else { mpi_errno = MPIR_Csel_create_from_file(MPIR_CVAR_CH4_COLL_SELECTION_TUNING_JSON_FILE, - create_container, &MPIDI_global.csel_root); + MPII_Create_container, &MPIDI_global.csel_root); MPIDI_global.csel_source = MPIR_CVAR_CH4_COLL_SELECTION_TUNING_JSON_FILE; } + MPIR_Csel_debug_summary(MPIDI_global.csel_source, MPIDI_global.csel_root); MPIR_ERR_CHECK(mpi_errno); /* Initialize collective selection for gpu */ if (!strcmp(MPIR_CVAR_CH4_COLL_SELECTION_TUNING_JSON_FILE_GPU, "")) { mpi_errno = MPIR_Csel_create_from_buf(MPIDI_coll_generic_json, - create_container, &MPIDI_global.csel_root_gpu); + MPII_Create_container, &MPIDI_global.csel_root_gpu); MPIDI_global.csel_source_gpu = "MPIDI_coll_generic_json"; } else { mpi_errno = MPIR_Csel_create_from_file(MPIR_CVAR_CH4_COLL_SELECTION_TUNING_JSON_FILE_GPU, - create_container, &MPIDI_global.csel_root_gpu); + MPII_Create_container, &MPIDI_global.csel_root_gpu); MPIDI_global.csel_source_gpu = MPIR_CVAR_CH4_COLL_SELECTION_TUNING_JSON_FILE_GPU; } + MPIR_Csel_debug_summary(MPIDI_global.csel_source_gpu, MPIDI_global.csel_root_gpu); MPIR_ERR_CHECK(mpi_errno); /* Override split_type */