include "test.idp" if (!mpirank) cout << functionDEFINITION << "mpiGatherv" << endl; real t; if (!mpirank) cout << typeDEFINITION << "int[int]" << endl; int[int] snd(mpisize), rcv(mpisize * mpisize), a(mpisize), b(mpisize); snd[mpirank] = mpirank; for (int i = 0; i < mpisize; i++) { a[i] = mpisize; b[i] = i * mpisize; } t = mpiWtime(); mpiGatherv(snd, rcv, processor(0), a, b); t = mpiWtime() - t; if (!mpirank) cout << timeELAPSED << t << endl; if (mpirank == 0) { int i = 0; for (int counter = 0; counter < mpisize; counter++) { test(rcv[i] == counter); i += (mpisize + 1); } } if (!mpirank) cout << typeDEFINITION << "real[int]" << endl; real[int] sndr(mpisize), rcvr(mpisize * mpisize); int[int] ar(mpisize), br(mpisize); sndr[mpirank] = mpirank; for (int i = 0; i < mpisize; i++) { ar[i] = mpisize; br[i] = i * mpisize; } t = mpiWtime(); mpiGatherv(sndr, rcvr, processor(0), ar, br); t = mpiWtime() - t; if (!mpirank) cout << timeELAPSED << t << endl; if (mpirank == 0) { int i = 0; for (int counter = 0; counter < mpisize; counter++) { test(rcvr[i] == counter); i += (mpisize + 1); } } if (!mpirank) cout << typeDEFINITION << "complex[int]" << endl; complex[int] sndc(mpisize), rcvc(mpisize * mpisize); int[int] ac(mpisize), bc(mpisize); sndc[mpirank] = mpirank + (1 + 2i); for (int i = 0; i < mpisize; i++) { ac[i] = mpisize; bc[i] = i * mpisize; } t = mpiWtime(); mpiGatherv(sndc, rcvc, processor(0), ac, bc); t = mpiWtime() - t; if (!mpirank) cout << timeELAPSED << t << endl; if (mpirank == 0) { int i = 0; for (int counter = 0; counter < mpisize; counter++) { test(rcvc[i] == counter + (1 + 2i)); i += (mpisize + 1); } }