|
|
@@ -49,29 +49,29 @@ static struct WrkControllerState {
|
|
|
|
|
|
// ----- Below this line are the functions running in the worker thread.
|
|
|
|
|
|
+#if WORDS > 1
|
|
|
+#define DEMUXWORD 8
|
|
|
+#else
|
|
|
+#define DEMUXWORD 7
|
|
|
+#endif
|
|
|
|
|
|
// This function is called from inside cuda_dl for each DP it encounters.
|
|
|
// It calls the function named "dpcallback" directly. It would be
|
|
|
// cleaner if this were passed as a function pointer to cuda_dl, but
|
|
|
// that makes nvcc 3.1 segfault. :-p
|
|
|
-bool dpcallback(void *cbdata, unsigned short threadId,
|
|
|
- unsigned short blockId, unsigned int demux, unsigned int *dpwords,
|
|
|
- unsigned int a_0, unsigned int a_1, unsigned int a_2,
|
|
|
- unsigned int b_0, unsigned int b_1, unsigned int b_2)
|
|
|
+// dp points to an array of WORDS+7 unsigned ints:
|
|
|
+// - 1 word of threadID/blockID
|
|
|
+// - WORDS words of the dp value
|
|
|
+// - 3 words of a
|
|
|
+// - 3 words of b
|
|
|
+bool dpcallback(void *cbdata, unsigned int *dpwords)
|
|
|
{
|
|
|
+ unsigned int demux = dpwords[DEMUXWORD];
|
|
|
+
|
|
|
struct bufferevent *bev =
|
|
|
wrkctrlstate.dpnodes[demux % wrkctrlstate.num_connected_dpnodes];
|
|
|
|
|
|
- unsigned char DPbuf[(WORDS+6)*sizeof(unsigned int)];
|
|
|
- memmove(DPbuf, dpwords, WORDS*sizeof(unsigned int));
|
|
|
- memmove(DPbuf+WORDS*sizeof(unsigned int), &a_0, sizeof(unsigned int));
|
|
|
- memmove(DPbuf+(WORDS+1)*sizeof(unsigned int), &a_1, sizeof(unsigned int));
|
|
|
- memmove(DPbuf+(WORDS+2)*sizeof(unsigned int), &a_2, sizeof(unsigned int));
|
|
|
- memmove(DPbuf+(WORDS+3)*sizeof(unsigned int), &b_0, sizeof(unsigned int));
|
|
|
- memmove(DPbuf+(WORDS+4)*sizeof(unsigned int), &b_1, sizeof(unsigned int));
|
|
|
- memmove(DPbuf+(WORDS+5)*sizeof(unsigned int), &b_2, sizeof(unsigned int));
|
|
|
-
|
|
|
- bufferevent_write(bev, DPbuf, (WORDS+6)*sizeof(unsigned int));
|
|
|
+ bufferevent_write(bev, dpwords+1, (WORDS+6)*sizeof(unsigned int));
|
|
|
|
|
|
// If worker_thread_state changes to WT_SHOULD_STOP, then signal to
|
|
|
// stop computation by returning true. If for some reason, it
|