first steps to realize a Lubachevsky barrier with flag
This commit is contained in:
parent
198c1dcebd
commit
4c61e37fca
1 changed files with 25 additions and 0 deletions
|
@ -37,8 +37,19 @@
|
|||
#define SHARED_PAGES ((4*RCCE_SHM_SIZE_MAX) >> PAGE_SHIFT)
|
||||
#define OWNER_SIZE ((SHARED_PAGES * sizeof(uint8_t) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
|
||||
|
||||
#define AIREG1 0
|
||||
#define AIREG2 (AIREG1 + 1)
|
||||
|
||||
t_vcharp RC_SHM_BUFFER_START();
|
||||
|
||||
typedef struct {
|
||||
int counter;
|
||||
int initializer;
|
||||
} atomic_increg_t;
|
||||
|
||||
static volatile atomic_increg_t *incregs = NULL;
|
||||
static RCCE_FLAG release;
|
||||
|
||||
/*
|
||||
* This array describes the owner of a specific page.
|
||||
* Only the owner of a page is able to change the possession.
|
||||
|
@ -343,12 +354,26 @@ void svm_flush(void)
|
|||
|
||||
int svm_barrier(uint32_t type)
|
||||
{
|
||||
int i;
|
||||
RCCE_COMM *comm = &RCCE_COMM_WORLD;
|
||||
static int index = 0;
|
||||
|
||||
if (type == SVM_LAZYRELEASE) {
|
||||
svm_flush();
|
||||
svm_invalidate();
|
||||
}
|
||||
|
||||
#if 0
|
||||
index = !index;
|
||||
if (incregs[AIREG1].counter > (comm->size - 2)) {
|
||||
incregs[AIREG1].initializer = 0;
|
||||
while(incregs[AIREG1].initializer);
|
||||
for (i = 0; i < comm->size; i++)
|
||||
RCCE_flag_write(&release, index, comm->member[i]);
|
||||
} else RCCE_wait_until(release, index);
|
||||
#else
|
||||
RCCE_barrier(&RCCE_COMM_WORLD);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue