View | Details | Raw Unified | Return to ticket 1159 | Differences between
and this patch

Collapse All | Expand All

(-)a/src/common/env.c (-37 lines)
Lines 1039-1067 env_array_for_job(char ***dest, const resource_allocation_response_msg_t *alloc, Link Here
1039
		uint32_t tmp_mem = alloc->pn_min_memory & (~MEM_PER_CPU);
1039
		uint32_t tmp_mem = alloc->pn_min_memory & (~MEM_PER_CPU);
1040
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_CPU", "%u",
1040
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_CPU", "%u",
1041
					tmp_mem);
1041
					tmp_mem);
1042
#ifdef HAVE_ALPS_CRAY
1043
		env_array_overwrite_fmt(dest, "APRUN_DEFAULT_MEMORY", "%u",
1044
					tmp_mem);
1045
#endif
1046
	} else if (alloc->pn_min_memory) {
1042
	} else if (alloc->pn_min_memory) {
1047
		uint32_t tmp_mem = alloc->pn_min_memory;
1043
		uint32_t tmp_mem = alloc->pn_min_memory;
1048
#ifdef HAVE_ALPS_CRAY
1049
		uint32_t i, max_cpus_per_node = 1;
1050
		for (i = 0; i < alloc->num_cpu_groups; i++) {
1051
			if ((i == 0) ||
1052
			    (max_cpus_per_node < alloc->cpus_per_node[i])) {
1053
				max_cpus_per_node = alloc->cpus_per_node[i];
1054
			}
1055
		}
1056
		tmp_mem /= max_cpus_per_node;
1057
		env_array_overwrite_fmt(dest, "APRUN_DEFAULT_MEMORY", "%u",
1058
					tmp_mem);
1059
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_CPU", "%u",
1060
					tmp_mem);
1061
#else
1062
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_NODE", "%u",
1044
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_NODE", "%u",
1063
					tmp_mem);
1045
					tmp_mem);
1064
#endif
1065
	}
1046
	}
1066
1047
1067
	/* OBSOLETE, but needed by MPI, do not remove */
1048
	/* OBSOLETE, but needed by MPI, do not remove */
Lines 1235-1262 env_array_for_batch_job(char ***dest, const batch_job_launch_msg_t *batch, Link Here
1235
		uint32_t tmp_mem = batch->pn_min_memory & (~MEM_PER_CPU);
1216
		uint32_t tmp_mem = batch->pn_min_memory & (~MEM_PER_CPU);
1236
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_CPU", "%u",
1217
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_CPU", "%u",
1237
					tmp_mem);
1218
					tmp_mem);
1238
#ifdef HAVE_ALPS_CRAY
1239
		env_array_overwrite_fmt(dest, "CRAY_AUTO_APRUN_OPTIONS",
1240
					"\"-m%u\"", tmp_mem);
1241
#endif
1242
	} else if (batch->pn_min_memory) {
1219
	} else if (batch->pn_min_memory) {
1243
		uint32_t tmp_mem = batch->pn_min_memory;
1220
		uint32_t tmp_mem = batch->pn_min_memory;
1244
#ifdef HAVE_ALPS_CRAY
1245
		uint32_t i, max_cpus_per_node = 1;
1246
		for (i = 0; i < batch->num_cpu_groups; i++) {
1247
			if ((i == 0) ||
1248
			    (max_cpus_per_node < batch->cpus_per_node[i])) {
1249
				max_cpus_per_node = batch->cpus_per_node[i];
1250
			}
1251
		}
1252
#endif
1253
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_NODE", "%u",
1221
		env_array_overwrite_fmt(dest, "SLURM_MEM_PER_NODE", "%u",
1254
					tmp_mem);
1222
					tmp_mem);
1255
#ifdef HAVE_ALPS_CRAY
1256
		tmp_mem /= max_cpus_per_node;
1257
		env_array_overwrite_fmt(dest, "CRAY_AUTO_APRUN_OPTIONS",
1258
					"\"-m%u\"", tmp_mem);
1259
#endif
1260
	}
1223
	}
1261
1224
1262
	return SLURM_SUCCESS;
1225
	return SLURM_SUCCESS;
(-)a/src/plugins/launch/aprun/launch_aprun.c (-14 lines)
Lines 691-710 extern int launch_p_create_job_step(srun_job_t *job, bool use_all_cpus, Link Here
691
				    void (*signal_function)(int),
691
				    void (*signal_function)(int),
692
				    sig_atomic_t *destroy_job)
692
				    sig_atomic_t *destroy_job)
693
{
693
{
694
	char value[32];
695
696
	/* If srun is call directly this wasn't figured out until
697
	   later if the user used --mem.  The problem here is this
698
	   will not work with --launch_cmd since that doesn't go get
699
	   an actual allocation (which is where pn_min_memory is decided).
700
	*/
701
	if ((opt.mem_per_cpu == NO_VAL)
702
	    && global_resp && (global_resp->pn_min_memory & MEM_PER_CPU)) {
703
		snprintf(value, sizeof(value), "%u",
704
			 global_resp->pn_min_memory & (~MEM_PER_CPU));
705
		setenv("APRUN_DEFAULT_MEMORY", value, 1);
706
	}
707
708
	if (opt.launch_cmd) {
694
	if (opt.launch_cmd) {
709
		int i = 0;
695
		int i = 0;
710
		char *cmd_line = NULL;
696
		char *cmd_line = NULL;

Return to ticket 1159