Пример #1
0
/*
 * task_pre_setuid() is called before setting the UID for the
 * user to launch his jobs. Use this to create the CPUSET directory
 * and set the owner appropriately.
 */
extern int task_pre_setuid (slurmd_job_t *job)
{
	char path[PATH_MAX];
	int rc;

	if (!(conf->task_plugin_param & CPU_BIND_CPUSETS))
		return SLURM_SUCCESS;

#ifdef MULTIPLE_SLURMD
	if (snprintf(path, PATH_MAX, "%s/slurm_%s_%u",
		     CPUSET_DIR,
		     (conf->node_name != NULL)?conf->node_name:"",
		     job->jobid) > PATH_MAX) {
		error("cpuset path too long");
		return SLURM_ERROR;
	}
#else
	if (snprintf(path, PATH_MAX, "%s/slurm%u",
			CPUSET_DIR, job->jobid) > PATH_MAX) {
		error("cpuset path too long");
		return SLURM_ERROR;
	}
#endif

	rc = slurm_build_cpuset(CPUSET_DIR, path, job->uid, job->gid);

	/* if cpuset was built ok, check for cpu frequency setting */
	if ( !(rc) && (job->cpu_freq != NO_VAL))
 	     cpu_freq_cpuset_validate(job);

	return rc;
}
Пример #2
0
/*
 * task_p_pre_setuid() is called before setting the UID for the
 * user to launch his jobs. Use this to create the CPUSET directory
 * and set the owner appropriately.
 */
extern int task_p_pre_setuid (stepd_step_rec_t *job)
{
	char path[PATH_MAX];
	int rc = SLURM_SUCCESS;

	if (conf->task_plugin_param & CPU_BIND_CPUSETS) {
#ifdef MULTIPLE_SLURMD
		if (snprintf(path, PATH_MAX, "%s/slurm_%s_%u",
			     CPUSET_DIR,
			     (conf->node_name != NULL)?conf->node_name:"",
			     job->jobid) > PATH_MAX) {
			error("%s: cpuset path too long", __func__);
			rc = SLURM_ERROR;
		}
#else
		if (snprintf(path, PATH_MAX, "%s/slurm%u",
			     CPUSET_DIR, job->jobid) > PATH_MAX) {
			error("%s: cpuset path too long", __func__);
			rc = SLURM_ERROR;
		}
#endif
		if (rc == SLURM_SUCCESS) {
			rc = slurm_build_cpuset(CPUSET_DIR, path, job->uid,
						job->gid);
			if (rc != SLURM_SUCCESS) {
				error("%s: slurm_build_cpuset() failed",
				       __func__);
			}
		}
	}

	if (rc == SLURM_SUCCESS)
		cpu_freq_cpuset_validate(job);

	return rc;
}