45 std::cerr <<
"Usage: " << program <<
" tracker port thisslicenumber numslice\n";
48 #define DATA_LEN 80000
49 #define PIPE_ATTEMPTS 10
75 const char *tracker = args.
argv(1);
76 int port = SYSatoi(args.
argv(2));
77 int thisslice = SYSatoi(args.
argv(3));
78 int numslice = SYSatoi(args.
argv(4));
80 std::cerr <<
"Building connection to tracker " << tracker <<
":" << port << std::endl;
81 std::cerr <<
"I am slice " << thisslice <<
" out of " << numslice << std::endl;
85 std::cerr <<
"Simple Exchange Test" << std::endl;
86 UT_NetExchange netxchg(tracker, port, thisslice, numslice,
"normalexchange");
88 for (
int peer = 0; peer < numslice; peer++)
103 std::cerr <<
"Failure to do traditional data exchange, got " << completed.
entries() << std::endl;
109 for (
int i = 0; i < completed.
entries(); i++)
117 goalval = i + thisslice;
123 std::cerr <<
"Error, got " << val <<
" at integer index " << i <<
" rather than expected " << goalval <<
", source slice was " << msg->
extractInt16(6) << std::endl;
135 std::cerr <<
"Message Pipe Tests" << std::endl;
142 std::cerr <<
"Failed to open message pipes" << std::endl;
149 std::cerr <<
"Starting pass " <<
j << std::endl;
150 for (
int peer = 0; peer < numslice; peer++)
159 for (
int i = 0; i < datalen; i++)
169 std::cerr <<
"Failed to push data across pipes!" << std::endl;
176 for (
int peer = 0; peer < numslice; peer++)
180 for (
int i = 0; i < datalen; i++)
182 int32 goalval = i + thisslice +
j;
187 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;
194 for (
int peer = 0; peer < numslice; peer++)
205 std::cerr <<
"Failed to close message pipes." << std::endl;
211 std::cerr <<
"All transferred successfully!" << std::endl;
const char * argv(unsigned i) const
int32 extractInt32(exint offset)
void overwriteInt32(exint offset, int32 val)
bool closePipes(int timeoutms=100)
Shuts down the pipes, returns true if successful.
void setWriteDataLength(exint bufsize)
UT_NetMessage * readPipe(int peer)
bool receiveDataLoop(UT_Array< UT_NetMessage * > &completed, int expectedmessages, int timeoutms=100)
exint entries() const
Alias of size(). size() is preferred.
int theMain(int argc, char *argv[])
GLsizeiptr const void GLenum usage
bool transferData(int timeoutms=100)
UT_NetMessage * writePipe(int peer)
void resetLength(TransmitState state, exint newlen)
Resizes, useful for pipe messages.
**But if you need a or simply need to know when the task has * completed
**If you just want to fire and args
void initialize(int argc, const char *const argv[])
void sendData(int destpeer, const char *data, exint len)
GLbitfield GLuint program
int16 extractInt16(exint offset)
bool openPipes(int timeoutms=100)
Prepares the pipes, returns true if successful.