mcexec: introduction of --flags argument

Change-Id: If5b70bf06460fc709444d8135511c3699304d31f
This commit is contained in:
Balazs Gerofi
2021-03-03 14:48:55 +09:00
committed by Masamichi Takagi
parent 5664f54390
commit 71c333965c
5 changed files with 30 additions and 2 deletions

View File

@@ -172,6 +172,7 @@ struct program_load_desc {
#ifdef ENABLE_TOFU #ifdef ENABLE_TOFU
int enable_tofu; int enable_tofu;
#endif #endif
unsigned long mcexec_flags;
int nr_processes; int nr_processes;
int process_rank; int process_rank;
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE]; __cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];

View File

@@ -207,6 +207,7 @@ static int enable_uti = 0;
#ifdef ENABLE_TOFU #ifdef ENABLE_TOFU
static int enable_tofu = 0; static int enable_tofu = 0;
#endif #endif
static unsigned long mcexec_flags = 0;
/* Partitioned execution (e.g., for MPI) */ /* Partitioned execution (e.g., for MPI) */
static int nr_processes = 0; static int nr_processes = 0;
@@ -1803,6 +1804,12 @@ static struct option mcexec_options[] = {
.flag = &debug, .flag = &debug,
.val = 1, .val = 1,
}, },
{
.name = "flags",
.has_arg = required_argument,
.flag = NULL,
.val = 'f',
},
/* end */ /* end */
{ NULL, 0, NULL, 0, }, { NULL, 0, NULL, 0, },
}; };
@@ -2184,10 +2191,10 @@ int main(int argc, char **argv)
/* Parse options ("+" denotes stop at the first non-option) */ /* Parse options ("+" denotes stop at the first non-option) */
#ifdef ADD_ENVS_OPTION #ifdef ADD_ENVS_OPTION
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:S:", while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:S:f:",
mcexec_options, NULL)) != -1) { mcexec_options, NULL)) != -1) {
#else /* ADD_ENVS_OPTION */ #else /* ADD_ENVS_OPTION */
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:S:", while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:S:f:",
mcexec_options, NULL)) != -1) { mcexec_options, NULL)) != -1) {
#endif /* ADD_ENVS_OPTION */ #endif /* ADD_ENVS_OPTION */
switch (opt) { switch (opt) {
@@ -2262,6 +2269,10 @@ int main(int argc, char **argv)
uti_thread_rank = atoi(optarg); uti_thread_rank = atoi(optarg);
break; break;
case 'f':
mcexec_flags = strtoul(optarg, NULL, 16);
break;
case 0: /* long opt */ case 0: /* long opt */
break; break;
@@ -2415,6 +2426,8 @@ int main(int argc, char **argv)
return 1; return 1;
} }
desc->mcexec_flags = 0;
#ifdef ADD_ENVS_OPTION #ifdef ADD_ENVS_OPTION
/* Collect environment variables */ /* Collect environment variables */
for (i = 0; environ[i]; i++) { for (i = 0; environ[i]; i++) {
@@ -2827,6 +2840,14 @@ int main(int argc, char **argv)
desc->enable_tofu = enable_tofu; desc->enable_tofu = enable_tofu;
#endif #endif
/*
* Override mcexec_flags, if explicitly set.
* This must be right before prepare image.
*/
if (mcexec_flags) {
desc->mcexec_flags = mcexec_flags;
}
/* user_start and user_end are set by this call */ /* user_start and user_end are set by this call */
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) { if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
perror("prepare"); perror("prepare");

View File

@@ -589,6 +589,10 @@ static int process_msg_prepare_process(unsigned long rphys)
} }
#endif #endif
proc->mcexec_flags = pn->mcexec_flags;
dkprintf("%s: PID: %d, flags: 0x%lx\n",
__func__, proc->pid, proc->mcexec_flags);
#ifdef PROFILE_ENABLE #ifdef PROFILE_ENABLE
proc->profile = pn->profile; proc->profile = pn->profile;
thread->profile = pn->profile; thread->profile = pn->profile;

View File

@@ -577,6 +577,7 @@ struct process {
int enable_tofu; int enable_tofu;
#endif #endif
size_t straight_map_threshold; size_t straight_map_threshold;
unsigned long mcexec_flags;
// perf_event // perf_event
int perf_status; int perf_status;

View File

@@ -243,6 +243,7 @@ struct program_load_desc {
#ifdef ENABLE_TOFU #ifdef ENABLE_TOFU
int enable_tofu; int enable_tofu;
#endif #endif
unsigned long mcexec_flags;
int nr_processes; int nr_processes;
int process_rank; int process_rank;
__cpu_set_unit cpu_set[PLD_CPU_SET_SIZE]; __cpu_set_unit cpu_set[PLD_CPU_SET_SIZE];