root/oshmem/mca/sshmem/base/sshmem_base_open.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_sshmem_base_register
  2. mca_sshmem_base_open

   1 /*
   2  * Copyright (c) 2014      Mellanox Technologies, Inc.
   3  *                         All rights reserved.
   4  * $COPYRIGHT$
   5  *
   6  * Additional copyrights may follow
   7  *
   8  * $HEADER$
   9  */
  10 
  11 #include "oshmem_config.h"
  12 
  13 #include "opal/constants.h"
  14 #include "opal/util/output.h"
  15 #include "oshmem/mca/mca.h"
  16 #include "opal/mca/base/base.h"
  17 #include "opal/mca/base/mca_base_var.h"
  18 
  19 #include "oshmem/util/oshmem_util.h"
  20 #include "oshmem/mca/sshmem/sshmem.h"
  21 #include "oshmem/mca/sshmem/base/base.h"
  22 
  23 /*
  24  * The following file was created by configure.  It contains extern
  25  * statements and the definition of an array of pointers to each
  26  * component's public mca_base_component_t struct.
  27  */
  28 #include "oshmem/mca/sshmem/base/static-components.h"
  29 
  30 /**
  31  * globals
  32  */
  33 
  34 /**
  35  * if 32 bit we set sshmem_base_start_adress to 0
  36  * to let OS allocate segment automatically
  37  */
  38 #if UINTPTR_MAX == 0xFFFFFFFF
  39 void *mca_sshmem_base_start_address = (void*)0;
  40 #else
  41 void* mca_sshmem_base_start_address = (void*)0xFF000000;
  42 #endif
  43 
  44 char * mca_sshmem_base_backing_file_dir = NULL;
  45 
  46 /* ////////////////////////////////////////////////////////////////////////// */
  47 /**
  48  * Register some sshmem-wide MCA params
  49  */
  50 static int
  51 mca_sshmem_base_register (mca_base_register_flag_t flags)
  52 {
  53     int index;
  54 
  55     index = mca_base_var_register("oshmem",
  56                                  "sshmem",
  57                                  "base",
  58                                  "start_address",
  59                                  "Specify base address for shared memory region",
  60                                  MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG,
  61                                  NULL,
  62                                  0,
  63                                  MCA_BASE_VAR_FLAG_SETTABLE,
  64                                  OPAL_INFO_LVL_9,
  65                                  MCA_BASE_VAR_SCOPE_READONLY,
  66                                  &mca_sshmem_base_start_address);
  67     (void) mca_base_var_register_synonym(index, "oshmem", "memheap", "base",
  68                                          "start_address",
  69                                          MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
  70 
  71     mca_sshmem_base_backing_file_dir = "/dev/shm";
  72     index = mca_base_var_register("oshmem",
  73                                  "sshmem",
  74                                  "base",
  75                                  "backing_file_dir",
  76                                  "Specifies where backing files will be created when "
  77                                  "mmap is used and shmem_mmap_anonymous set to 0.",
  78                                  MCA_BASE_VAR_TYPE_STRING,
  79                                  NULL,
  80                                  0,
  81                                  MCA_BASE_VAR_FLAG_SETTABLE,
  82                                  OPAL_INFO_LVL_9,
  83                                  MCA_BASE_VAR_SCOPE_READONLY,
  84                                  &mca_sshmem_base_backing_file_dir);
  85     return OSHMEM_SUCCESS;
  86 }
  87 
  88 static int mca_sshmem_base_open(mca_base_open_flag_t flags)
  89 {
  90     oshmem_framework_open_output(&oshmem_sshmem_base_framework);
  91 
  92     /* Open up all available components */
  93     if (OPAL_SUCCESS !=
  94         mca_base_framework_components_open(&oshmem_sshmem_base_framework, flags)) {
  95         return OSHMEM_ERROR;
  96     }
  97 
  98     return OSHMEM_SUCCESS;
  99 }
 100 
 101 /* Use the default open function */
 102 MCA_BASE_FRAMEWORK_DECLARE(oshmem, sshmem,
 103                            "OSHMEM SSHMEM",
 104                            mca_sshmem_base_register,
 105                            mca_sshmem_base_open,
 106                            mca_sshmem_base_close,
 107                            mca_sshmem_base_static_components,
 108                            MCA_BASE_FRAMEWORK_FLAG_DEFAULT);

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