File: memheap_ptmalloc_component.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 (68 lines) | stat: -rw-r--r-- 2,066 bytes parent folder | download | duplicates (5)
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
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */
#include "oshmem_config.h"
#include "opal/util/output.h"
#include "oshmem/mca/memheap/memheap.h"
#include "oshmem/mca/memheap/base/base.h"
#include "oshmem/mca/memheap/ptmalloc/memheap_ptmalloc.h"
#include "memheap_ptmalloc_component.h"

static int mca_memheap_ptmalloc_component_close(void);
static int mca_memheap_ptmalloc_component_query(mca_base_module_t **module, 
                                                int *priority);

static int _basic_open(void);

mca_memheap_base_component_t mca_memheap_ptmalloc_component = {
    .memheap_version = {
        MCA_MEMHEAP_BASE_VERSION_2_0_0,

        .mca_component_name= "ptmalloc",
        MCA_BASE_MAKE_VERSION(component, OSHMEM_MAJOR_VERSION, OSHMEM_MINOR_VERSION,
                              OSHMEM_RELEASE_VERSION),

        .mca_open_component = _basic_open,
        .mca_close_component = mca_memheap_ptmalloc_component_close,
        .mca_query_component = mca_memheap_ptmalloc_component_query,
    },
    .memheap_data = {
        /* The component is checkpoint ready */
        MCA_BASE_METADATA_PARAM_CHECKPOINT
    },
    .memheap_init = mca_memheap_ptmalloc_module_init,
};

/* Open component */
static int _basic_open(void)
{
    return OSHMEM_SUCCESS;
}

/* query component */
static int
mca_memheap_ptmalloc_component_query(mca_base_module_t **module, int *priority)
{
    *priority = memheap_ptmalloc.priority;
    *module = (mca_base_module_t *)&memheap_ptmalloc.super;
    return OSHMEM_SUCCESS;
}

/*
 * This function is automatically called from mca_base_components_close.
 * It releases the component's allocated memory.
 */
int mca_memheap_ptmalloc_component_close()
{
    mca_memheap_ptmalloc_finalize();
    return OSHMEM_SUCCESS;
}