|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
* (C) 2010 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
#include "mpi.h"
|
|
Packit Service |
c5cf8c |
#include "mpitestconf.h"
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_IOSTREAM
|
|
Packit Service |
c5cf8c |
// Not all C++ compilers have iostream instead of iostream.h
|
|
Packit Service |
c5cf8c |
#include <iostream>
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_NAMESPACE_STD
|
|
Packit Service |
c5cf8c |
// Those that do often need the std namespace; otherwise, a bare "cout"
|
|
Packit Service |
c5cf8c |
// is likely to fail to compile
|
|
Packit Service |
c5cf8c |
using namespace std;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
#else
|
|
Packit Service |
c5cf8c |
#include <iostream.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
#include <stdio.h>
|
|
Packit Service |
c5cf8c |
#include "mpitestcxx.h"
|
|
Packit Service |
c5cf8c |
#ifdef HAVE_STRING_H
|
|
Packit Service |
c5cf8c |
#include <string.h>
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static char MTEST_Descrip[] = "Test win_call_errhandler";
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
static int calls = 0;
|
|
Packit Service |
c5cf8c |
static int errs = 0;
|
|
Packit Service |
c5cf8c |
static MPI::Win mywin;
|
|
Packit Service |
c5cf8c |
void eh(MPI::Win & win, int *err, ...)
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
if (*err != MPI_ERR_OTHER) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
cout << "Unexpected error code\n";
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
if (win != mywin) {
|
|
Packit Service |
c5cf8c |
char cname[MPI_MAX_OBJECT_NAME];
|
|
Packit Service |
c5cf8c |
int len;
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
cout << "Unexpected window\n";
|
|
Packit Service |
c5cf8c |
win.Get_name(cname, len);
|
|
Packit Service |
c5cf8c |
cout << "Win is " << cname << "\n";
|
|
Packit Service |
c5cf8c |
mywin.Get_name(cname, len);
|
|
Packit Service |
c5cf8c |
cout << "Mywin is " << cname << "\n";
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
calls++;
|
|
Packit Service |
c5cf8c |
return;
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
int main(int argc, char *argv[])
|
|
Packit Service |
c5cf8c |
{
|
|
Packit Service |
c5cf8c |
MPI::Win win;
|
|
Packit Service |
c5cf8c |
MPI::Errhandler newerr;
|
|
Packit Service |
c5cf8c |
int i;
|
|
Packit Service |
c5cf8c |
int reset_handler;
|
|
Packit Service |
c5cf8c |
int buf[10];
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Init();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
win = MPI::Win::Create(buf, sizeof(buf), 1, MPI::INFO_NULL, MPI::COMM_WORLD);
|
|
Packit Service |
c5cf8c |
mywin = win;
|
|
Packit Service |
c5cf8c |
mywin.Set_name("dup of win_world");
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
newerr = MPI::Win::Create_errhandler(eh);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
win.Set_errhandler(newerr);
|
|
Packit Service |
c5cf8c |
win.Call_errhandler(MPI_ERR_OTHER);
|
|
Packit Service |
c5cf8c |
newerr.Free();
|
|
Packit Service |
c5cf8c |
if (calls != 1) {
|
|
Packit Service |
c5cf8c |
errs++;
|
|
Packit Service |
c5cf8c |
cout << "Error handler not called\n";
|
|
Packit Service |
c5cf8c |
}
|
|
Packit Service |
c5cf8c |
win.Free();
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MTest_Finalize(errs);
|
|
Packit Service |
c5cf8c |
return 0;
|
|
Packit Service |
c5cf8c |
}
|