|
@@ -54,6 +54,7 @@ static struct WrkControllerState {
|
|
|
WTState worker_thread_state;
|
|
WTState worker_thread_state;
|
|
|
pthread_t worker_thread;
|
|
pthread_t worker_thread;
|
|
|
unsigned int kernel_launch_count;
|
|
unsigned int kernel_launch_count;
|
|
|
|
|
+ unsigned int worker_id;
|
|
|
|
|
|
|
|
WrkControllerState(): current_problem(NULL),
|
|
WrkControllerState(): current_problem(NULL),
|
|
|
worker_thread_state(WT_NOT_RUNNING) {}
|
|
worker_thread_state(WT_NOT_RUNNING) {}
|
|
@@ -111,7 +112,7 @@ static void *worker_thread_start(void *data)
|
|
|
SetSeed(wrkctrlstate.current_problem->base*
|
|
SetSeed(wrkctrlstate.current_problem->base*
|
|
|
wrkctrlstate.current_problem->target*
|
|
wrkctrlstate.current_problem->target*
|
|
|
wrkctrlstate.current_problem->order*
|
|
wrkctrlstate.current_problem->order*
|
|
|
- wrkctrlstate.current_problem->modulus);
|
|
|
|
|
|
|
+ wrkctrlstate.current_problem->modulus+wrkctrlstate.worker_id);
|
|
|
#endif
|
|
#endif
|
|
|
cuda_dl(to_ZZ_p(wrkctrlstate.current_problem->base),
|
|
cuda_dl(to_ZZ_p(wrkctrlstate.current_problem->base),
|
|
|
to_ZZ_p(wrkctrlstate.current_problem->target),
|
|
to_ZZ_p(wrkctrlstate.current_problem->target),
|
|
@@ -158,6 +159,7 @@ static void stop_working(void)
|
|
|
wrkctrlstate.dpnodes.clear();
|
|
wrkctrlstate.dpnodes.clear();
|
|
|
wrkctrlstate.num_connected_dpnodes = 0;
|
|
wrkctrlstate.num_connected_dpnodes = 0;
|
|
|
wrkctrlstate.num_expected_dpnodes = 0;
|
|
wrkctrlstate.num_expected_dpnodes = 0;
|
|
|
|
|
+ wrkctrlstate.worker_id = 0;
|
|
|
// Careful! Subproblem uses NTL, so we must be sure we're not
|
|
// Careful! Subproblem uses NTL, so we must be sure we're not
|
|
|
// multithreaded at this point.
|
|
// multithreaded at this point.
|
|
|
delete wrkctrlstate.current_problem;
|
|
delete wrkctrlstate.current_problem;
|
|
@@ -167,7 +169,7 @@ static void stop_working(void)
|
|
|
static void start_working(void)
|
|
static void start_working(void)
|
|
|
{
|
|
{
|
|
|
#ifdef VERBOSE
|
|
#ifdef VERBOSE
|
|
|
- cerr << "Starting work\n";
|
|
|
|
|
|
|
+ cerr << "Starting work (worker id: " << wrkctrlstate.worker_id << ")\n";
|
|
|
#endif
|
|
#endif
|
|
|
struct timeval now;
|
|
struct timeval now;
|
|
|
gettimeofday(&now, NULL);
|
|
gettimeofday(&now, NULL);
|
|
@@ -250,9 +252,10 @@ static void controllerconn_reader(struct bufferevent *bev, void *ctx)
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case WRKCCSTATE_RDPROBLEM:
|
|
case WRKCCSTATE_RDPROBLEM:
|
|
|
- if (len < SUBPROBLEM_DESC_LEN+2) return;
|
|
|
|
|
|
|
+ if (len < SUBPROBLEM_DESC_LEN+sizeof(unsigned int)+2) return;
|
|
|
stop_working();
|
|
stop_working();
|
|
|
bufferevent_read(bev, subproblem, SUBPROBLEM_DESC_LEN);
|
|
bufferevent_read(bev, subproblem, SUBPROBLEM_DESC_LEN);
|
|
|
|
|
+ bufferevent_read(bev, &wrkctrlstate.worker_id, sizeof(unsigned int));
|
|
|
bufferevent_read(bev, &(info->num_dpnodes), 2);
|
|
bufferevent_read(bev, &(info->num_dpnodes), 2);
|
|
|
// Careful! Subproblem uses NTL, so we must be sure
|
|
// Careful! Subproblem uses NTL, so we must be sure
|
|
|
// we're not multithreaded at this point.
|
|
// we're not multithreaded at this point.
|