uti: Identify uti thread by clone count

--uti-thread-count <count> is added to mcexec.

Change-Id: Id9ec464412a5bb71e4d9e87d05f79de22d35b067
This commit is contained in:
Masamichi Takagi
2018-09-04 10:27:52 +09:00
parent b0d7f890d0
commit b6ab5911b7
7 changed files with 36 additions and 2 deletions

View File

@ -142,6 +142,7 @@ struct program_load_desc {
unsigned long heap_extension;
long stack_premap;
unsigned long mpol_bind_mask;
int uti_thread_rank; /* N-th clone() spawns a thread on Linux CPU */
int nr_processes;
int process_rank;
char shell_path[SHELL_PATH_MAX_LEN];

View File

@ -233,6 +233,7 @@ static long stack_premap = (2ULL << 20);
static long stack_max = -1;
static struct rlimit rlim_stack;
static char *mpol_bind_nodes = NULL;
static int uti_thread_rank = 0;
/* Partitioned execution (e.g., for MPI) */
static int nr_processes = 0;
@ -1787,6 +1788,12 @@ static struct option mcexec_options[] = {
.flag = NULL,
.val = 's',
},
{
.name = "uti-thread-rank",
.has_arg = required_argument,
.flag = NULL,
.val = 'u',
},
/* end */
{ NULL, 0, NULL, 0, },
};
@ -2049,9 +2056,9 @@ int main(int argc, char **argv)
/* Parse options ("+" denotes stop at the first non-option) */
#ifdef ADD_ENVS_OPTION
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:", mcexec_options, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:e:s:m:u:", mcexec_options, NULL)) != -1) {
#else /* ADD_ENVS_OPTION */
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:", mcexec_options, NULL)) != -1) {
while ((opt = getopt_long(argc, argv, "+c:n:t:M:h:s:m:u:", mcexec_options, NULL)) != -1) {
#endif /* ADD_ENVS_OPTION */
switch (opt) {
char *tmp;
@ -2114,6 +2121,10 @@ int main(int argc, char **argv)
__dprintf("stack_premap=%ld,stack_max=%ld\n", stack_premap, stack_max);
break; }
case 'u':
uti_thread_rank = atoi(optarg);
break;
case 0: /* long opt */
break;
@ -2598,6 +2609,9 @@ int main(int argc, char **argv)
}
}
desc->uti_thread_rank = uti_thread_rank;
/* user_start and user_end are set by this call */
if (ioctl(fd, MCEXEC_UP_PREPARE_IMAGE, (unsigned long)desc) != 0) {
perror("prepare");
close(fd);