ff384daab4
This commit was SVN r28048.
92 строки
2.2 KiB
C
92 строки
2.2 KiB
C
/*
|
|
* Copyright (c) 2012 Mellanox Technologies, Inc.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
#include "oshmem_config.h"
|
|
|
|
#include "oshmem/constants.h"
|
|
#include "oshmem/include/shmem.h"
|
|
|
|
#include "oshmem/runtime/runtime.h"
|
|
|
|
#include "oshmem/mca/scoll/scoll.h"
|
|
#include "oshmem/mca/scoll/base/base.h"
|
|
|
|
#include "oshmem/proc/proc.h"
|
|
#include "oshmem/proc/proc_group_cache.h"
|
|
|
|
|
|
void shmem_barrier( int PE_start,
|
|
int logPE_stride,
|
|
int PE_size,
|
|
long *pSync )
|
|
{
|
|
int rc = OSHMEM_SUCCESS;
|
|
oshmem_group_t* group = NULL;
|
|
|
|
RUNTIME_CHECK_INIT();
|
|
|
|
#if OSHMEM_SPEC_COMPAT == 1
|
|
/* all outstanding puts must be completed */
|
|
shmem_fence();
|
|
#endif
|
|
|
|
if ((0 <= PE_start) && (0 <= logPE_stride))
|
|
{
|
|
/* Create group basing PE_start, logPE_stride and PE_size */
|
|
#if OSHMEM_GROUP_CACHE_ENABLED == 0
|
|
group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size);
|
|
if (!group)
|
|
rc = OSHMEM_ERROR;
|
|
#else
|
|
group = find_group_in_cache(PE_start,logPE_stride,PE_size);
|
|
if (!group)
|
|
{
|
|
group = oshmem_proc_group_create(PE_start, (1 << logPE_stride), PE_size);
|
|
if (!group)
|
|
{
|
|
rc = OSHMEM_ERROR;
|
|
}
|
|
else
|
|
{
|
|
cache_group(group,PE_start,logPE_stride,PE_size);
|
|
}
|
|
}
|
|
#endif /* OSHMEM_GROUP_CACHE_ENABLED */
|
|
/* Collective operation call */
|
|
if ( rc == OSHMEM_SUCCESS )
|
|
{
|
|
/* Call barrier operation */
|
|
rc = group->g_scoll.scoll_barrier( group, pSync, SCOLL_DEFAULT_ALG );
|
|
}
|
|
|
|
#if OSHMEM_GROUP_CACHE_ENABLED == 0
|
|
if ( rc == OSHMEM_SUCCESS )
|
|
{
|
|
oshmem_proc_group_destroy(group);
|
|
}
|
|
#endif /* OSHMEM_GROUP_CACHE_ENABLED */
|
|
}
|
|
}
|
|
|
|
|
|
void shmem_barrier_all(void)
|
|
{
|
|
int rc = OSHMEM_SUCCESS;
|
|
|
|
#if OSHMEM_SPEC_COMPAT == 1
|
|
/* all outstanding puts must be completed */
|
|
shmem_fence();
|
|
#endif
|
|
|
|
if (mca_scoll_sync_array)
|
|
{
|
|
rc = oshmem_group_all->g_scoll.scoll_barrier(oshmem_group_all, mca_scoll_sync_array, SCOLL_DEFAULT_ALG);
|
|
}
|
|
}
|