root/ompi/mpi/c/init_thread.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. MPI_Init_thread

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2018 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2010      Oak Ridge National Labs.  All rights reserved.
  14  * Copyright (c) 2015      Research Organization for Information Science
  15  *                         and Technology (RIST). All rights reserved.
  16  * Copyright (c) 2015-2018 Cisco Systems, Inc.  All rights reserved
  17  * Copyright (c) 2016      Los Alamos National Security, LLC. All rights
  18  *                         reserved.
  19  * $COPYRIGHT$
  20  *
  21  * Additional copyrights may follow
  22  *
  23  * $HEADER$
  24  */
  25 
  26 #include "ompi_config.h"
  27 
  28 #include "opal/util/show_help.h"
  29 #include "ompi/runtime/ompi_spc.h"
  30 #include "ompi/mpi/c/bindings.h"
  31 #include "ompi/runtime/params.h"
  32 #include "ompi/communicator/communicator.h"
  33 #include "ompi/errhandler/errhandler.h"
  34 #include "ompi/constants.h"
  35 #include "ompi/mca/hook/base/base.h"
  36 
  37 #if OMPI_BUILD_MPI_PROFILING
  38 #if OPAL_HAVE_WEAK_SYMBOLS
  39 #pragma weak MPI_Init_thread = PMPI_Init_thread
  40 #endif
  41 #define MPI_Init_thread PMPI_Init_thread
  42 #endif
  43 
  44 static const char FUNC_NAME[] = "MPI_Init_thread";
  45 
  46 
  47 int MPI_Init_thread(int *argc, char ***argv, int required,
  48                     int *provided)
  49 {
  50     int err;
  51 
  52     ompi_hook_base_mpi_init_thread_top(argc, argv, required, provided);
  53 
  54     if ( MPI_PARAM_CHECK ) {
  55         if (required < MPI_THREAD_SINGLE || required > MPI_THREAD_MULTIPLE) {
  56             ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, FUNC_NAME);
  57         }
  58     }
  59 
  60     *provided = required;
  61 
  62     /* Call the back-end initialization function (we need to put as
  63        little in this function as possible so that if it's profiled, we
  64        don't lose anything) */
  65 
  66     if (NULL != argc && NULL != argv) {
  67         err = ompi_mpi_init(*argc, *argv, required, provided, false);
  68     } else {
  69         err = ompi_mpi_init(0, NULL, required, provided, false);
  70     }
  71 
  72     /* Since we don't have a communicator to invoke an errorhandler on
  73        here, don't use the fancy-schmancy ERRHANDLER macros; they're
  74        really designed for real communicator objects.  Just use the
  75        back-end function directly. */
  76 
  77     if (MPI_SUCCESS != err) {
  78         return ompi_errhandler_invoke(NULL, NULL, OMPI_ERRHANDLER_TYPE_COMM,
  79                                       err < 0 ? ompi_errcode_get_mpi_code(err) :
  80                                       err, FUNC_NAME);
  81     }
  82 
  83     OPAL_CR_INIT_LIBRARY();
  84 
  85     SPC_INIT();
  86 
  87     ompi_hook_base_mpi_init_thread_bottom(argc, argv, required, provided);
  88 
  89     return MPI_SUCCESS;
  90 }

/* [<][>][^][v][top][bottom][index][help] */