This source file includes following definitions.
- shmem_init
- shmem_init_thread
- start_pes
- shmem_onexit
- _shmem_init
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 #include "oshmem_config.h"
  14 
  15 #include <stdlib.h>
  16 
  17 #include "opal/runtime/opal_cr.h"
  18 #include "opal/util/output.h"
  19 
  20 #include "oshmem/constants.h"
  21 #include "oshmem/include/shmem.h"
  22 #include "oshmem/runtime/params.h"
  23 #include "oshmem/runtime/runtime.h"
  24 #include "oshmem/shmem/shmem_api_logger.h"
  25 
  26 #if OSHMEM_PROFILING
  27 #include "oshmem/include/pshmem.h"
  28 #pragma weak shmem_init = pshmem_init
  29 #pragma weak shmem_init_thread = pshmem_init_thread
  30 #pragma weak start_pes = pstart_pes
  31 #include "oshmem/shmem/c/profile/defines.h"
  32 #endif
  33 
  34 extern int oshmem_shmem_globalexit_status;
  35 
  36 static inline void _shmem_init(int required, int *provided);
  37 
  38 void shmem_init(void)
  39 {
  40     int provided;
  41     
  42     _shmem_init(SHMEM_THREAD_SINGLE, &provided);
  43 }
  44 
  45 int shmem_init_thread(int requested, int *provided)
  46 {
  47     _shmem_init(requested, provided);
  48     return 0;
  49 }
  50 
  51 void start_pes(int npes)
  52 {
  53     int provided;
  54     
  55     _shmem_init(SHMEM_THREAD_SINGLE, &provided);
  56 }
  57 
  58 static void shmem_onexit(int exitcode, void *arg)
  59 {
  60     oshmem_shmem_globalexit_status = exitcode;
  61     shmem_finalize();
  62 }
  63 
  64 static inline void _shmem_init(int required, int *provided)
  65 {
  66     int err = OSHMEM_SUCCESS;
  67 
  68     if (oshmem_shmem_initialized) {
  69         
  70 
  71 
  72         return;
  73     }
  74 
  75     err = oshmem_shmem_init(0, NULL, required, provided);
  76     if (OSHMEM_SUCCESS != err) {
  77         
  78         SHMEM_API_ERROR("SHMEM failed to initialize - aborting");
  79         oshmem_shmem_abort(-1);
  80     }
  81 
  82     OPAL_CR_INIT_LIBRARY();
  83 #if HAVE_ON_EXIT
  84     on_exit(shmem_onexit, NULL);
  85 #endif
  86 }
  87