Discussion:
[OMPI users] valgrind invalid read
Yann Jobic
2016-11-18 12:34:51 UTC
Permalink
Hi,

I'm using valgrind 3.12 with openmpi 2.0.1.
The code simply send an integer to another process with :
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>

int main (int argc, char **argv) {
const int tag = 13;
int size, rank;

MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);

if (size < 2) {
fprintf(stderr,"Requires at least two processes.\n");
exit(-1);
}

MPI_Comm_rank(MPI_COMM_WORLD, &rank);

if (rank == 0) {
int i=3;
const int dest = 1;

MPI_Send(&i, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);

printf("Rank %d: sent int\n", rank);
}
if (rank == 1) {
int j;
const int src=0;
MPI_Status status;

MPI_Recv(&j, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
printf("Rank %d: Received: int = %d\n", rank,j);
}

MPI_Finalize();

return 0;
}


I'm getting the error :
valgrind MPI wrappers 46313: Active for pid 46313
valgrind MPI wrappers 46313: Try MPIWRAP_DEBUG=help for possible options
valgrind MPI wrappers 46314: Active for pid 46314
valgrind MPI wrappers 46314: Try MPIWRAP_DEBUG=help for possible options
Rank 0: sent int
==46314== Invalid read of size 4
==46314== at 0x400A3D: main (basic.c:33)
==46314== Address 0xffefff594 is on thread 1's stack
==46314== in frame #0, created by main (basic.c:5)
==46314==
Rank 1: Received: int = 3

The invalid read is at the printf line.

Do you have any clue of why am i getting it ?

I ran the code with :
LD_PRELOAD=$prefix/lib/valgrind/libmpiwrap-amd64-linux.so mpirun -np 2
$prefix/bin/valgrind ./exe

Thanks in advance,

Yann

---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Gilles Gouaillardet
2016-11-21 23:50:06 UTC
Permalink
Yann,


this is a bug that was previously reported, and the fix is pending on
review.

meanwhile, you can manually apply the patch available at
https://github.com/open-mpi/ompi/pull/2418


Cheers,


Gilles
Post by Yann Jobic
Hi,
I'm using valgrind 3.12 with openmpi 2.0.1.
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int main (int argc, char **argv) {
const int tag = 13;
int size, rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size < 2) {
fprintf(stderr,"Requires at least two processes.\n");
exit(-1);
}
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
int i=3;
const int dest = 1;
MPI_Send(&i, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
printf("Rank %d: sent int\n", rank);
}
if (rank == 1) {
int j;
const int src=0;
MPI_Status status;
MPI_Recv(&j, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
printf("Rank %d: Received: int = %d\n", rank,j);
}
MPI_Finalize();
return 0;
}
valgrind MPI wrappers 46313: Active for pid 46313
valgrind MPI wrappers 46313: Try MPIWRAP_DEBUG=help for possible options
valgrind MPI wrappers 46314: Active for pid 46314
valgrind MPI wrappers 46314: Try MPIWRAP_DEBUG=help for possible options
Rank 0: sent int
==46314== Invalid read of size 4
==46314== at 0x400A3D: main (basic.c:33)
==46314== Address 0xffefff594 is on thread 1's stack
==46314== in frame #0, created by main (basic.c:5)
==46314==
Rank 1: Received: int = 3
The invalid read is at the printf line.
Do you have any clue of why am i getting it ?
LD_PRELOAD=$prefix/lib/valgrind/libmpiwrap-amd64-linux.so mpirun -np
2 $prefix/bin/valgrind ./exe
Thanks in advance,
Yann
---
L'absence de virus dans ce courrier électronique a été vérifiée par le
logiciel antivirus Avast.
https://www.avast.com/antivirus
_______________________________________________
users mailing list
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Yann Jobic
2016-11-22 11:33:17 UTC
Permalink
Hi,

I manually changed the file. Moreover i also tried the 1.8.4 openmpi
version.

I still have this invalid read.

Am i doing something wrong ?

Thanks,

Yann
Post by Gilles Gouaillardet
Yann,
this is a bug that was previously reported, and the fix is pending on
review.
meanwhile, you can manually apply the patch available at
https://github.com/open-mpi/ompi/pull/2418
Cheers,
Gilles
Post by Yann Jobic
Hi,
I'm using valgrind 3.12 with openmpi 2.0.1.
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int main (int argc, char **argv) {
const int tag = 13;
int size, rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size < 2) {
fprintf(stderr,"Requires at least two processes.\n");
exit(-1);
}
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
int i=3;
const int dest = 1;
MPI_Send(&i, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
printf("Rank %d: sent int\n", rank);
}
if (rank == 1) {
int j;
const int src=0;
MPI_Status status;
MPI_Recv(&j, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
printf("Rank %d: Received: int = %d\n", rank,j);
}
MPI_Finalize();
return 0;
}
valgrind MPI wrappers 46313: Active for pid 46313
valgrind MPI wrappers 46313: Try MPIWRAP_DEBUG=help for possible options
valgrind MPI wrappers 46314: Active for pid 46314
valgrind MPI wrappers 46314: Try MPIWRAP_DEBUG=help for possible options
Rank 0: sent int
==46314== Invalid read of size 4
==46314== at 0x400A3D: main (basic.c:33)
==46314== Address 0xffefff594 is on thread 1's stack
==46314== in frame #0, created by main (basic.c:5)
==46314==
Rank 1: Received: int = 3
The invalid read is at the printf line.
Do you have any clue of why am i getting it ?
LD_PRELOAD=$prefix/lib/valgrind/libmpiwrap-amd64-linux.so mpirun -np
2 $prefix/bin/valgrind ./exe
Thanks in advance,
Yann
---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus
Gilles Gouaillardet
2016-11-22 14:12:56 UTC
Permalink
Yann,

my bad, the patch you need is at
https://github.com/open-mpi/ompi/pull/2368.patch

sorry for the confusion,

Gilles
Post by Yann Jobic
Hi,
I manually changed the file. Moreover i also tried the 1.8.4 openmpi
version.
I still have this invalid read.
Am i doing something wrong ?
Thanks,
Yann
Post by Gilles Gouaillardet
Yann,
this is a bug that was previously reported, and the fix is pending on
review.
meanwhile, you can manually apply the patch available at
https://github.com/open-mpi/ompi/pull/2418
Cheers,
Gilles
Post by Yann Jobic
Hi,
I'm using valgrind 3.12 with openmpi 2.0.1.
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int main (int argc, char **argv) {
const int tag = 13;
int size, rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (size < 2) {
fprintf(stderr,"Requires at least two processes.\n");
exit(-1);
}
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if (rank == 0) {
int i=3;
const int dest = 1;
MPI_Send(&i, 1, MPI_INT, dest, tag, MPI_COMM_WORLD);
printf("Rank %d: sent int\n", rank);
}
if (rank == 1) {
int j;
const int src=0;
MPI_Status status;
MPI_Recv(&j, 1, MPI_INT, src, tag, MPI_COMM_WORLD, &status);
printf("Rank %d: Received: int = %d\n", rank,j);
}
MPI_Finalize();
return 0;
}
valgrind MPI wrappers 46313: Active for pid 46313
valgrind MPI wrappers 46313: Try MPIWRAP_DEBUG=help for possible options
valgrind MPI wrappers 46314: Active for pid 46314
valgrind MPI wrappers 46314: Try MPIWRAP_DEBUG=help for possible options
Rank 0: sent int
==46314== Invalid read of size 4
==46314== at 0x400A3D: main (basic.c:33)
==46314== Address 0xffefff594 is on thread 1's stack
==46314== in frame #0, created by main (basic.c:5)
==46314==
Rank 1: Received: int = 3
The invalid read is at the printf line.
Do you have any clue of why am i getting it ?
LD_PRELOAD=$prefix/lib/valgrind/libmpiwrap-amd64-linux.so mpirun -np 2
$prefix/bin/valgrind ./exe
Thanks in advance,
Yann
---
L'absence de virus dans ce courrier électronique a été vérifiée par le
logiciel antivirus Avast.
https://www.avast.com/antivirus
_______________________________________________
users mailing list
https://rfd.newmexicoconsortium.org/mailman/listinfo/users
Loading...