Hi all,
I am trying to test the bandwidth of intra-MPI send and recv. The code is
attached here. When I give the input 2048 (namely each process will send
and receive 2GB data), the program reported:
Read 2147479552, expected 2147483648, errno = 95
Read 2147479552, expected 2147483648, errno = 98
Read 2147479552, expected 2147483648, errno = 98
Read 2147479552, expected 2147483648, errno = 98

Does this mean Openmpi does not support the send and recv where data size
is larger than 2GB, or is there a bug in my code? Thank you.
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#include <sys/types.h>
#include <unistd.h>


int main(int argc, char *argv[]) {
	int count;
	float voltage;
	int *in;
	int i;
	int rank, size;

	MPI_Init(&argc, &argv);
	MPI_Comm_size(MPI_COMM_WORLD, &size);
	MPI_Comm_rank(MPI_COMM_WORLD, &rank);
	long mb = atol(argv[1]);
	count = mb / 4 * 1024 * 1024;
	in = (int *)malloc( count * sizeof(int));
	for (i = 0; i < count; i++) {
		*(in + i) = i;
	}
	MPI_Barrier(MPI_COMM_WORLD);
	float time = MPI_Wtime();
	if ((rank & 1) == 0) {
		MPI_Send(in, count, MPI_INT, rank + 1, 0, MPI_COMM_WORLD);
	} else {
		MPI_Status status;
		MPI_Recv(in, count, MPI_INT, rank - 1, 0, MPI_COMM_WORLD, &status);
	}

	if ((rank & 1) == 1) {
		MPI_Send(in, count, MPI_INT, rank - 1, 0, MPI_COMM_WORLD);
	} else {
		MPI_Status status;
		MPI_Recv(in, count, MPI_INT, rank + 1, 0, MPI_COMM_WORLD, &status);
	}

	time = MPI_Wtime() - time;
	free( in );
	MPI_Finalize();
	return 0;
}
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to