Discussion:
[OMPI users] fortran program with integer kind=8 using openmpi
William Au
2012-06-28 23:00:16 UTC
Permalink
Hi,

I try to compile my fortran program in linux with gfortran44 using option -fdefault-integer-8,
then all my integer will of kind=8.

My question is what should I do with openmpi? I am using 1.6, should I compile openmpi
with the same options? Will it get the correct size of MPI_INTEGER and MPI_INTEGER2?



Thanks.

Regards,

William
David Warren
2012-06-29 00:37:28 UTC
Permalink
You should not have to recompile openmpi, but you do have to use the
correct type. You can check the size of integers in your fortrana nd use
MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
then use mpi_int_type for the type in the calls
Post by William Au
Hi,
I try to compile my fortran program in linux with gfortran44 using
option -fdefault-integer-8,
then all my integer will of kind=8.
My question is what should I do with openmpi? I am using 1.6, should I compile openmpi
with the same options? Will it get the correct size of MPI_INTEGER and MPI_INTEGER2?
Thanks.
Regards,
William
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
Jeff Squyres
2012-06-29 11:03:18 UTC
Permalink
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
If you configure ompi with -fdefault-integer-8, then OMPI will assume that Fortran integers are always 8 bytes, so be sure to also compile all of your MPI applications the same way. Indeed, you may want to configure OMPI with something like:

./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8

This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.

Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
Secretan Yves
2012-06-29 16:46:17 UTC
Permalink
Hi,

Recompiling OpenMPI with

./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8

is the easy way to go (at least for me). Changes to the Fortran code are minimal. Be aware that the underlying C code is still with 32bit int, and that arguments like counts will be downcasted to int.

If you don't recompile OpenMPI, then you will have to adapt' if not already done, your Fortran code to reflect the types (kind=4) of communicators, types, error, sizes, rank, etc..

Yves Secretan
***@ete.inrs.ca

Avant d'imprimer, pensez à l'environnement


-----Message d'origine-----
De : users-***@open-mpi.org [mailto:users-***@open-mpi.org] De la part de Jeff Squyres
Envoyé : 29 juin 2012 07:03
À : ***@atmos.washington.edu; Open MPI Users
Objet : Re: [OMPI users] fortran program with integer kind=8 using openmpi
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
If you configure ompi with -fdefault-integer-8, then OMPI will assume that Fortran integers are always 8 bytes, so be sure to also compile all of your MPI applications the same way. Indeed, you may want to configure OMPI with something like:

./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8

This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.

Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
William Au
2012-06-29 23:15:11 UTC
Permalink
My concern is how do the C side know fortran integer using 8 bytes?
My valgrind check show something like:

==8482== Invalid read of size 8
==8482== at 0x5F4A50E: ompi_op_base_minloc_2integer (op_base_functions.c:631)
==8482== by 0xBF70DD1: ompi_coll_tuned_allreduce_intra_recursivedoubling (op.h:498)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
==8482== Address 0x7369608 is 0 bytes after a block of size 8 alloc'd
==8482== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==8482== by 0xBF709B9: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:158)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)


The fortran side:

INTEGER IN( 2 ), OUT( 2 )

CALL MPI_ALLREDUCE( IN, OUT, 1, MPI_2INTEGER, MPI_MINLOC,
& COMM, IERR)

The compiler options will take care of IN be INTEGER*8, but will
it do the same for MPI_2INTEGER in the C side

Thanks.

Regards,

William



Date: Fri, 29 Jun 2012 07:03:18 -0400
From: Jeff Squyres <***@cisco.com>
Subject: Re: [OMPI users] fortran program with integer kind=8 using
openmpi
To: <***@atmos.washington.edu>, Open MPI Users <***@open-mpi.org>
Message-ID: <6FFEA644-3F39-4B6E-ADD6-***@cisco.com>
Content-Type: text/plain; charset=iso-8859-1
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
If you configure ompi with -fdefault-integer-8, then OMPI will assume that Fortran integers are always 8 bytes, so be sure to also compile all of your MPI applications the same way. Indeed, you may want to configure OMPI with something like:

./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8

This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.

Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
Secretan Yves
2012-06-30 16:34:23 UTC
Permalink
Well,

With openmpi compiled with Fortran default integer*8, MPI_TYPE_2INTEGER seem to have an incorrect size. The attached Fortran program shows it,

When run on openmpi with integer*8
Size of MPI_INTEGER is 8
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8 <-- Should be 16

When run on "normal" openmpi
Size of MPI_INTEGER is 4
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8


Yves Secretan
***@ete.inrs.ca

Avant d'imprimer, pensez à l'environnement
________________________________________
De : users-***@open-mpi.org [users-***@open-mpi.org] de la part de William Au [***@hotmail.com]
Date d'envoi : 29 juin 2012 19:15
À : ***@open-mpi.org
Objet : Re: [OMPI users] fortran program with integer kind=8 using openmpi

My concern is how do the C side know fortran integer using 8 bytes?
My valgrind check show something like:

==8482== Invalid read of size 8
==8482== at 0x5F4A50E: ompi_op_base_minloc_2integer (op_base_functions.c:631)
==8482== by 0xBF70DD1: ompi_coll_tuned_allreduce_intra_recursivedoubling (op.h:498)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
==8482== Address 0x7369608 is 0 bytes after a block of size 8 alloc'd
==8482== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==8482== by 0xBF709B9: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:158)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)


The fortran side:

INTEGER IN( 2 ), OUT( 2 )

CALL MPI_ALLREDUCE( IN, OUT, 1, MPI_2INTEGER, MPI_MINLOC,
& COMM, IERR)

The compiler options will take care of IN be INTEGER*8, but will
it do the same for MPI_2INTEGER in the C side

Thanks.

Regards,

William



Date: Fri, 29 Jun 2012 07:03:18 -0400
From: Jeff Squyres <***@cisco.com>
Subject: Re: [OMPI users] fortran program with integer kind=8 using
openmpi
To: <***@atmos.washington.edu>, Open MPI Users <***@open-mpi.org>
Message-ID: <6FFEA644-3F39-4B6E-ADD6-***@cisco.com>
Content-Type: text/plain; charset=iso-8859-1
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
If you configure ompi with -fdefault-integer-8, then OMPI will assume that Fortran integers are always 8 bytes, so be sure to also compile all of your MPI applications the same way. Indeed, you may want to configure OMPI with something like:

./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8

This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.

Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.

--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
Jeff Squyres
2012-07-02 19:55:10 UTC
Permalink
Huh. That's weird. I'll file a ticket.

FWIW, I think compiling OMPI with -i8 worked at one time, but it's probably little-used/little-tested. It may have grown some bit-rot over time (like this case).
Post by Secretan Yves
Well,
With openmpi compiled with Fortran default integer*8, MPI_TYPE_2INTEGER seem to have an incorrect size. The attached Fortran program shows it,
When run on openmpi with integer*8
Size of MPI_INTEGER is 8
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8 <-- Should be 16
When run on "normal" openmpi
Size of MPI_INTEGER is 4
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8
Yves Secretan
Avant d'imprimer, pensez à l'environnement
________________________________________
Date d'envoi : 29 juin 2012 19:15
Objet : Re: [OMPI users] fortran program with integer kind=8 using openmpi
My concern is how do the C side know fortran integer using 8 bytes?
==8482== Invalid read of size 8
==8482== at 0x5F4A50E: ompi_op_base_minloc_2integer (op_base_functions.c:631)
==8482== by 0xBF70DD1: ompi_coll_tuned_allreduce_intra_recursivedoubling (op.h:498)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
==8482== Address 0x7369608 is 0 bytes after a block of size 8 alloc'd
==8482== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==8482== by 0xBF709B9: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:158)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
INTEGER IN( 2 ), OUT( 2 )
CALL MPI_ALLREDUCE( IN, OUT, 1, MPI_2INTEGER, MPI_MINLOC,
& COMM, IERR)
The compiler options will take care of IN be INTEGER*8, but will
it do the same for MPI_2INTEGER in the C side
Thanks.
Regards,
William
Date: Fri, 29 Jun 2012 07:03:18 -0400
Subject: Re: [OMPI users] fortran program with integer kind=8 using
openmpi
Content-Type: text/plain; charset=iso-8859-1
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8
This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.
Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
<type_size.for>_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
Secretan Yves
2012-07-03 19:29:46 UTC
Permalink
Hi,

I applied the patch of ticket #3148 to my version of openmpi 1.6 and it does the job .... at least for me.

Thanks' for the prompt fix.

Yves Secretan
***@ete.inrs.ca

Avant d'imprimer, pensez à l'environnement


-----Message d'origine-----
De : users-***@open-mpi.org [mailto:users-***@open-mpi.org] De la part de Jeff Squyres
Envoyé : 2 juillet 2012 15:55
À : Open MPI Users
Objet : Re: [OMPI users] fortran program with integer kind=8 using openmpi

Huh. That's weird. I'll file a ticket.

FWIW, I think compiling OMPI with -i8 worked at one time, but it's probably little-used/little-tested. It may have grown some bit-rot over time (like this case).
Post by Secretan Yves
Well,
With openmpi compiled with Fortran default integer*8,
MPI_TYPE_2INTEGER seem to have an incorrect size. The attached Fortran
program shows it,
When run on openmpi with integer*8
Size of MPI_INTEGER is 8
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8 <-- Should be 16
When run on "normal" openmpi
Size of MPI_INTEGER is 4
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8
Yves Secretan
Avant d'imprimer, pensez à l'environnement
________________________________________
program with integer kind=8 using openmpi
My concern is how do the C side know fortran integer using 8 bytes?
==8482== Invalid read of size 8
==8482== at 0x5F4A50E: ompi_op_base_minloc_2integer (op_base_functions.c:631)
==8482== by 0xBF70DD1: ompi_coll_tuned_allreduce_intra_recursivedoubling (op.h:498)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
==8482== Address 0x7369608 is 0 bytes after a block of size 8 alloc'd
==8482== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==8482== by 0xBF709B9: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:158)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
INTEGER IN( 2 ), OUT( 2 )
CALL MPI_ALLREDUCE( IN, OUT, 1, MPI_2INTEGER, MPI_MINLOC,
& COMM, IERR)
The compiler options will take care of IN be INTEGER*8, but will it do
the same for MPI_2INTEGER in the C side
Thanks.
Regards,
William
Date: Fri, 29 Jun 2012 07:03:18 -0400
Subject: Re: [OMPI users] fortran program with integer kind=8 using
openmpi
Content-Type: text/plain; charset=iso-8859-1
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8
This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.
Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
http://www.cisco.com/web/about/doing_business/legal/cri/
<type_size.for>_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
Jeff Squyres
2012-07-03 19:45:09 UTC
Permalink
FWIW: I think you'll probably run into issues with MPI attributes (e.g., MPI_COMM_ATTR_SET / GET).

I'll file a ticket about those...
Post by Secretan Yves
Hi,
I applied the patch of ticket #3148 to my version of openmpi 1.6 and it does the job .... at least for me.
Thanks' for the prompt fix.
Yves Secretan
Avant d'imprimer, pensez à l'environnement
-----Message d'origine-----
Envoyé : 2 juillet 2012 15:55
À : Open MPI Users
Objet : Re: [OMPI users] fortran program with integer kind=8 using openmpi
Huh. That's weird. I'll file a ticket.
FWIW, I think compiling OMPI with -i8 worked at one time, but it's probably little-used/little-tested. It may have grown some bit-rot over time (like this case).
Post by Secretan Yves
Well,
With openmpi compiled with Fortran default integer*8,
MPI_TYPE_2INTEGER seem to have an incorrect size. The attached Fortran
program shows it,
When run on openmpi with integer*8
Size of MPI_INTEGER is 8
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8 <-- Should be 16
When run on "normal" openmpi
Size of MPI_INTEGER is 4
Size of MPI_INTEGER4 is 4
Size of MPI_INTEGER8 is 8
Size of MPI_2INTEGER is 8
Yves Secretan
Avant d'imprimer, pensez à l'environnement
________________________________________
program with integer kind=8 using openmpi
My concern is how do the C side know fortran integer using 8 bytes?
==8482== Invalid read of size 8
==8482== at 0x5F4A50E: ompi_op_base_minloc_2integer (op_base_functions.c:631)
==8482== by 0xBF70DD1: ompi_coll_tuned_allreduce_intra_recursivedoubling (op.h:498)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
==8482== Address 0x7369608 is 0 bytes after a block of size 8 alloc'd
==8482== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==8482== by 0xBF709B9: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:158)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
INTEGER IN( 2 ), OUT( 2 )
CALL MPI_ALLREDUCE( IN, OUT, 1, MPI_2INTEGER, MPI_MINLOC,
& COMM, IERR)
The compiler options will take care of IN be INTEGER*8, but will it do
the same for MPI_2INTEGER in the C side
Thanks.
Regards,
William
Date: Fri, 29 Jun 2012 07:03:18 -0400
Subject: Re: [OMPI users] fortran program with integer kind=8 using
openmpi
Content-Type: text/plain; charset=iso-8859-1
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8
This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.
Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
http://www.cisco.com/web/about/doing_business/legal/cri/
<type_size.for>_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
--
Jeff Squyres
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
--
Jeff Squyres
***@cisco.com
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
George Bosilca
2012-07-01 11:38:37 UTC
Permalink
Based on the sizes reported by configure (in the opal_config.h file), we map the Fortran types to C types at runtime. Thus, if there is an identical C type (and this is the case for all integers), all Fortan types will have as a backend the corresponding int type.

Can you send your opal_config.h and config.log please.

george.
Post by William Au
My concern is how do the C side know fortran integer using 8 bytes?
==8482== Invalid read of size 8
==8482== at 0x5F4A50E: ompi_op_base_minloc_2integer (op_base_functions.c:631)
==8482== by 0xBF70DD1: ompi_coll_tuned_allreduce_intra_recursivedoubling (op.h:498)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
==8482== Address 0x7369608 is 0 bytes after a block of size 8 alloc'd
==8482== at 0x4A0610C: malloc (vg_replace_malloc.c:195)
==8482== by 0xBF709B9: ompi_coll_tuned_allreduce_intra_recursivedoubling (coll_tuned_allreduce.c:158)
==8482== by 0x5F031CB: PMPI_Allreduce (pallreduce.c:105)
==8482== by 0x62E2F22: PMPI_ALLREDUCE (pallreduce_f.c:77)
==8482== by 0x5C8934: mumps_276_ (mumps_part9.F:4667)
==8482== by 0x54D89A: dmumps_ (dmumps_part1.F:157)
==8482== by 0x43D358: dmumps_f77_ (dmumps_part3.F:6651)
==8482== by 0x41420C: dmumps_c (mumps_c.c:422)
==8482== by 0x412CB4: main (my_cExample_client.c:80)
INTEGER IN( 2 ), OUT( 2 )
CALL MPI_ALLREDUCE( IN, OUT, 1, MPI_2INTEGER, MPI_MINLOC,
& COMM, IERR)
The compiler options will take care of IN be INTEGER*8, but will
it do the same for MPI_2INTEGER in the C side
Thanks.
Regards,
William
Date: Fri, 29 Jun 2012 07:03:18 -0400
Subject: Re: [OMPI users] fortran program with integer kind=8 using
openmpi
Content-Type: text/plain; charset=iso-8859-1
You should not have to recompile openmpi, but you do have to use the correct type. You can check the size of integers in your fortrana nd use MPI_INTEGER4 or MPI_INTEGER8 depending on what you get.
./configure FCFLAGS=-fdefault-integer-8 FFLAGS=-fdefault-integer-8 \
--with-wrapper-fflags=-fdefault-integer-8 \
--with-wrapper-fcflags=-fdefault-integer-8
This will add -fdefault-integer-8 to the mpif77 and mpif90 command lines automatically so that you *can't* compile without that flag.
Be aware that 8-byte Fortran integers *should work* in Open MPI, but it is probably not well tested. You may well run into some issues; be sure to let us know if you run into bugs. Sending small test programs that show the problem are usually the best way to help us identify/fix the precise problem.
in gfortran use
integer i
if(sizeof(i) .eq. 8) then
mpi_int_type=MPI_INTEGER8
else
mpi_int_type=MPI_INTEGER4
endif
I don't think that this should be necessary -- as long as you configured OMPI with the 8-byte-integer setting, then MPI_INTEGER should represent an 8 byte integer.
--
Jeff Squyres
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/
_______________________________________________
users mailing list
http://www.open-mpi.org/mailman/listinfo.cgi/users
Loading...