This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Tue, Feb 21, 2006 at 11:53:09AM -0700, Craig Rasmussen wrote: > I have been helping the OpenMPI project with some > of their Fortran issues and a problem with determining > the alignment of basic types has come up. Currently > they are testing for alignment in two ways based on > F77 and F90. Unfortunately the tests give different > answers and I'm not sure which test is correct (if either). > > The F77 test places variables in a common block with an assortment > of characters to force padding to align the types. It then > calls a C function with the variables in the common block > and determines alignment from the addresses. > > The F90 test is similar except that it uses a derived type. > > I'm including portions of the F77 and F90 code. Helpful > comments would be most appreciated. Take this with a grain of salt, as playing interesting games with common and equivalence isn't my idea of time well spent. There is no rule stating that aligment must be the same for common and derived types, so perhaps both your tests are correct. Common is limited in the sense that storage association is required to work, but for a derived type the compiler is free to align in whatever way it thinks provides the best performance. Unless you make the derived type a sequence type, in which case the derived type should also obey the rules of storage association. And of course, if you have many compilation units, all of them must be compiled with the same set of alignment flags. There is some info about Fortran/MPI issues in the MPI-2 report at http://www-unix.mcs.anl.gov/mpi/mpi-standard/mpi-report-2.0/node236.htm but I'm sure you're already aware of that. -- Janne Blomqvist
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |