coll_tuned_module.c

来自「MPI stands for the Message Passing Inter」· C语言 代码 · 共 546 行 · 第 1/2 页

C
546
字号
/* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana *                         University Research and Technology *                         Corporation.  All rights reserved. * Copyright (c) 2004-2006 The University of Tennessee and The University *                         of Tennessee Research Foundation.  All rights *                         reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,  *                         University of Stuttgart.  All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. *                         All rights reserved. * $COPYRIGHT$ *  * Additional copyrights may follow *  * $HEADER$ */#include "ompi_config.h"#include "coll_tuned.h"#include <stdio.h>#include "mpi.h"#include "ompi/communicator/communicator.h"#include "opal/mca/base/mca_base_param.h"#include "ompi/mca/coll/coll.h"#include "ompi/mca/coll/base/base.h"#include "coll_tuned.h"#include "coll_tuned_topo.h"#include "coll_tuned_dynamic_rules.h"#include "coll_tuned_dynamic_file.h"#include "coll_tuned_forced.h"/* * Which set are we using? */static const mca_coll_base_module_1_0_0_t *to_use = NULL;/* * Intra communicator decision functions *  * Two prototypes, one for fixed rules and one for dynamic rules * */static const mca_coll_base_module_1_0_0_t intra_fixed = {    /* Initialization / finalization functions */    ompi_coll_tuned_module_init,    ompi_coll_tuned_module_finalize,    /* Collective function pointers */    ompi_coll_tuned_allgather_intra_dec_fixed,    /*     NULL, */    /*   ompi_coll_tuned_allgatherv_intra_dec_fixed, */    NULL,    ompi_coll_tuned_allreduce_intra_dec_fixed,    /*     NULL, */    ompi_coll_tuned_alltoall_intra_dec_fixed,    /*     NULL, */    /*   ompi_coll_tuned_alltoallv_intra_dec_fixed, */    NULL,    /*   ompi_coll_tuned_alltoallw_intra_dec_fixed, */    NULL,    ompi_coll_tuned_barrier_intra_dec_fixed,    /*     NULL, */    ompi_coll_tuned_bcast_intra_dec_fixed,    /*     NULL, */    /*   ompi_coll_tuned_exscan_intra_dec_fixed, */    NULL,    /*   ompi_coll_tuned_gather_intra_dec_fixed, */    NULL,    /*   ompi_coll_tuned_gatherv_intra_dec_fixed, */    NULL,    ompi_coll_tuned_reduce_intra_dec_fixed,    /*     NULL, */    /*   ompi_coll_tuned_reduce_scatter_intra_dec_fixed, */    NULL,    /*   ompi_coll_tuned_scan_intra_dec_fixed, */    NULL,    /*   ompi_coll_tuned_scatter_intra_dec_fixed, */    NULL,    /*   ompi_coll_tuned_scatterv_intra_dec_fixed */    NULL};static const mca_coll_base_module_1_0_0_t intra_dynamic = {    /* Initialization / finalization functions */    ompi_coll_tuned_module_init,    ompi_coll_tuned_module_finalize,    /* Collective function pointers */    ompi_coll_tuned_allgather_intra_dec_dynamic,    /*     NULL, */    /*   ompi_coll_tuned_allgatherv_intra_dec_dynamic, */    NULL,    ompi_coll_tuned_allreduce_intra_dec_dynamic,    /*     NULL, */    ompi_coll_tuned_alltoall_intra_dec_dynamic,    /*     NULL, */    /*   ompi_coll_tuned_alltoallv_intra_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_alltoallw_intra_dec_dynamic, */    NULL,    ompi_coll_tuned_barrier_intra_dec_dynamic,    /*     NULL, */    ompi_coll_tuned_bcast_intra_dec_dynamic,    /*     NULL, */    /*   ompi_coll_tuned_exscan_intra_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_gather_intra_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_gatherv_intra_dec_dynamic, */    NULL,    ompi_coll_tuned_reduce_intra_dec_dynamic,    /*     NULL, */    /*   ompi_coll_tuned_reduce_scatter_intra_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_scan_intra_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_scatter_intra_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_scatterv_intra_dec_dynamic */    NULL};/* * collective decision functions for intercommunicators *  * Two prototypes, one for fixed rules and one for dynamic rules * */static const mca_coll_base_module_1_0_0_t inter_fixed = {    /* Initialization / finalization functions */    ompi_coll_tuned_module_init,    ompi_coll_tuned_module_finalize,    /* Collective function pointers */    /*     ompi_coll_tuned_allgather_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_allgatherv_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_allreduce_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_alltoall_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_alltoallv_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_alltoallw_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_barrier_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_bcast_inter_dec_fixed, */    NULL,    /* ompi_coll_tuned_exscan_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_gather_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_gatherv_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_reduce_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_reduce_scatter_inter_dec_fixed, */    NULL,    /* ompi_coll_tuned_scan_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_scatter_inter_dec_fixed, */    NULL,    /*   ompi_coll_tuned_scatterv_inter_dec_fixed */    NULL};static const mca_coll_base_module_1_0_0_t inter_dynamic = {    /* Initialization / finalization functions */    ompi_coll_tuned_module_init,    ompi_coll_tuned_module_finalize,    /* Collective function pointers */    /*   ompi_coll_tuned_allgather_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_allgatherv_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_allreduce_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_alltoall_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_alltoallv_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_alltoallw_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_barrier_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_bcast_inter_dec_dynamic, */    NULL,    /* ompi_coll_tuned_exscan_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_gather_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_gatherv_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_reduce_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_reduce_scatter_inter_dec_dynamic, */    NULL,    /* ompi_coll_tuned_scan_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_scatter_inter_dec_dynamic, */    NULL,    /*   ompi_coll_tuned_scatterv_inter_dec_dynamic */    NULL};/*  * Note I keep the names here as place markers until all the functions * are implemented *//* * Initial query function that is invoked during MPI_INIT, allowing * this component to disqualify itself if it doesn't support the * required level of thread support. */int ompi_coll_tuned_init_query(bool enable_progress_threads,                               bool enable_mpi_threads){    /* Nothing to do */      return OMPI_SUCCESS;}/* * Invoked when there's a new communicator that has been created. * Look at the communicator and decide which set of functions and * priority we want to return. */const mca_coll_base_module_1_0_0_t *ompi_coll_tuned_comm_query(struct ompi_communicator_t *comm, int *priority,                           struct mca_coll_base_comm_t **data){    OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:module_tuned query called"));    *priority = ompi_coll_tuned_priority;    /*      * Choose whether to use [intra|inter] decision functions      * and if using fixed OR dynamic rule sets.     * Right now you cannot mix them, maybe later on it can be changed     * but this would probably add an extra if and funct call to the path     */    if (OMPI_COMM_IS_INTER(comm)) {        if (ompi_coll_tuned_use_dynamic_rules) {            OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:module_query using inter_dynamic"));            to_use = &inter_dynamic;        } else {            OPAL_OUTPUT((ompi_coll_tuned_stream,"coll:tuned:module_query using inter_fixed"));            to_use = &inter_fixed;        }    } else { /* is an intra comm */        /**

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?