root/ompi/mpi/tool/init_thread.c

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

DEFINITIONS

This source file includes following definitions.
  1. MPI_T_init_thread

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
   4  *                         reserved.
   5  * Copyright (c) 2014 Cisco Systems, Inc.  All rights reserved.
   6  * Copyright (c) 2017      IBM Corporation. All rights reserved.
   7  * $COPYRIGHT$
   8  *
   9  * Additional copyrights may follow
  10  *
  11  * $HEADER$
  12  */
  13 
  14 #include "ompi/mpi/tool/mpit-internal.h"
  15 
  16 #include "ompi/runtime/ompi_info_support.h"
  17 #include "opal/include/opal/sys/atomic.h"
  18 #include "opal/runtime/opal.h"
  19 
  20 #if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
  21 #pragma weak MPI_T_init_thread = PMPI_T_init_thread
  22 #endif
  23 
  24 #if OMPI_PROFILING_DEFINES
  25 #include "ompi/mpi/tool/profile/defines.h"
  26 #endif
  27 
  28 extern opal_mutex_t ompi_mpit_big_lock;
  29 
  30 extern volatile uint32_t ompi_mpit_init_count;
  31 extern volatile int32_t initted;
  32 
  33 
  34 int MPI_T_init_thread (int required, int *provided)
  35 {
  36     int rc = MPI_SUCCESS;
  37 
  38     ompi_mpit_lock ();
  39 
  40     do {
  41         if (0 != ompi_mpit_init_count++) {
  42             break;
  43         }
  44 
  45         /* call opal_init_util to intialize the MCA system */
  46         rc = opal_init_util (NULL, NULL);
  47         if (OPAL_SUCCESS != rc) {
  48             rc = MPI_ERR_OTHER;
  49             break;
  50         }
  51 
  52         /* register all parameters */
  53         rc = ompi_info_register_framework_params (NULL);
  54         if (OMPI_SUCCESS != rc) {
  55             rc = MPI_ERR_OTHER;
  56             break;
  57         }
  58 
  59         /* determine the thread level. TODO -- this might
  60            be wrong */
  61         ompi_mpi_thread_level (required, provided);
  62     } while (0);
  63 
  64     ompi_mpit_unlock ();
  65 
  66     return rc;
  67 }

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