File: sshmem_base_open.c

package info (click to toggle)
openmpi 5.0.8-3
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,692 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (100 lines) | stat: -rw-r--r-- 3,479 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * Copyright (c) 2014      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "oshmem_config.h"

#include "opal/constants.h"
#include "opal/util/output.h"
#include "oshmem/mca/mca.h"
#include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_var.h"

#include "oshmem/util/oshmem_util.h"
#include "oshmem/mca/sshmem/sshmem.h"
#include "oshmem/mca/sshmem/base/base.h"

/*
 * The following file was created by configure.  It contains extern
 * statements and the definition of an array of pointers to each
 * component's public mca_base_component_t struct.
 */
#include "oshmem/mca/sshmem/base/static-components.h"

/**
 * globals
 */

void *mca_sshmem_base_start_address = (void *)UINTPTR_MAX;

char * mca_sshmem_base_backing_file_dir = NULL;

/* ////////////////////////////////////////////////////////////////////////// */
/**
 * Register some sshmem-wide MCA params
 */
static int
mca_sshmem_base_register (mca_base_register_flag_t flags)
{
    int index;

    index = mca_base_var_register("oshmem",
                                 "sshmem",
                                 "base",
                                 "start_address",
                                 "Specify base address for shared memory region",
                                 MCA_BASE_VAR_TYPE_UNSIGNED_LONG,
                                 NULL,
                                 0,
                                 MCA_BASE_VAR_FLAG_SETTABLE,
                                 OPAL_INFO_LVL_9,
                                 MCA_BASE_VAR_SCOPE_READONLY,
                                 &mca_sshmem_base_start_address);
    (void) mca_base_var_register_synonym(index, "oshmem", "memheap", "base",
                                         "start_address",
                                         MCA_BASE_VAR_SYN_FLAG_DEPRECATED);

    mca_sshmem_base_backing_file_dir = "/dev/shm";
    index = mca_base_var_register("oshmem",
                                 "sshmem",
                                 "base",
                                 "backing_file_dir",
                                 "Specifies where backing files will be created when "
                                 "mmap is used and shmem_mmap_anonymous set to 0.",
                                 MCA_BASE_VAR_TYPE_STRING,
                                 NULL,
                                 0,
                                 MCA_BASE_VAR_FLAG_SETTABLE,
                                 OPAL_INFO_LVL_9,
                                 MCA_BASE_VAR_SCOPE_READONLY,
                                 &mca_sshmem_base_backing_file_dir);
    return OSHMEM_SUCCESS;
}

static int mca_sshmem_base_open(mca_base_open_flag_t flags)
{
    oshmem_framework_open_output(&oshmem_sshmem_base_framework);

    /* Open up all available components */
    if (OPAL_SUCCESS !=
        mca_base_framework_components_open(&oshmem_sshmem_base_framework, flags)) {
        return OSHMEM_ERROR;
    }

    return OSHMEM_SUCCESS;
}

/* Use the default open function */
MCA_BASE_FRAMEWORK_DECLARE(oshmem, sshmem,
                           "OSHMEM SSHMEM",
                           mca_sshmem_base_register,
                           mca_sshmem_base_open,
                           mca_sshmem_base_close,
                           mca_sshmem_base_static_components,
                           MCA_BASE_FRAMEWORK_FLAG_DEFAULT);