Skip to content
Snippets Groups Projects
Commit 94652988 authored by FKHals's avatar FKHals
Browse files

Add vpid to data that is send to agent

to make the mapping <jobid>,<vpid> -> <rank> possible.
parent d83cf7d2
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,7 @@ static void errorExit(char* msg) { ...@@ -96,7 +96,7 @@ static void errorExit(char* msg) {
} }
// TODO: Change int return to size_t! // TODO: Change int return to size_t!
static int getProcessAgentRank(uint32_t jobid, size_t size) { static int getProcessAgentRank(uint32_t jobid, uint32_t vpid, size_t size) {
struct sockaddr_un strAddr; struct sockaddr_un strAddr;
socklen_t lenAddr; socklen_t lenAddr;
int fdSock; int fdSock;
...@@ -115,7 +115,9 @@ static int getProcessAgentRank(uint32_t jobid, size_t size) { ...@@ -115,7 +115,9 @@ static int getProcessAgentRank(uint32_t jobid, size_t size) {
pid_t pid = getpid(); pid_t pid = getpid();
char info_to_send[BUFFLEN]; char info_to_send[BUFFLEN];
snprintf(info_to_send, BUFFLEN+1, "Spawned - PID: %d, jobID: %u, size: %zu", pid, jobid, size); snprintf(info_to_send, BUFFLEN+1,
"Spawned - PID: %d, vpid: %u, jobID: %u, size: %zu",
pid, vpid, jobid, size);
if (send(fdSock, info_to_send, BUFFLEN+1, 0) < 0) { if (send(fdSock, info_to_send, BUFFLEN+1, 0) < 0) {
errorExit("send"); errorExit("send");
} }
...@@ -165,7 +167,7 @@ int ompi_comm_init(void) ...@@ -165,7 +167,7 @@ int ompi_comm_init(void)
opal_process_name_t name = {.vpid = i, .jobid = OMPI_PROC_MY_NAME->jobid}; opal_process_name_t name = {.vpid = i, .jobid = OMPI_PROC_MY_NAME->jobid};
/* get desired rank from agent (must be within size!)*/ /* get desired rank from agent (must be within size!)*/
// TODO: Change int to size_t // TODO: Change int to size_t
size_t desired_rank = getProcessAgentRank(name.jobid, size); size_t desired_rank = getProcessAgentRank(name.jobid, name.vpid, size);
printf("INIT Loop Rank: %zu\n", desired_rank); printf("INIT Loop Rank: %zu\n", desired_rank);
/* look for existing ompi_proc_t that matches this name */ /* 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[desired_rank] = (ompi_proc_t *) ompi_proc_lookup (name);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment