2013-09-10 15:34:09 +00:00
|
|
|
/*
|
2015-11-17 11:21:05 +02:00
|
|
|
* Copyright (c) 2013-2015 Mellanox Technologies, Inc.
|
2013-09-10 15:34:09 +00:00
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2013-09-10 15:34:09 +00:00
|
|
|
* Additional copyrights may follow
|
2015-06-23 20:59:57 -07:00
|
|
|
*
|
2013-09-10 15:34:09 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
#include "oshmem_config.h"
|
|
|
|
|
|
|
|
#include "oshmem/constants.h"
|
|
|
|
#include "oshmem/include/shmem.h"
|
|
|
|
|
|
|
|
#include "oshmem/shmem/shmem_api_logger.h"
|
|
|
|
|
|
|
|
#include "oshmem/runtime/runtime.h"
|
|
|
|
|
|
|
|
#include "oshmem/mca/memheap/memheap.h"
|
|
|
|
|
2014-04-07 22:55:21 +00:00
|
|
|
#if OSHMEM_PROFILING
|
2014-04-14 20:51:06 +00:00
|
|
|
#include "oshmem/include/pshmem.h"
|
2015-11-17 11:21:05 +02:00
|
|
|
#pragma weak shmem_free = pshmem_free
|
2014-04-07 22:55:21 +00:00
|
|
|
#pragma weak shfree = pshfree
|
|
|
|
#include "oshmem/shmem/c/profile/defines.h"
|
|
|
|
#endif
|
|
|
|
|
2015-11-17 11:21:05 +02:00
|
|
|
static inline void _shfree(void* ptr);
|
|
|
|
|
|
|
|
void shmem_free(void* ptr)
|
|
|
|
{
|
|
|
|
_shfree(ptr);
|
|
|
|
}
|
|
|
|
|
2013-09-10 15:34:09 +00:00
|
|
|
void shfree(void* ptr)
|
2015-11-17 11:21:05 +02:00
|
|
|
{
|
|
|
|
_shfree(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void _shfree(void* ptr)
|
2013-09-10 15:34:09 +00:00
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
RUNTIME_CHECK_INIT(); RUNTIME_CHECK_ADDR(ptr);
|
|
|
|
|
|
|
|
#if OSHMEM_SPEC_COMPAT == 1
|
|
|
|
shmem_barrier_all();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
rc = MCA_MEMHEAP_CALL(free(ptr));
|
|
|
|
if (OSHMEM_SUCCESS != rc) {
|
|
|
|
SHMEM_API_VERBOSE(10, "shfree failure.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|