323e4418b9
- similar to opal/shmem - next step is some refactoring and merge into opal/shmem Developed by Igor, reviewed by AlexM, MikeD This commit fixes trac:4261. This commit was SVN r30855. The following Trac tickets were found above: Ticket 4261 --> https://svn.open-mpi.org/trac/ompi/ticket/4261
53 строки
1.3 KiB
C
53 строки
1.3 KiB
C
/*
|
|
* Copyright (c) 2013 Mellanox Technologies, Inc.
|
|
* All rights reserved.
|
|
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
|
|
* Copyright (c) 2014 Intel, Inc. All rights reserved
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
#include "oshmem/util/oshmem_util.h"
|
|
#include "oshmem/mca/sshmem/sshmem.h"
|
|
#include "oshmem/mca/sshmem/base/base.h"
|
|
#include "oshmem/mca/memheap/memheap.h"
|
|
#include "oshmem/mca/memheap/base/base.h"
|
|
|
|
|
|
int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size)
|
|
{
|
|
int ret = OSHMEM_SUCCESS;
|
|
|
|
assert(map);
|
|
assert(HEAP_SEG_INDEX == map->n_segments);
|
|
|
|
map_segment_t *s = &map->mem_segs[map->n_segments];
|
|
ret = mca_sshmem_segment_create(s, "", size);
|
|
|
|
if (OSHMEM_SUCCESS == ret) {
|
|
map->n_segments++;
|
|
MEMHEAP_VERBOSE(1,
|
|
"Memheap alloc memory: %llu byte(s), %d segments by method: %d",
|
|
(unsigned long long)size, map->n_segments, s->type);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
void mca_memheap_base_alloc_exit(mca_memheap_map_t *map)
|
|
{
|
|
if (map) {
|
|
map_segment_t *s = &map->mem_segs[HEAP_SEG_INDEX];
|
|
|
|
assert(s);
|
|
|
|
mca_sshmem_segment_detach(s, NULL);
|
|
mca_sshmem_unlink(s);
|
|
}
|
|
}
|