Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-16 Thread Jeff Squyres (jsquyres)
FWIW, I can replicate the behavior with gfortran 4.7.2:

- program runs "fine" with no MPI_Init/MPI_Finalize
- program dumps core when MPI_Init/MPI_Finalize are called (at the "conc = [ 
xx, yy ]" statement)

I notice that even if I disable Open MPI's memory hooking, the coredump still 
occurs.

Sidenote: there's a few ways to disable OMPI's memory hooking; one of the 
easiest is to set the environment variable FAKEROOTKEY to any value, because 
OMPI disables its memory hooking in Debian Fakeroot environments.  For example:

-
% setenv FAKEROOTKEY 0
% mpifort -g arrays.f90 && ./a.out
*** glibc detected *** ./a.out: free(): invalid pointer: 0x00369ef9cf48 ***
...etc.
-

Specifically: with OMPI's memory hooking disabled, we don't modify the behavior 
of malloc/free/memalign/realloc.

I'm not sure what Open MPI is doing to anger the gfortran gods, but I did note 
that when I run the program without MPI_Init/MPI_Finalize, valgrind complains:

-
==7269== Conditional jump or move depends on uninitialised value(s)
==7269==at 0x4015B0: MAIN__ (arrays.f90:20)
==7269==by 0x401795: main (arrays.f90:26)
-

Line 20 is the "conc = [ xx, yy ]" statement.

I'm not enough of a Fortran guru to know what that means (to my eyes, xx and yy 
were just initialized above that -- perhaps it's complaining about conc?), but 
there you go.  :-)



On Jan 14, 2013, at 6:08 AM, Stefan Mauerberger  
wrote:

> Well, I missed to emphasize one thing: It is my intension to exploit
> F2003's lhs-(re)allocate feature. Meaning, it is totally legal in F03 to
> write something like that:
> integer, allocatable :: array(:)
> array = [ 1,2,3,4 ]
> array = [ 1 ]
> where 'array' gets automatically (re)allocated. One more thing I should
> mention: In case 'array' is manually allocate, everything is fine.
> 
> Ok, lets do a little case study and make my suggested minimal example a
> little more exhaustive:
> PROGRAM main
> 
>IMPLICIT NONE 
>!INCLUDE 'mpif.h'
> 
>INTEGER :: ierr 
> 
>TYPE :: test_typ
>REAL, ALLOCATABLE :: a(:)
>END TYPE
> 
>TYPE(test_typ) :: xx, yy
>TYPE(test_typ), ALLOCATABLE :: conc(:)
> 
>!CALL mpi_init( ierr )
> 
>xx = test_typ( a=[1.0] )
>yy = test_typ( a=[2.0,1.0] )
> 
>conc = [ xx, yy ]
> 
>WRITE(*,*) SIZE(conc)
> 
>!CALL mpi_finalize( ierr )
> 
> END PROGRAM main 
> Note: For the beginning all MPI-stuff is commented out; xx and yy are
> initialized and their member-variable 'a' is allocated. 
> 
> For now, assume it as purely serial. That piece of code complies and
> runs properly with: 
> * gfortran 4.7.1, 4.7.2 and 4.8.0 (experimental)
> * ifort 12.1 and 13.0 (-assume realloc_lhs)
> * nagfort 5.3
> On the contrary it terminates, throwing a segfault, with
> * pgfortran 12.9
> Well, for the following lets simply drop PGI. In addition, according to
> 'The Fortran 2003 Handbook' published by Springer in 2009, the
> usage of the array constructor [...] is appropriate and valid. 
> 
> As a second step lets try to compile and run it invoking OMPI, just
> considering INCLUDE 'mpif.h':
> * gfortran: all right 
> * ifort: all right
> * nagfor: all right
> 
> Finally, lets initialize MPI by calling MPI_Init() and MPI_Finalize():
> * gfortran + OMPI: *** glibc detected *** ./a.out: free(): invalid
> pointer ...
> * gfortran + Intel-MPI: *** glibc detected *** ./a.out: free(): invalid
> pointer ...
> * ifort + OMPI: all right 
> * nagfor + OMPI: all right (-thread_safe)
> 
> Well, you are right, this is a very strong indication to blame gfortran
> for that!  However, it gets even more confusing. Instead of linking
> against OMPI, the following results are obtained by invoking IBM's MPI
> implementation:
> * gfortran + IBM-MPI: all right
> * ifort + IBM-MPI: all right 
> Isn't that weired? 
> 
> Any suggestions? Might it be useful to submit a bug-report to GCC
> developers? 
> 
> Cheers, 
> Stefan 
> 
> 
> ___
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users


-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/




Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-15 Thread Gus Correa

Hi Hristo, Stefan

This is more Fortran than MPI or OpenMPI, but anyway ...

Thank you for clarifying the point on F2003 automatic 
allocation/reallocation.

What was illegal in the 20th century
became legal in the new millenium,
at least when it comes to Fortran.


I confess I have to read each sentence in Metcalf's book
several times to try to understand the nifty new Matlabish
syntax and the semantics of 21st century Fortran ..., and alas,
I am still interpreting it wrong.
The only consolation is that even the Gnu compiler seems to be
in my boat!  :)

I don't know how much is gained by concatenating arrays that don't
exist yet (or objects that have an allocatable but not yet allocated
array as their single component), and how much memory management 
contortion and fragmentation this may perhaps entail,

but there may be some advantage to it.

Stefan reports that if he allocates explicitly the arrays,
"everything is fine".
So, why not?  :)
At least for portability, as it would allow compilation with
compilers that are not yet fully F2003 compliant,
older F90 compilers, etc.

I may be wrong, but my recollection from a situation that
happened here years ago,
and which may bear some similarity to the problem reported by Stefan,
is that Intel ifort would assign one memory word to
allocatable arrays, even before they were actually allocated,
so that you could have a cavalier approach and refer to those
arrays in the RHS of equations at any time,
whereas Gnu gfortran required explicit memory allocation before
those arrays were used.
At that point the ifort behavior seemed to be a lenient extension,
whereas the gfortran behavior a more strict compliance to the standard
(which was still F90 or F95 then, IIRR).
However, this may have changed on more recent versions of those
compilers, and also to conform with more recent versions of the Fortran
standard.

Thank you,
Gus Correa

On 01/14/2013 04:48 AM, Iliev, Hristo wrote:

Hi, Gus,

Automatic allocation (an reallocation) on assignment is among the nifty
features of Fortran 2003. In this case "conc" is automatically allocated so
to match the shape of its initialiser array "[ xx, yy ]". Note that "xx" and
"yy" are not allocatable though their derived type has an allocatable
element.

Kind regards,
Hristo Iliev


-Original Message-
From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org]
On Behalf Of Gus Correa
Sent: Friday, January 11, 2013 7:19 PM
To: Open MPI Users
Subject: Re: [OMPI users] Initializing OMPI with invoking the array
constructor on Fortran derived types causes the executable to crash

Hi Stefan

Don't you need to allocate xx, yy and conc, before you use them?
In the short program below, they are declared as allocatable, but not

actually

allocated.

I hope this helps,
Gus Correa

On 01/11/2013 09:58 AM, Stefan Mauerberger wrote:

Dear Paul!

Thanks for your reply. This problem seems to get complicated.

Unfortunately, I can not reproduce what you are describing. I tried
with some GCCs as 4.7.1, 4.7.2 and 4.8.0 (20121008). As you suggested,
replacing the MPI_Init and MPI_Finalize calls with WRITE(*,*) "f"
and commenting out use mpi, everything is just fine. No segfault no
core dump, just the result as I expect it (I put a write(*,*)
size(conc) in, which must print 2). I simply compiled with a bare
mpif90 ... and executed typing mpirun -np 1 ./a.out .
I also tried on three different architectures - all 64-bit - and, as
soon as MPI_Init is invoked, the program gets core dumped.

I also tried with IBM's MPI implementation just with the difference
using include 'mpif.h' instead of use mpi. Everything is fine and the
result is as in serial runs.

Well, it's not surprising that 4.4.x has its problems. Using modern
Fortran as F03, GCC in a version younger than  4.7.x is just mandatory.

Cheers,
Stefan



On Fri, 2013-01-11 at 14:26 +0100, Paul Kapinos wrote:

This is hardly an Open MPI issue:

switch the calls to MPI_Init, MPI_Finalize against
WRITE(*,*) "f"
comment aut 'USE mpi'  an see your error (SIGSEGV) again, now
without any MPI part in the program.
So my suspiction is this is an bug in your GCC version. Especially
because there is no SIGSEGV using 4.7.2 GCC (whereby it crasehs using
4.4.6)

==>   Update your compilers!


On 01/11/13 14:01, Stefan Mauerberger wrote:

Hi There!

First of all, this is my first post here. In case I am doing
something inappropriate pleas be soft with me. On top of that I am
not quite sure whether that issue is related to Open MPI or GCC.

Regarding my problem: Well, it is a little bulky, see below. I could
figure out that the actual crash is caused by invoking Fortran's
array constructor [ xx, yy ] on derived-data-types xx and yy. The
one key factor is that those types have allocatable member variables.
Well, that fact points to blame gfortran for that. However, the
crash does not occur if MPI_Iinit is not called in before. Compiled
as a serial program everything works perfectly fine. I 

Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-14 Thread Iliev, Hristo
Some MPI libraries (including OMPI and IMPI) hook the system memory
management routines like 'malloc' and 'free' (used behind the scenes by
Fortran on Unix). This is usually performed in order to manage memory
registration for RDMA-based networks like InfiniBand. I would guess that
Open MPI installs these hooks at the time when MPI_INIT is called and that's
why you see the problem after MPI_INIT was called but not if the call is
commented out.

Could you try to run your serial program in Valgrind and see if it reports
any erroneous memory access attempts? It could be that GCC's implementation
of the automatic allocation is broken and that OMPI's intervention in the
memory management process only exposes an already existing problem.

Kind regards,
Hristo

> -Original Message-
> From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org]
> On Behalf Of Stefan Mauerberger
> Sent: Monday, January 14, 2013 12:08 PM
> To: us...@open-mpi.org
> Subject: Re: [OMPI users] Initializing OMPI with invoking the array
> constructor on Fortran derived types causes the executable to crash
> 
> Well, I missed to emphasize one thing: It is my intension to exploit
F2003's
> lhs-(re)allocate feature. Meaning, it is totally legal in F03 to write
something
> like that:
> integer, allocatable :: array(:)
> array = [ 1,2,3,4 ]
> array = [ 1 ]
> where 'array' gets automatically (re)allocated. One more thing I should
> mention: In case 'array' is manually allocate, everything is fine.
> 
> Ok, lets do a little case study and make my suggested minimal example a
little
> more exhaustive:
> PROGRAM main
> 
> IMPLICIT NONE
> !INCLUDE 'mpif.h'
> 
> INTEGER :: ierr
> 
> TYPE :: test_typ
> REAL, ALLOCATABLE :: a(:)
> END TYPE
> 
> TYPE(test_typ) :: xx, yy
> TYPE(test_typ), ALLOCATABLE :: conc(:)
> 
> !CALL mpi_init( ierr )
> 
> xx = test_typ( a=[1.0] )
> yy = test_typ( a=[2.0,1.0] )
> 
> conc = [ xx, yy ]
> 
> WRITE(*,*) SIZE(conc)
> 
> !CALL mpi_finalize( ierr )
> 
> END PROGRAM main
> Note: For the beginning all MPI-stuff is commented out; xx and yy are
> initialized and their member-variable 'a' is allocated.
> 
> For now, assume it as purely serial. That piece of code complies and runs
> properly with:
>  * gfortran 4.7.1, 4.7.2 and 4.8.0 (experimental)
>  * ifort 12.1 and 13.0 (-assume realloc_lhs)
>  * nagfort 5.3
> On the contrary it terminates, throwing a segfault, with
>  * pgfortran 12.9
> Well, for the following lets simply drop PGI. In addition, according to
'The
> Fortran 2003 Handbook' published by Springer in 2009, the usage of the
array
> constructor [...] is appropriate and valid.
> 
> As a second step lets try to compile and run it invoking OMPI, just
considering
> INCLUDE 'mpif.h':
>  * gfortran: all right
>  * ifort: all right
>  * nagfor: all right
> 
> Finally, lets initialize MPI by calling MPI_Init() and MPI_Finalize():
>  * gfortran + OMPI: *** glibc detected *** ./a.out: free(): invalid
pointer ...
>  * gfortran + Intel-MPI: *** glibc detected *** ./a.out: free(): invalid
pointer
> ...
>  * ifort + OMPI: all right
>  * nagfor + OMPI: all right (-thread_safe)
> 
> Well, you are right, this is a very strong indication to blame gfortran
for that!
> However, it gets even more confusing. Instead of linking against OMPI, the
> following results are obtained by invoking IBM's MPI
> implementation:
>  * gfortran + IBM-MPI: all right
>  * ifort + IBM-MPI: all right
> Isn't that weired?
> 
> Any suggestions? Might it be useful to submit a bug-report to GCC
> developers?
> 
> Cheers,
> Stefan
> 
> 
> ___
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users


--
Hristo Iliev, Ph.D. -- High Performance Computing
RWTH Aachen University, Center for Computing and Communication
Rechen- und Kommunikationszentrum der RWTH Aachen
Seffenter Weg 23,  D 52074  Aachen (Germany)


smime.p7s
Description: S/MIME cryptographic signature


Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-14 Thread Stefan Mauerberger
Well, I missed to emphasize one thing: It is my intension to exploit
F2003's lhs-(re)allocate feature. Meaning, it is totally legal in F03 to
write something like that:
integer, allocatable :: array(:)
array = [ 1,2,3,4 ]
array = [ 1 ]
where 'array' gets automatically (re)allocated. One more thing I should
mention: In case 'array' is manually allocate, everything is fine.

Ok, lets do a little case study and make my suggested minimal example a
little more exhaustive:
PROGRAM main

IMPLICIT NONE 
!INCLUDE 'mpif.h'

INTEGER :: ierr 

TYPE :: test_typ
REAL, ALLOCATABLE :: a(:)
END TYPE

TYPE(test_typ) :: xx, yy
TYPE(test_typ), ALLOCATABLE :: conc(:)

!CALL mpi_init( ierr )

xx = test_typ( a=[1.0] )
yy = test_typ( a=[2.0,1.0] )

conc = [ xx, yy ]

WRITE(*,*) SIZE(conc)

!CALL mpi_finalize( ierr )

END PROGRAM main 
Note: For the beginning all MPI-stuff is commented out; xx and yy are
initialized and their member-variable 'a' is allocated. 

For now, assume it as purely serial. That piece of code complies and
runs properly with: 
 * gfortran 4.7.1, 4.7.2 and 4.8.0 (experimental)
 * ifort 12.1 and 13.0 (-assume realloc_lhs)
 * nagfort 5.3
On the contrary it terminates, throwing a segfault, with
 * pgfortran 12.9
Well, for the following lets simply drop PGI. In addition, according to
'The Fortran 2003 Handbook' published by Springer in 2009, the
usage of the array constructor [...] is appropriate and valid. 

As a second step lets try to compile and run it invoking OMPI, just
considering INCLUDE 'mpif.h':
 * gfortran: all right 
 * ifort: all right
 * nagfor: all right

Finally, lets initialize MPI by calling MPI_Init() and MPI_Finalize():
 * gfortran + OMPI: *** glibc detected *** ./a.out: free(): invalid
pointer ...
 * gfortran + Intel-MPI: *** glibc detected *** ./a.out: free(): invalid
pointer ...
 * ifort + OMPI: all right 
 * nagfor + OMPI: all right (-thread_safe)

Well, you are right, this is a very strong indication to blame gfortran
for that!  However, it gets even more confusing. Instead of linking
against OMPI, the following results are obtained by invoking IBM's MPI
implementation:
 * gfortran + IBM-MPI: all right
 * ifort + IBM-MPI: all right 
Isn't that weired? 

Any suggestions? Might it be useful to submit a bug-report to GCC
developers? 

Cheers, 
Stefan 




Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-14 Thread Iliev, Hristo
Hi, Gus,

Automatic allocation (an reallocation) on assignment is among the nifty
features of Fortran 2003. In this case "conc" is automatically allocated so
to match the shape of its initialiser array "[ xx, yy ]". Note that "xx" and
"yy" are not allocatable though their derived type has an allocatable
element.

Kind regards,
Hristo Iliev

> -Original Message-
> From: users-boun...@open-mpi.org [mailto:users-boun...@open-mpi.org]
> On Behalf Of Gus Correa
> Sent: Friday, January 11, 2013 7:19 PM
> To: Open MPI Users
> Subject: Re: [OMPI users] Initializing OMPI with invoking the array
> constructor on Fortran derived types causes the executable to crash
> 
> Hi Stefan
> 
> Don't you need to allocate xx, yy and conc, before you use them?
> In the short program below, they are declared as allocatable, but not
actually
> allocated.
> 
> I hope this helps,
> Gus Correa
> 
> On 01/11/2013 09:58 AM, Stefan Mauerberger wrote:
> > Dear Paul!
> >
> > Thanks for your reply. This problem seems to get complicated.
> >
> > Unfortunately, I can not reproduce what you are describing. I tried
> > with some GCCs as 4.7.1, 4.7.2 and 4.8.0 (20121008). As you suggested,
> > replacing the MPI_Init and MPI_Finalize calls with WRITE(*,*) "f"
> > and commenting out use mpi, everything is just fine. No segfault no
> > core dump, just the result as I expect it (I put a write(*,*)
> > size(conc) in, which must print 2). I simply compiled with a bare
> > mpif90 ... and executed typing mpirun -np 1 ./a.out .
> > I also tried on three different architectures - all 64-bit - and, as
> > soon as MPI_Init is invoked, the program gets core dumped.
> >
> > I also tried with IBM's MPI implementation just with the difference
> > using include 'mpif.h' instead of use mpi. Everything is fine and the
> > result is as in serial runs.
> >
> > Well, it's not surprising that 4.4.x has its problems. Using modern
> > Fortran as F03, GCC in a version younger than  4.7.x is just mandatory.
> >
> > Cheers,
> > Stefan
> >
> >
> >
> > On Fri, 2013-01-11 at 14:26 +0100, Paul Kapinos wrote:
> >> This is hardly an Open MPI issue:
> >>
> >> switch the calls to MPI_Init, MPI_Finalize against
> >> WRITE(*,*) "f"
> >> comment aut 'USE mpi'  an see your error (SIGSEGV) again, now
> >> without any MPI part in the program.
> >> So my suspiction is this is an bug in your GCC version. Especially
> >> because there is no SIGSEGV using 4.7.2 GCC (whereby it crasehs using
> >> 4.4.6)
> >>
> >> ==>  Update your compilers!
> >>
> >>
> >> On 01/11/13 14:01, Stefan Mauerberger wrote:
> >>> Hi There!
> >>>
> >>> First of all, this is my first post here. In case I am doing
> >>> something inappropriate pleas be soft with me. On top of that I am
> >>> not quite sure whether that issue is related to Open MPI or GCC.
> >>>
> >>> Regarding my problem: Well, it is a little bulky, see below. I could
> >>> figure out that the actual crash is caused by invoking Fortran's
> >>> array constructor [ xx, yy ] on derived-data-types xx and yy. The
> >>> one key factor is that those types have allocatable member variables.
> >>> Well, that fact points to blame gfortran for that. However, the
> >>> crash does not occur if MPI_Iinit is not called in before. Compiled
> >>> as a serial program everything works perfectly fine. I am pretty
> >>> sure, the lines I wrote are valid F2003 code.
> >>>
> >>> Here is a minimal working example:
> >>> PROGRAM main
> >>>   USE mpi
> >>>
> >>>   IMPLICIT NONE
> >>>
> >>>   INTEGER :: ierr
> >>>
> >>>   TYPE :: test_typ
> >>>   REAL, ALLOCATABLE :: a(:)
> >>>   END TYPE
> >>>
> >>>   TYPE(test_typ) :: xx, yy
> >>>   TYPE(test_typ), ALLOCATABLE :: conc(:)
> >>>
> >>>   CALL mpi_init( ierr )
> >>>
> >>>   conc = [ xx, yy ]
> >>>
> >>>   CALL mpi_finalize( ierr )
> >>>
> >>> END PROGRAM main
> >>> Just compile with mpif90 ... and execute leads to:
>  *** glibc detected *** ./a.out: free(): invalid pointer:
>  0x7fefd2a147f8 *** === Backtrace: =
>  /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fefd26dab96]
>  ./a.out[0x400fdb]
>  ./a.out(main+0x34)[0x401132]
>  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefd267d
>  76d]
>  ./a.out[0x400ad9]
> >>> With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything
> seems to be fine.
> >>>
> >>> What do you think: Is this a OMPI or a GCC related bug?
> >>>
> >>> Cheers,
> >>> Stefan
> >>>
> >>>
> >>> ___
> >>> users mailing list
> >>> us...@open-mpi.org
> >>> http://www.open-mpi.org/mailman/listinfo.cgi/users
> >>>
> >>
> >>
> >
> >
> > ___
> > users mailing list
> > us...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
> 
> ___
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users
--
Hristo 

Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-11 Thread Gus Correa

Hi Stefan

Don't you need to allocate xx, yy and conc, before you use them?
In the short program below, they are declared as allocatable,
but not actually allocated.

I hope this helps,
Gus Correa

On 01/11/2013 09:58 AM, Stefan Mauerberger wrote:

Dear Paul!

Thanks for your reply. This problem seems to get complicated.

Unfortunately, I can not reproduce what you are describing. I tried with
some GCCs as 4.7.1, 4.7.2 and 4.8.0 (20121008). As you suggested,
replacing the MPI_Init and MPI_Finalize calls with WRITE(*,*) "f"
and commenting out use mpi, everything is just fine. No segfault no core
dump, just the result as I expect it (I put a write(*,*) size(conc) in,
which must print 2). I simply compiled with a bare mpif90 ... and
executed typing mpirun -np 1 ./a.out .
I also tried on three different architectures - all 64-bit - and, as
soon as MPI_Init is invoked, the program gets core dumped.

I also tried with IBM's MPI implementation just with the difference
using include 'mpif.h' instead of use mpi. Everything is fine and the
result is as in serial runs.

Well, it's not surprising that 4.4.x has its problems. Using modern
Fortran as F03, GCC in a version younger than  4.7.x is just mandatory.

Cheers,
Stefan



On Fri, 2013-01-11 at 14:26 +0100, Paul Kapinos wrote:

This is hardly an Open MPI issue:

switch the calls to MPI_Init, MPI_Finalize against
WRITE(*,*) "f"
comment aut 'USE mpi'  an see your error (SIGSEGV) again, now without any
MPI part in the program.
So my suspiction is this is an bug in your GCC version. Especially because there
is no SIGSEGV using 4.7.2 GCC (whereby it crasehs using 4.4.6)

==>  Update your compilers!


On 01/11/13 14:01, Stefan Mauerberger wrote:

Hi There!

First of all, this is my first post here. In case I am doing something
inappropriate pleas be soft with me. On top of that I am not quite sure
whether that issue is related to Open MPI or GCC.

Regarding my problem: Well, it is a little bulky, see below. I could
figure out that the actual crash is caused by invoking Fortran's array
constructor [ xx, yy ] on derived-data-types xx and yy. The one key
factor is that those types have allocatable member variables.
Well, that fact points to blame gfortran for that. However, the crash
does not occur if MPI_Iinit is not called in before. Compiled as a
serial program everything works perfectly fine. I am pretty sure, the
lines I wrote are valid F2003 code.

Here is a minimal working example:
PROGRAM main
  USE mpi

  IMPLICIT NONE

  INTEGER :: ierr

  TYPE :: test_typ
  REAL, ALLOCATABLE :: a(:)
  END TYPE

  TYPE(test_typ) :: xx, yy
  TYPE(test_typ), ALLOCATABLE :: conc(:)

  CALL mpi_init( ierr )

  conc = [ xx, yy ]

  CALL mpi_finalize( ierr )

END PROGRAM main
Just compile with mpif90 ... and execute leads to:

*** glibc detected *** ./a.out: free(): invalid pointer: 0x7fefd2a147f8 ***
=== Backtrace: =
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fefd26dab96]
./a.out[0x400fdb]
./a.out(main+0x34)[0x401132]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefd267d76d]
./a.out[0x400ad9]

With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything seems to be 
fine.

What do you think: Is this a OMPI or a GCC related bug?

Cheers,
Stefan


___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users







___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users




Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-11 Thread Stefan Mauerberger
Dear Paul!

Thanks for your reply. This problem seems to get complicated. 

Unfortunately, I can not reproduce what you are describing. I tried with
some GCCs as 4.7.1, 4.7.2 and 4.8.0 (20121008). As you suggested,
replacing the MPI_Init and MPI_Finalize calls with WRITE(*,*) "f"
and commenting out use mpi, everything is just fine. No segfault no core
dump, just the result as I expect it (I put a write(*,*) size(conc) in,
which must print 2). I simply compiled with a bare mpif90 ... and
executed typing mpirun -np 1 ./a.out . 
I also tried on three different architectures - all 64-bit - and, as
soon as MPI_Init is invoked, the program gets core dumped.  

I also tried with IBM's MPI implementation just with the difference
using include 'mpif.h' instead of use mpi. Everything is fine and the
result is as in serial runs.

Well, it's not surprising that 4.4.x has its problems. Using modern
Fortran as F03, GCC in a version younger than  4.7.x is just mandatory. 

Cheers, 
Stefan 



On Fri, 2013-01-11 at 14:26 +0100, Paul Kapinos wrote:
> This is hardly an Open MPI issue:
> 
> switch the calls to MPI_Init, MPI_Finalize against
> WRITE(*,*) "f"
> comment aut 'USE mpi'  an see your error (SIGSEGV) again, now without any 
> MPI part in the program.
> So my suspiction is this is an bug in your GCC version. Especially because 
> there 
> is no SIGSEGV using 4.7.2 GCC (whereby it crasehs using 4.4.6)
> 
> ==> Update your compilers!
> 
> 
> On 01/11/13 14:01, Stefan Mauerberger wrote:
> > Hi There!
> >
> > First of all, this is my first post here. In case I am doing something
> > inappropriate pleas be soft with me. On top of that I am not quite sure
> > whether that issue is related to Open MPI or GCC.
> >
> > Regarding my problem: Well, it is a little bulky, see below. I could
> > figure out that the actual crash is caused by invoking Fortran's array
> > constructor [ xx, yy ] on derived-data-types xx and yy. The one key
> > factor is that those types have allocatable member variables.
> > Well, that fact points to blame gfortran for that. However, the crash
> > does not occur if MPI_Iinit is not called in before. Compiled as a
> > serial program everything works perfectly fine. I am pretty sure, the
> > lines I wrote are valid F2003 code.
> >
> > Here is a minimal working example:
> > PROGRAM main
> >  USE mpi
> >
> >  IMPLICIT NONE
> >
> >  INTEGER :: ierr
> >
> >  TYPE :: test_typ
> >  REAL, ALLOCATABLE :: a(:)
> >  END TYPE
> >
> >  TYPE(test_typ) :: xx, yy
> >  TYPE(test_typ), ALLOCATABLE :: conc(:)
> >
> >  CALL mpi_init( ierr )
> >
> >  conc = [ xx, yy ]
> >
> >  CALL mpi_finalize( ierr )
> >
> > END PROGRAM main
> > Just compile with mpif90 ... and execute leads to:
> >> *** glibc detected *** ./a.out: free(): invalid pointer: 
> >> 0x7fefd2a147f8 ***
> >> === Backtrace: =
> >> /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fefd26dab96]
> >> ./a.out[0x400fdb]
> >> ./a.out(main+0x34)[0x401132]
> >> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefd267d76d]
> >> ./a.out[0x400ad9]
> > With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything seems to 
> > be fine.
> >
> > What do you think: Is this a OMPI or a GCC related bug?
> >
> > Cheers,
> > Stefan
> >
> >
> > ___
> > users mailing list
> > us...@open-mpi.org
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
> >
> 
> 




Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-11 Thread Paul Kapinos

This is hardly an Open MPI issue:

switch the calls to MPI_Init, MPI_Finalize against
WRITE(*,*) "f"
comment aut 'USE mpi'  an see your error (SIGSEGV) again, now without any 
MPI part in the program.
So my suspiction is this is an bug in your GCC version. Especially because there 
is no SIGSEGV using 4.7.2 GCC (whereby it crasehs using 4.4.6)


==> Update your compilers!


On 01/11/13 14:01, Stefan Mauerberger wrote:

Hi There!

First of all, this is my first post here. In case I am doing something
inappropriate pleas be soft with me. On top of that I am not quite sure
whether that issue is related to Open MPI or GCC.

Regarding my problem: Well, it is a little bulky, see below. I could
figure out that the actual crash is caused by invoking Fortran's array
constructor [ xx, yy ] on derived-data-types xx and yy. The one key
factor is that those types have allocatable member variables.
Well, that fact points to blame gfortran for that. However, the crash
does not occur if MPI_Iinit is not called in before. Compiled as a
serial program everything works perfectly fine. I am pretty sure, the
lines I wrote are valid F2003 code.

Here is a minimal working example:
PROGRAM main
 USE mpi

 IMPLICIT NONE

 INTEGER :: ierr

 TYPE :: test_typ
 REAL, ALLOCATABLE :: a(:)
 END TYPE

 TYPE(test_typ) :: xx, yy
 TYPE(test_typ), ALLOCATABLE :: conc(:)

 CALL mpi_init( ierr )

 conc = [ xx, yy ]

 CALL mpi_finalize( ierr )

END PROGRAM main
Just compile with mpif90 ... and execute leads to:

*** glibc detected *** ./a.out: free(): invalid pointer: 0x7fefd2a147f8 ***
=== Backtrace: =
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fefd26dab96]
./a.out[0x400fdb]
./a.out(main+0x34)[0x401132]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefd267d76d]
./a.out[0x400ad9]

With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything seems to be 
fine.

What do you think: Is this a OMPI or a GCC related bug?

Cheers,
Stefan


___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users




--
Dipl.-Inform. Paul Kapinos   -   High Performance Computing,
RWTH Aachen University, Center for Computing and Communication
Seffenter Weg 23,  D 52074  Aachen (Germany)
Tel: +49 241/80-24915



smime.p7s
Description: S/MIME Cryptographic Signature


Re: [OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-11 Thread Jalel Chergui

Hi,

   Can you try to allocate conc array before inititialization ?

Regards,
Jalel
Le 11/01/2013 14:01, Stefan Mauerberger a écrit :

Hi There!

First of all, this is my first post here. In case I am doing something
inappropriate pleas be soft with me. On top of that I am not quite sure
whether that issue is related to Open MPI or GCC.

Regarding my problem: Well, it is a little bulky, see below. I could
figure out that the actual crash is caused by invoking Fortran's array
constructor [ xx, yy ] on derived-data-types xx and yy. The one key
factor is that those types have allocatable member variables.
Well, that fact points to blame gfortran for that. However, the crash
does not occur if MPI_Iinit is not called in before. Compiled as a
serial program everything works perfectly fine. I am pretty sure, the
lines I wrote are valid F2003 code.

Here is a minimal working example:
PROGRAM main
 USE mpi
 
 IMPLICIT NONE


 INTEGER :: ierr

 TYPE :: test_typ
 REAL, ALLOCATABLE :: a(:)
 END TYPE

 TYPE(test_typ) :: xx, yy
 TYPE(test_typ), ALLOCATABLE :: conc(:)

 CALL mpi_init( ierr )

 conc = [ xx, yy ]

 CALL mpi_finalize( ierr )
 
END PROGRAM main

Just compile with mpif90 ... and execute leads to:

*** glibc detected *** ./a.out: free(): invalid pointer: 0x7fefd2a147f8 ***
=== Backtrace: =
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fefd26dab96]
./a.out[0x400fdb]
./a.out(main+0x34)[0x401132]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefd267d76d]
./a.out[0x400ad9]

With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything seems to be 
fine.

What do you think: Is this a OMPI or a GCC related bug?

Cheers,
Stefan


___
users mailing list
us...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/users



--
**
 Jalel CHERGUI, LIMSI-CNRS, Bât. 508 - BP 133, 91403 Orsay cedex, FRANCE
 Tél: (33 1) 69 85 81 27 ; Télécopie: (33 1) 69 85 80 88
 Mél: jalel.cher...@limsi.fr ; Référence: http://perso.limsi.fr/chergui
**



[OMPI users] Initializing OMPI with invoking the array constructor on Fortran derived types causes the executable to crash

2013-01-11 Thread Stefan Mauerberger
Hi There! 

First of all, this is my first post here. In case I am doing something
inappropriate pleas be soft with me. On top of that I am not quite sure
whether that issue is related to Open MPI or GCC. 

Regarding my problem: Well, it is a little bulky, see below. I could
figure out that the actual crash is caused by invoking Fortran's array
constructor [ xx, yy ] on derived-data-types xx and yy. The one key
factor is that those types have allocatable member variables. 
Well, that fact points to blame gfortran for that. However, the crash
does not occur if MPI_Iinit is not called in before. Compiled as a
serial program everything works perfectly fine. I am pretty sure, the
lines I wrote are valid F2003 code. 

Here is a minimal working example:
PROGRAM main
USE mpi

IMPLICIT NONE 

INTEGER :: ierr

TYPE :: test_typ
REAL, ALLOCATABLE :: a(:)
END TYPE

TYPE(test_typ) :: xx, yy
TYPE(test_typ), ALLOCATABLE :: conc(:)

CALL mpi_init( ierr )

conc = [ xx, yy ]

CALL mpi_finalize( ierr )

END PROGRAM main 
Just compile with mpif90 ... and execute leads to:
> *** glibc detected *** ./a.out: free(): invalid pointer: 0x7fefd2a147f8 
> ***
> === Backtrace: =
> /lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7fefd26dab96]
> ./a.out[0x400fdb]
> ./a.out(main+0x34)[0x401132]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7fefd267d76d]
> ./a.out[0x400ad9]
With commenting out 'CALL MPI_Init' and 'MPI_Finalize' everything seems to be 
fine. 

What do you think: Is this a OMPI or a GCC related bug? 

Cheers, 
Stefan