#include <ostream>
#include <iostream>
#include <stdio.h>
static void
{
std::cerr << "Usage: " << program << " tracker port thisslicenumber numslice\n";
}
#define DATA_LEN 80000
#define PIPE_ATTEMPTS 10
int
{
{
return 1;
}
const char *tracker = args.
argv(1);
int port = SYSatoi(args.
argv(2));
int thisslice = SYSatoi(args.
argv(3));
int numslice = SYSatoi(args.
argv(4));
std::cerr << "Building connection to tracker " << tracker << ":" << port << std::endl;
std::cerr << "I am slice " << thisslice << " out of " << numslice << std::endl;
{
std::cerr << "Simple Exchange Test" << std::endl;
UT_NetExchange netxchg(tracker, port, thisslice, numslice,
"normalexchange");
for (int peer = 0; peer < numslice; peer++)
{
{
}
netxchg.sendData(peer, msg);
}
if (!netxchg.receiveDataLoop(completed, numslice))
{
std::cerr <<
"Failure to do traditional data exchange, got " << completed.
entries() << std::endl;
return -1;
}
for (
int i = 0; i < completed.
entries(); i++)
{
{
goalval = i + thisslice;
if (val != goalval)
{
std::cerr <<
"Error, got " << val <<
" at integer index " << i <<
" rather than expected " << goalval <<
", source slice was " << msg->
extractInt16(6) << std::endl;
return -1;
}
}
delete msg;
}
}
{
std::cerr << "Message Pipe Tests" << std::endl;
if (!pipe.openPipes())
{
std::cerr << "Failed to open message pipes" << std::endl;
return -1;
}
{
std::cerr <<
"Starting pass " <<
j << std::endl;
for (int peer = 0; peer < numslice; peer++)
{
msg = pipe.writePipe(peer);
for (int i = 0; i < datalen; i++)
{
}
}
if (!pipe.transferData())
{
std::cerr << "Failed to push data across pipes!" << std::endl;
return -1;
}
for (int peer = 0; peer < numslice; peer++)
{
for (int i = 0; i < datalen; i++)
{
int32 goalval = i + thisslice +
j;
if (val != goalval)
{
std::cerr << "Error, got " << val << " at integer index " << i << " rather than expected " << goalval << ", source slice was " << peer << " and this was pipe pass " << j << std::endl;
return -1;
}
}
}
}
for (int peer = 0; peer < numslice; peer++)
{
msg = pipe.writePipe(peer);
}
if (!pipe.closePipes())
{
std::cerr << "Failed to close message pipes." << std::endl;
return -1;
}
}
std::cerr << "All transferred successfully!" << std::endl;
return 0;
}