From ea69cc96e8b444c2e54eac0d4560f13c4c93db5c Mon Sep 17 00:00:00 2001 From: FKHals <5229803-FKHals@users.noreply.gitlab.com> Date: Tue, 18 May 2021 09:07:43 +0200 Subject: [PATCH] Implement a pre-pass-version of agent-rank-setting which contacts the agent server, so that it can create the mapping between the jobid, vpid and the desired rank/vpid (since the vpid actually gets used as the rank) before the actual assignment takes place. This is necessary because the assignment must be in ascending order since it writes into an array of process-pointers of the current group which will cause problems if the first (0th) field in the array has not yet been initialized but another (already initialized) process wants to contact it. --- ompi/communicator/comm_init.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ompi/communicator/comm_init.c b/ompi/communicator/comm_init.c index ab1b87b190..195fb8eba0 100644 --- a/ompi/communicator/comm_init.c +++ b/ompi/communicator/comm_init.c @@ -163,14 +163,20 @@ int ompi_comm_init(void) group->grp_proc_pointers = (ompi_proc_t **) calloc (size, sizeof (ompi_proc_t *)); group->grp_proc_count = size; + // transfer the infos about the current processes to the agent + for (size_t i = 0 ; i < size ; ++i) { + opal_process_name_t name = {.vpid = i, .jobid = OMPI_PROC_MY_NAME->jobid}; + // call without return just to gain knowledge about the processes + getProcessAgentRank(name.jobid, name.vpid, size); + } + for (size_t i = 0 ; i < size ; ++i) { opal_process_name_t name = {.vpid = i, .jobid = OMPI_PROC_MY_NAME->jobid}; /* get desired rank from agent (must be within size!)*/ - // TODO: Change int to size_t - size_t desired_rank = getProcessAgentRank(name.jobid, name.vpid, size); - printf("INIT Loop Rank: %zu\n", desired_rank); + name.vpid = getProcessAgentRank(name.jobid, name.vpid, size); + printf("INIT Loop Rank: %u\n", name.vpid); /* look for existing ompi_proc_t that matches this name */ - group->grp_proc_pointers[desired_rank] = (ompi_proc_t *) ompi_proc_lookup (name); + group->grp_proc_pointers[i] = (ompi_proc_t *) ompi_proc_lookup (name); if (NULL == group->grp_proc_pointers[i]) { /* set sentinel value */ group->grp_proc_pointers[i] = (ompi_proc_t *) ompi_proc_name_to_sentinel (name); -- GitLab