|
| 1 | +/* |
| 2 | + * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana |
| 3 | + * University Research and Technology |
| 4 | + * Corporation. All rights reserved. |
| 5 | + * Copyright (c) 2004-2006 The University of Tennessee and The University |
| 6 | + * of Tennessee Research Foundation. All rights |
| 7 | + * reserved. |
| 8 | + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, |
| 9 | + * University of Stuttgart. All rights reserved. |
| 10 | + * Copyright (c) 2004-2005 The Regents of the University of California. |
| 11 | + * All rights reserved. |
| 12 | + * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. |
| 13 | + * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. |
| 14 | + * Copyright (c) 2010-2012 Los Alamos National Security, LLC. |
| 15 | + * All rights reserved. |
| 16 | + * $COPYRIGHT$ |
| 17 | + * |
| 18 | + * Additional copyrights may follow |
| 19 | + * |
| 20 | + * $HEADER$ |
| 21 | + */ |
| 22 | +/** |
| 23 | + * @file |
| 24 | + */ |
| 25 | +#ifndef MCA_MPOOL_MEMKIND_H |
| 26 | +#define MCA_MPOOL_MEMKIND_H |
| 27 | + |
| 28 | +#include "opal_config.h" |
| 29 | + |
| 30 | +#include "opal/mca/event/event.h" |
| 31 | +#include "opal/mca/mpool/mpool.h" |
| 32 | + |
| 33 | +#include "opal/mca/allocator/allocator.h" |
| 34 | +#include "memkind.h" |
| 35 | + |
| 36 | +BEGIN_C_DECLS |
| 37 | + |
| 38 | +struct mca_mpool_base_resources_t { |
| 39 | + char *pool_name; |
| 40 | + void *reg_data; |
| 41 | + size_t size; |
| 42 | +}; |
| 43 | +static const int mca_mpool_memkind_default_pagesize = 4096; |
| 44 | + |
| 45 | + |
| 46 | +typedef struct mca_mpool_base_resources_t mca_mpool_base_resources_t; |
| 47 | + |
| 48 | +struct mca_mpool_memkind_module_t { |
| 49 | + mca_mpool_base_module_t super; |
| 50 | + size_t alloc_size; |
| 51 | + struct mca_mpool_base_resources_t resources; |
| 52 | +}; |
| 53 | +typedef struct mca_mpool_memkind_module_t mca_mpool_memkind_module_t; |
| 54 | + |
| 55 | +struct mca_mpool_memkind_component_t { |
| 56 | + mca_mpool_base_component_t super; |
| 57 | + int hbw; |
| 58 | + int pagesize; |
| 59 | + int bind; |
| 60 | + memkind_t kind; |
| 61 | + char *memkind_name; |
| 62 | + char *memkind_file; |
| 63 | + int verbose; |
| 64 | +}; |
| 65 | +typedef struct mca_mpool_memkind_component_t mca_mpool_memkind_component_t; |
| 66 | +OPAL_MODULE_DECLSPEC extern mca_mpool_memkind_component_t mca_mpool_memkind_component; |
| 67 | + |
| 68 | +/* |
| 69 | + * Initializes the mpool module. |
| 70 | +*/ |
| 71 | + |
| 72 | +void mca_mpool_memkind_module_init(mca_mpool_memkind_module_t *mpool); |
| 73 | + |
| 74 | +/** |
| 75 | + * Allocate block of high bandwidth memory. |
| 76 | + */ |
| 77 | +void* mca_mpool_memkind_alloc( |
| 78 | + mca_mpool_base_module_t* mpool, |
| 79 | + size_t size, |
| 80 | + size_t align, |
| 81 | + uint32_t flags, |
| 82 | + mca_mpool_base_registration_t** registration); |
| 83 | + |
| 84 | +/** |
| 85 | + * realloc function typedef |
| 86 | + */ |
| 87 | +void* mca_mpool_memkind_realloc( |
| 88 | + mca_mpool_base_module_t* mpool, |
| 89 | + void* addr, |
| 90 | + size_t size, |
| 91 | + mca_mpool_base_registration_t** registration); |
| 92 | + |
| 93 | +/** |
| 94 | + * free function typedef |
| 95 | + */ |
| 96 | +void mca_mpool_memkind_free( |
| 97 | + mca_mpool_base_module_t* mpool, |
| 98 | + void * addr, |
| 99 | + mca_mpool_base_registration_t* registration); |
| 100 | + |
| 101 | +END_C_DECLS |
| 102 | + |
| 103 | +#endif |
0 commit comments