Skip to content

Commit

Permalink
fixed running a job with dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Nov 12, 2020
1 parent 9ff232d commit 9963709
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 41 deletions.
47 changes: 17 additions & 30 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,38 +137,25 @@ int c_wait_server_commands()
error("Error in wait_server_commands");
if (m.type == RUNJOB)
{
struct Result res;
res.skipped = 0;
/* These will send RUNJOB_OK */
if (command_line.do_depend && m.u.last_errorlevel != 0)
{
res.errorlevel = -1;
res.user_ms = 0.;
res.system_ms = 0.;
res.real_ms = 0.;
res.skipped = 1;
c_send_runjob_ok(0, -1);
}
else {
if (command_line.gpus) {
int numFree;
int * freeList = getFreeGpuList(&numFree);
char tmp[50];
strcpy(tmp, "CUDA_VISIBLE_DEVICES=");
for (int i = 0; i < command_line.gpus; i++) {
char tmp2[5];
sprintf(tmp2, "%d", freeList[i]);
strcat(tmp, tmp2);
if (i < command_line.gpus - 1)
strcat(tmp, ",");
}
putenv(tmp);
struct Result result;
if (command_line.gpus) {
int numFree;
int * freeList = getFreeGpuList(&numFree);
char tmp[50];
strcpy(tmp, "CUDA_VISIBLE_DEVICES=");
for (int i = 0; i < command_line.gpus; i++) {
char tmp2[5];
sprintf(tmp2, "%d", freeList[i]);
strcat(tmp, tmp2);
if (i < command_line.gpus - 1)
strcat(tmp, ",");
}

run_job(&res);
putenv(tmp);
}
c_end_of_job(&res);
return res.errorlevel;

run_job(&result);
c_end_of_job(&result);
return result.errorlevel;
}
}
return -1;
Expand Down
13 changes: 2 additions & 11 deletions jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,16 +884,7 @@ void s_send_runjob(int s, int jobid)
if (p == 0)
error("Job %i was expected to run", jobid);


m.type = RUNJOB;

/* TODO
* We should make the dependencies update the jobids they're do_depending on.
* Then, on finish, these could set the errorlevel to send to its dependency childs.
* We cannot consider that the jobs will leave traces in the finished job list (-nf?) . */

m.u.last_errorlevel = p->dependency_errorlevel;

send_msg(s, &m);
}

Expand Down Expand Up @@ -1058,15 +1049,15 @@ void notify_errorlevel(struct Job *p)
{
int i;

last_errorlevel = 0; /* broadcasted "fake news" */
last_errorlevel = p->result.errorlevel;

for(i = 0; i < p->notify_errorlevel_to_size; ++i)
{
struct Job *notified;
notified = get_job(p->notify_errorlevel_to[i]);
if (notified)
{
notified->dependency_errorlevel = 0; /* broadcasted "fake news" */
notified->dependency_errorlevel = p->result.errorlevel;
}
}
}
Expand Down

0 comments on commit 9963709

Please sign in to comment.