Commit bac25133 authored by Halim Amer's avatar Halim Amer
Browse files

Added tests to stream ACC-like RMA ops


Signed-off-by: default avatarMin Si <msi@il.is.s.u-tokyo.ac.jp>
Signed-off-by: Rob Latham's avatarRob Latham <robl@mcs.anl.gov>
parent 3efedf17
...@@ -537,6 +537,15 @@ ...@@ -537,6 +537,15 @@
/rma/putpscw1 /rma/putpscw1
/rma/wintest /rma/wintest
/rma/manyget /rma/manyget
/rma/lock_dt
/rma/lock_dt_flush
/rma/lock_dt_flushlocal
/rma/lockall_dt
/rma/lockall_dt_flush
/rma/lockall_dt_flushall
/rma/lockall_dt_flushlocal
/rma/lockall_dt_flushlocalall
/rma/lock_contention_dt
/spawn/namepub /spawn/namepub
/spawn/disconnect3 /spawn/disconnect3
/spawn/spaiccreate /spawn/spaiccreate
......
...@@ -25,6 +25,15 @@ noinst_PROGRAMS = \ ...@@ -25,6 +25,15 @@ noinst_PROGRAMS = \
lockcontention2 \ lockcontention2 \
lockcontention3 \ lockcontention3 \
lockopts \ lockopts \
lock_dt \
lock_dt_flush \
lock_dt_flushlocal \
lockall_dt \
lockall_dt_flush \
lockall_dt_flushall \
lockall_dt_flushlocal \
lockall_dt_flushlocalall\
lock_contention_dt \
contention_put \ contention_put \
contention_putget \ contention_putget \
put_base \ put_base \
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test lock contention while streaming ACC-like operations";
*/
int main(int argc, char *argv[])
{
int errs = 0;
int rank, size;
int target = 1;
int minsize = 2, count;
MPI_Comm comm;
MPI_Win win;
MPI_Aint lb, extent;
MTestDatatype sendtype, recvtype;
MTest_Init(&argc, &argv);
while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
if (comm == MPI_COMM_NULL)
continue;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &size);
MTEST_DATATYPE_FOR_EACH_COUNT(count) {
while (MTestGetDatatypes(&sendtype, &recvtype, count)) {
recvtype.printErrors = 1;
recvtype.InitBuf(&recvtype);
MPI_Type_get_extent(recvtype.datatype, &lb, &extent);
MPI_Win_create(recvtype.buf, lb + recvtype.count * extent,
(int) extent, MPI_INFO_NULL, comm, &win);
if (rank != target) {
sendtype.InitBuf(&sendtype);
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, target, 0, win);
MPI_Accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, target, 0,
recvtype.count, recvtype.datatype, MPI_REPLACE, win);
MPI_Win_unlock(target, win);
MPI_Barrier(comm);
char *resbuf = (char *) calloc(lb + extent * recvtype.count, sizeof(char));
/*wait for the destination to finish checking and reinitializing the buffer */
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, target, 0, win);
MPI_Get_accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, resbuf, recvtype.count, recvtype.datatype,
target, 0, recvtype.count, recvtype.datatype, MPI_REPLACE,
win);
MPI_Win_unlock(target, win);
MPI_Barrier(comm);
free(resbuf);
}
else { /* Target checks the result */
int err;
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
recvtype.InitBuf(&recvtype);
MPI_Win_unlock(rank, win);
/*signal the source that checking and reinitialization is done */
MPI_Barrier(comm);
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_EXCLUSIVE, rank, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
MPI_Win_unlock(rank, win);
}
MPI_Win_free(&win);
MTestFreeDatatype(&sendtype);
MTestFreeDatatype(&recvtype);
}
}
MTestFreeComm(&comm);
}
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test for streaming ACC-like operations with lock";
*/
int main(int argc, char *argv[])
{
int errs = 0;
int rank, size, source, dest;
int minsize = 2, count;
MPI_Comm comm;
MPI_Win win;
MPI_Aint lb, extent;
MTestDatatype sendtype, recvtype;
MTest_Init(&argc, &argv);
while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
if (comm == MPI_COMM_NULL)
continue;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &size);
source = 0;
dest = size - 1;
MTEST_DATATYPE_FOR_EACH_COUNT(count) {
while (MTestGetDatatypes(&sendtype, &recvtype, count)) {
recvtype.printErrors = 1;
/* Make sure that everyone has a recv buffer */
recvtype.InitBuf(&recvtype);
MPI_Type_get_extent(recvtype.datatype, &lb, &extent);
MPI_Win_create(recvtype.buf, lb + recvtype.count * extent,
(int) extent, MPI_INFO_NULL, comm, &win);
if (rank == source) {
sendtype.InitBuf(&sendtype);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
MPI_Accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, dest, 0,
recvtype.count, recvtype.datatype, MPI_REPLACE, win);
MPI_Win_unlock(dest, win);
MPI_Barrier(comm);
char *resbuf = (char *) calloc(lb + extent * recvtype.count, sizeof(char));
/*wait for the destination to finish checking and reinitializing the buffer */
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
MPI_Get_accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, resbuf, recvtype.count, recvtype.datatype,
dest, 0, recvtype.count, recvtype.datatype, MPI_REPLACE,
win);
MPI_Win_unlock(dest, win);
MPI_Barrier(comm);
free(resbuf);
}
else if (rank == dest) {
int err;
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
recvtype.InitBuf(&recvtype);
MPI_Win_unlock(dest, win);
/*signal the source that checking and reinitialization is done */
MPI_Barrier(comm);
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
MPI_Win_unlock(dest, win);
}
MPI_Win_free(&win);
MTestFreeDatatype(&sendtype);
MTestFreeDatatype(&recvtype);
}
}
MTestFreeComm(&comm);
}
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test for streaming ACC-like operations with lock+flush";
*/
int main(int argc, char *argv[])
{
int errs = 0;
int rank, size, source, dest;
int minsize = 2, count;
MPI_Comm comm;
MPI_Win win;
MPI_Aint lb, extent;
MTestDatatype sendtype, recvtype;
MTest_Init(&argc, &argv);
while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
if (comm == MPI_COMM_NULL)
continue;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &size);
source = 0;
dest = size - 1;
MTEST_DATATYPE_FOR_EACH_COUNT(count) {
while (MTestGetDatatypes(&sendtype, &recvtype, count)) {
recvtype.printErrors = 1;
recvtype.InitBuf(&recvtype);
MPI_Type_get_extent(recvtype.datatype, &lb, &extent);
MPI_Win_create(recvtype.buf, lb + recvtype.count * extent,
(int) extent, MPI_INFO_NULL, comm, &win);
if (rank == source) {
sendtype.InitBuf(&sendtype);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
MPI_Accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, dest, 0,
recvtype.count, recvtype.datatype, MPI_REPLACE, win);
MPI_Win_flush(dest, win);
/*signal to dest that the ops are flushed so that it starts checking the result */
MPI_Barrier(comm);
/*make sure dest finishes checking the result before issuing unlock */
MPI_Barrier(comm);
MPI_Win_unlock(dest, win);
char *resbuf = (char *) calloc(lb + extent * recvtype.count, sizeof(char));
/*wait for the destination to finish checking and reinitializing the buffer */
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
MPI_Get_accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, resbuf, recvtype.count, recvtype.datatype,
dest, 0, recvtype.count, recvtype.datatype, MPI_REPLACE,
win);
MPI_Win_flush(dest, win);
/*signal to dest that the ops are flushed so that it starts checking the result */
MPI_Barrier(comm);
/*make sure dest finishes checking the result before issuing unlock */
MPI_Barrier(comm);
MPI_Win_unlock(dest, win);
free(resbuf);
}
else if (rank == dest) {
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
int err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
recvtype.InitBuf(&recvtype);
MPI_Barrier(comm);
MPI_Win_unlock(dest, win);
/*signal the source that checking and reinitialization is done */
MPI_Barrier(comm);
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
MPI_Barrier(comm);
MPI_Win_unlock(dest, win);
}
MPI_Win_free(&win);
MTestFreeDatatype(&sendtype);
MTestFreeDatatype(&recvtype);
}
}
MTestFreeComm(&comm);
}
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test for streaming ACC-like operations with lock+flush_local";
*/
int main(int argc, char *argv[])
{
int errs = 0;
int rank, size, source, dest;
int minsize = 2, count;
MPI_Comm comm;
MPI_Win win;
MPI_Aint lb, extent;
MTestDatatype sendtype, recvtype;
MTest_Init(&argc, &argv);
while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
if (comm == MPI_COMM_NULL)
continue;
/* Determine the sender and receiver */
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &size);
source = 0;
dest = size - 1;
MTEST_DATATYPE_FOR_EACH_COUNT(count) {
while (MTestGetDatatypes(&sendtype, &recvtype, count)) {
recvtype.printErrors = 1;
recvtype.InitBuf(&recvtype);
MPI_Type_get_extent(recvtype.datatype, &lb, &extent);
MPI_Win_create(recvtype.buf, lb + recvtype.count * extent,
(int) extent, MPI_INFO_NULL, comm, &win);
if (rank == source) {
MPI_Aint slb, sextent;
MPI_Type_get_extent(sendtype.datatype, &slb, &sextent);
sendtype.InitBuf(&sendtype);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
MPI_Accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, dest, 0,
recvtype.count, recvtype.datatype, MPI_REPLACE, win);
MPI_Win_flush_local(dest, win);
/* reset the send buffer to test local completion */
memset(sendtype.buf, 0, slb + sextent * sendtype.count);
MPI_Win_unlock(dest, win);
MPI_Barrier(comm);
sendtype.InitBuf(&sendtype);
char *resbuf = (char *) calloc(lb + extent * recvtype.count, sizeof(char));
/*wait for the destination to finish checking and reinitializing the buffer */
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
MPI_Get_accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, resbuf, recvtype.count, recvtype.datatype,
dest, 0, recvtype.count, recvtype.datatype, MPI_REPLACE,
win);
MPI_Win_flush_local(dest, win);
/* reset the send buffer to test local completion */
memset(sendtype.buf, 0, slb + sextent * sendtype.count);
MPI_Win_unlock(dest, win);
MPI_Barrier(comm);
free(resbuf);
}
else if (rank == dest) {
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
int err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
recvtype.InitBuf(&recvtype);
MPI_Win_unlock(dest, win);
/*signal the source that checking and reinitialization is done */
MPI_Barrier(comm);
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, dest, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
MPI_Win_unlock(dest, win);
}
MPI_Win_free(&win);
MTestFreeDatatype(&sendtype);
MTestFreeDatatype(&recvtype);
}
}
MTestFreeComm(&comm);
}
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test for streaming ACC-like operations with lock_all";
*/
int main(int argc, char *argv[])
{
int errs = 0;
int rank, size;
int minsize = 2, count;
MPI_Comm comm;
MPI_Win win;
MPI_Aint lb, extent;
MTestDatatype sendtype, recvtype;
MTest_Init(&argc, &argv);
while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
if (comm == MPI_COMM_NULL)
continue;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &size);
int source = 0;
MTEST_DATATYPE_FOR_EACH_COUNT(count) {
while (MTestGetDatatypes(&sendtype, &recvtype, count)) {
recvtype.printErrors = 1;
recvtype.InitBuf(&recvtype);
MPI_Type_get_extent(recvtype.datatype, &lb, &extent);
MPI_Win_create(recvtype.buf, lb + recvtype.count * extent,
(int) extent, MPI_INFO_NULL, comm, &win);
if (rank == source) {
int dest;
sendtype.InitBuf(&sendtype);
MPI_Win_lock_all(0, win);
for (dest = 0; dest < size; dest++)
if (dest != source) {
MPI_Accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, dest, 0,
recvtype.count, recvtype.datatype, MPI_REPLACE, win);
}
MPI_Win_unlock_all(win);
MPI_Barrier(comm);
char *resbuf = (char *) calloc(lb + extent * recvtype.count, sizeof(char));
/*wait for the destinations to finish checking and reinitializing the buffers */
MPI_Barrier(comm);
MPI_Win_lock_all(0, win);
for (dest = 0; dest < size; dest++)
if (dest != source) {
MPI_Get_accumulate(sendtype.buf, sendtype.count,
sendtype.datatype, resbuf, recvtype.count,
recvtype.datatype, dest, 0, recvtype.count,
recvtype.datatype, MPI_REPLACE, win);
}
MPI_Win_unlock_all(win);
MPI_Barrier(comm);
free(resbuf);
}
else {
int err;
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
recvtype.InitBuf(&recvtype);
MPI_Win_unlock(rank, win);
/*signal the source that checking and reinitialization is done */
MPI_Barrier(comm);
MPI_Barrier(comm);
MPI_Win_lock(MPI_LOCK_SHARED, rank, 0, win);
err = MTestCheckRecv(0, &recvtype);
if (err)
errs++;
MPI_Win_unlock(rank, win);
}
MPI_Win_free(&win);
MTestFreeDatatype(&sendtype);
MTestFreeDatatype(&recvtype);
}
}
MTestFreeComm(&comm);
}
MTest_Finalize(errs);
MPI_Finalize();
return 0;
}
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* (C) 2015 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/*
static char MTEST_Descrip[] = "Test for streaming ACC-like operations with lock_all+flush";
*/
int main(int argc, char *argv[])
{
int errs = 0;
int rank, size;
int minsize = 2, count;
MPI_Comm comm;
MPI_Win win;
MPI_Aint lb, extent;
MTestDatatype sendtype, recvtype;
MTest_Init(&argc, &argv);
while (MTestGetIntracommGeneral(&comm, minsize, 1)) {
if (comm == MPI_COMM_NULL)
continue;
MPI_Comm_rank(comm, &rank);
MPI_Comm_size(comm, &size);
int source = 0;
MTEST_DATATYPE_FOR_EACH_COUNT(count) {
while (MTestGetDatatypes(&sendtype, &recvtype, count)) {
recvtype.printErrors = 1;
recvtype.InitBuf(&recvtype);
MPI_Type_get_extent(recvtype.datatype, &lb, &extent);
MPI_Win_create(recvtype.buf, lb + recvtype.count * extent,