[mvapich-discuss] Troubles when using MPI_Open_port
马凯
makailove123 at 163.com
Fri Apr 17 08:36:34 EDT 2015
I tried to use MPI_Open_port in my program, but when I run it, I got the error message as this:
[cli_0]: aborting job:
Fatal error in PMPI_Open_port:
Other MPI error, error stack:
PMPI_Open_port(123): MPI_Open_port(MPI_INFO_NULL, port=0x7fff87806ed0) failed
MPID_Open_port(70).: Function not implemented
Could some one give me some help?
Thanks!
This is my code:
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_DATA 1024
int main(int argc, char *argv[]) {
MPI_Comm client;
MPI_Status status;
char port_name[MPI_MAX_PORT_NAME];
double buf[MAX_DATA];
int size, again;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size != 1) {
printf("Server too big\n");
exit(EXIT_FAILURE);
}
MPI_Open_port(MPI_INFO_NULL, port_name);
printf("server available at %s\n", port_name);
while (1) {
MPI_Comm_accept(port_name, MPI_INFO_NULL, 0, MPI_COMM_WORLD, &client);
again = 1;
while (again) {
MPI_Recv(buf, MAX_DATA, MPI_DOUBLE, MPI_ANY_SOURCE, MPI_ANY_TAG, client, &status);
switch (status.MPI_TAG) {
case 0: MPI_Comm_free(&client);
MPI_Close_port(port_name);
MPI_Finalize();
return 0;
case 1: MPI_Comm_disconnect(&client);
again = 0;
break;
case 2: /* do something */
break;
default:
/* Unexpected message type */
MPI_Abort(MPI_COMM_WORLD, 1);
}
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cse.ohio-state.edu/pipermail/mvapich-discuss/attachments/20150417/8c60b9ef/attachment.html>
More information about the mvapich-discuss
mailing list