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
|
/*
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "oshmem_config.h"
#include "opal/constants.h"
#include "oshmem/mca/sshmem/sshmem.h"
#include "oshmem/mca/sshmem/base/base.h"
int
mca_sshmem_segment_create(map_segment_t *ds_buf,
const char *file_name,
size_t size, long hint)
{
if (!mca_sshmem_base_selected) {
return OSHMEM_ERROR;
}
return mca_sshmem_base_module->segment_create(ds_buf, file_name, size, hint);
}
void *
mca_sshmem_segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey)
{
if (!mca_sshmem_base_selected) {
return NULL;
}
return mca_sshmem_base_module->segment_attach(ds_buf, mkey);
}
int
mca_sshmem_segment_detach(map_segment_t *ds_buf, sshmem_mkey_t *mkey)
{
if (!mca_sshmem_base_selected) {
return OSHMEM_ERROR;
}
return mca_sshmem_base_module->segment_detach(ds_buf, mkey);
}
int
mca_sshmem_unlink(map_segment_t *ds_buf)
{
if (!mca_sshmem_base_selected) {
return OSHMEM_ERROR;
}
return mca_sshmem_base_module->unlink(ds_buf);
}
char * oshmem_get_unique_file_name(uint64_t pe)
{
char *file_name = NULL;
assert(mca_sshmem_base_backing_file_dir);
if (NULL == (file_name = calloc(OPAL_PATH_MAX, sizeof(char)))) {
return NULL;
}
snprintf(file_name, OPAL_PATH_MAX, "%s/shmem_job_%u_pe_%llu", mca_sshmem_base_backing_file_dir, OMPI_PROC_MY_NAME->jobid, (unsigned long long)pe);
return file_name;
}
void
shmem_ds_reset(map_segment_t *ds_buf)
{
MAP_SEGMENT_RESET_FLAGS(ds_buf);
ds_buf->seg_id = MAP_SEGMENT_SHM_INVALID;
ds_buf->super.va_base = 0;
ds_buf->super.va_end = 0;
ds_buf->seg_size = 0;
ds_buf->type = MAP_SEGMENT_UNKNOWN;
ds_buf->mkeys_cache = NULL;
ds_buf->mkeys = NULL;
ds_buf->alloc_hints = 0;
ds_buf->allocator = NULL;
}
|