Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Master Thesis Custom OMPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
becker29
Master Thesis Custom OMPI
Commits
25bae045
Commit
25bae045
authored
1 year ago
by
René Pascal Becker
Browse files
Options
Downloads
Patches
Plain Diff
Update test
parent
b8ba9249
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rank-swapper-agent/hello_c.c
+11
-39
11 additions, 39 deletions
rank-swapper-agent/hello_c.c
with
11 additions
and
39 deletions
rank-swapper-agent/hello_c.c
+
11
−
39
View file @
25bae045
...
...
@@ -25,40 +25,7 @@ extern char **environ;
* 3: Spawn 3 processes in one (shared) job
* 0 or other: Do not spawn a dynamic process/job
*/
#define SPAWN_MODE 3
void
errorExit
(
char
*
msg
);
/*void notifyProcessAgent(pid_t pid, int rank, const char *eventInfo) {
struct sockaddr_un strAddr;
socklen_t lenAddr;
int fdSock;
if ((fdSock=socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
errorExit("socket");
}
strAddr.sun_family=AF_LOCAL; // Unix domain
strcpy(strAddr.sun_path, SOCKET_PATH);
lenAddr=sizeof(strAddr.sun_family)+strlen(strAddr.sun_path);
if (connect(fdSock, (struct sockaddr*)&strAddr, lenAddr) !=0 ) {
errorExit("connect");
}
char info2Send[BUFFLEN];
snprintf(info2Send, BUFFLEN+1, "%s: %d, %d", eventInfo, pid, rank);
if (send(fdSock, info2Send, BUFFLEN+1, 0) < 0) {
errorExit("send");
}
printf("\nData send!\n");
char rank2Recv[BUFFLEN];
recv(fdSock, rank2Recv, BUFFLEN+1, 0);
int receivedNumber = (int)strtol(rank2Recv, NULL, 0);
printf("Received from server: %d\n", receivedNumber);
close(fdSock);
}*/
#define SPAWN_MODE 1
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -96,8 +63,8 @@ int main(int argc, char *argv[])
// https://mpi.deino.net/mpi_functions/MPI_Comm_spawn.html
if
(
1
==
SPAWN_MODE
)
{
int
np
=
1
;
int
errcodes
[
1
];
int
np
=
2
;
int
errcodes
[
2
];
MPI_Comm
parentcomm
,
intercomm
;
MPI_Comm_get_parent
(
&
parentcomm
);
if
(
parentcomm
==
MPI_COMM_NULL
)
{
...
...
@@ -119,12 +86,13 @@ int main(int argc, char *argv[])
int
np
=
1
;
int
errcodes
[
1
];
MPI_Comm
parentcomm
,
intercomm
;
MPI_Comm
parentcomm
;
MPI_Comm
intercomm
[
2
];
MPI_Comm_get_parent
(
&
parentcomm
);
if
(
parentcomm
==
MPI_COMM_NULL
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
MPI_Comm_spawn
(
"/home/ompi/rank-swapper-agent/hello"
,
MPI_ARGV_NULL
,
np
,
MPI_INFO_NULL
,
0
,
MPI_COMM_WORLD
,
&
intercomm
,
errcodes
);
MPI_INFO_NULL
,
0
,
MPI_COMM_WORLD
,
&
intercomm
[
i
]
,
errcodes
);
if
(
0
!=
errcodes
[
0
])
{
printf
(
"ERROR_SPAWN: code: %d
\n
"
,
errcodes
[
0
]);
fflush
(
stdout
);
...
...
@@ -165,7 +133,11 @@ int main(int argc, char *argv[])
}
}
sleep
(
5
);
// printf("Sleeping.\n");
// fflush(stdout);
// sleep(5);
// printf("Done sleeping.\n");
// fflush(stdout);
MPI_Finalize
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment