Ejemplo n.º 1
0
static void
_job_init_task_info(stepd_step_rec_t *job, uint32_t **gtid,
		    char *ifname, char *ofname, char *efname)
{
	int          i, node_id = job->nodeid;
	char        *in, *out, *err;

	if (job->node_tasks == 0) {
		error("User requested launch of zero tasks!");
		job->task = NULL;
		return;
	}

#if defined(HAVE_NATIVE_CRAY)
	for (i = 0; i < job->nnodes; i++) {
		int j;
		for (j = 1; j < job->task_cnts[i]; j++) {
			if (gtid[i][j] != gtid[i][j-1] + 1) {
				job->non_smp = 1;
				break;
			}
		}
	}
#endif

	job->task = (stepd_step_task_info_t **)
		xmalloc(job->node_tasks * sizeof(stepd_step_task_info_t *));

	if (((job->flags & LAUNCH_MULTI_PROG) == 0) && job->argv) {
		char *new_path = build_path(job->argv[0], job->env, job->cwd);
		xfree(job->argv[0]);
		job->argv[0] = new_path;
	}

	for (i = 0; i < job->node_tasks; i++) {
		in = _expand_stdio_filename(ifname, gtid[node_id][i], job);
		out = _expand_stdio_filename(ofname, gtid[node_id][i], job);
		err = _expand_stdio_filename(efname, gtid[node_id][i], job);
		job->task[i] = task_info_create(i, gtid[node_id][i], in, out,
						err);
		if ((job->flags & LAUNCH_MULTI_PROG) == 0) {
			job->task[i]->argc = job->argc;
			job->task[i]->argv = job->argv;
		}
	}

	if (job->flags & LAUNCH_MULTI_PROG) {
		char *switch_type = slurm_get_switch_type();
		if (!xstrcmp(switch_type, "switch/cray"))
			multi_prog_parse(job, gtid);
		xfree(switch_type);
		for (i = 0; i < job->node_tasks; i++){
			multi_prog_get_argv(job->argv[1], job->env,
					    gtid[node_id][i],
					    &job->task[i]->argc,
					    &job->task[i]->argv,
					    job->argc, job->argv);
		}
	}
}
Ejemplo n.º 2
0
static void
_job_init_task_info(stepd_step_rec_t *job, uint32_t **gtid,
		    char *ifname, char *ofname, char *efname)
{
	int          i, node_id = job->nodeid;
	char        *in, *out, *err;

	if (job->node_tasks == 0) {
		error("User requested launch of zero tasks!");
		job->task = NULL;
		return;
	}

	job->task = (stepd_step_task_info_t **)
		xmalloc(job->node_tasks * sizeof(stepd_step_task_info_t *));

	for (i = 0; i < job->node_tasks; i++){
		in = _expand_stdio_filename(ifname, gtid[node_id][i], job);
		out = _expand_stdio_filename(ofname, gtid[node_id][i], job);
		err = _expand_stdio_filename(efname, gtid[node_id][i], job);
		job->task[i] = task_info_create(i, gtid[node_id][i], in, out,
						err);
		if (!job->multi_prog) {
			job->task[i]->argc = job->argc;
			job->task[i]->argv = job->argv;
		}
	}

	if (job->multi_prog) {
		char *switch_type = slurm_get_switch_type();
		if (!strcmp(switch_type, "switch/cray"))
			multi_prog_parse(job, gtid);
		xfree(switch_type);
		for (i = 0; i < job->node_tasks; i++){
			multi_prog_get_argv(job->argv[1], job->env,
					    gtid[node_id][i],
					    &job->task[i]->argc,
					    &job->task[i]->argv,
					    job->argc, job->argv);
		}
	}
}