|
From: Fei Liu on 4 Apr 2008 14:17 Hello, The Intel Fortran compiler v10.0.023 makes a lot of noise about this warning when compiling a fairly big Fortran code base. What's the implication of this warning? How to fix it (see P.S. for a sample)? If it's harmless, is there a compile flag to disable this warning? Thanks, Fei
From: Steve Lionel on 4 Apr 2008 14:45 On Fri, 04 Apr 2008 14:17:43 -0400, Fei Liu <fei.liu(a)gmail.com> wrote: > The Intel Fortran compiler v10.0.023 makes a lot of noise about this >warning when compiling a fairly big Fortran code base. What's the >implication of this warning? How to fix it (see P.S. for a sample)? If >it's harmless, is there a compile flag to disable this warning? I see no P.S. This is telling you that you have defined a derived type or a STRUCTURE with fields that are at offsets not a multiple of their size. Accessing these misaligned fields can reduce performance, but is otherwise harmless. There are multiple ways to disable the warning, depending on what you want to do. If you simply want to turn them off everywhere, use /warn:noalign (Windows) or -warn noalign (Linux/Mac). You can also selectively disable this warning for individual declarations (see documentation of OPTIONS directive). If this is a derived type (and not a STRUCTURE), it might make sense for you to add SEQUENCE to the declaration (this won't disable the warning but it is appropriate if you are sharing this structure with non-Fortran code.) Of course, if you are able to, it's best to rearrange the components so that they are naturally aligned. The same goes for laying out variables in COMMON. For more details, see the Intel Fortran documentation under Optimizing Applications > Programming Guidelines > Understanding Data Alignment -- Steve Lionel Developer Products Division Intel Corporation Nashua, NH For email address, replace "invalid" with "com" User communities for Intel Software Development Products http://softwareforums.intel.com/ Intel Fortran Support http://support.intel.com/support/performancetools/fortran My Fortran blog http://www.intel.com/software/drfortran
From: Fei Liu on 4 Apr 2008 14:51 Fei Liu wrote: > Hello, > > The Intel Fortran compiler v10.0.023 makes a lot of noise about this > warning when compiling a fairly big Fortran code base. What's the > implication of this warning? How to fix it (see P.S. for a sample)? If > it's harmless, is there a compile flag to disable this warning? > > Thanks, > > Fei Sorry I forgot to add the type definition. It doesn't make a lot of sense if you ain't familiar with the ESMF framework. But this kind of definition causes lots of misaligned fields warnings. type ESMF_FieldBundleType sequence type(ESMF_Base) :: base ! base class object type(ESMF_Field), dimension(:), pointer :: flist type(ESMF_Status) :: bundlestatus type(ESMF_Status) :: gridstatus type(ESMF_Grid) :: grid ! associated globalGrid type(ESMF_LocalFieldBundle) :: localbundle ! this differs per DE type(ESMF_Packflag) :: pack_flag ! is packed data present? type(ESMF_IOSpec) :: iospec ! iospec values type(ESMF_Status) :: iostatus ! if unset, inherit from gcomp logical :: isCongruent ! are all fields identical? logical :: hasPattern ! first data field sets this !type(ESMF_FieldBundleCongrntData) :: pattern ! what they must match integer :: field_count ESMF_INIT_DECLARE end type
From: Fei Liu on 4 Apr 2008 15:00 Steve Lionel wrote: > On Fri, 04 Apr 2008 14:17:43 -0400, Fei Liu <fei.liu(a)gmail.com> wrote: > >> The Intel Fortran compiler v10.0.023 makes a lot of noise about this >> warning when compiling a fairly big Fortran code base. What's the >> implication of this warning? How to fix it (see P.S. for a sample)? If >> it's harmless, is there a compile flag to disable this warning? > > I see no P.S. > > This is telling you that you have defined a derived type or a STRUCTURE with > fields that are at offsets not a multiple of their size. Accessing these > misaligned fields can reduce performance, but is otherwise harmless. > > There are multiple ways to disable the warning, depending on what you want to > do. If you simply want to turn them off everywhere, use /warn:noalign > (Windows) or -warn noalign (Linux/Mac). You can also selectively disable this > warning for individual declarations (see documentation of OPTIONS directive). > > If this is a derived type (and not a STRUCTURE), it might make sense for you > to add SEQUENCE to the declaration (this won't disable the warning but it is > appropriate if you are sharing this structure with non-Fortran code.) > > Of course, if you are able to, it's best to rearrange the components so that > they are naturally aligned. The same goes for laying out variables in COMMON. > > For more details, see the Intel Fortran documentation under Optimizing > Applications > Programming Guidelines > Understanding Data Alignment > > -- > Steve Lionel > Developer Products Division > Intel Corporation > Nashua, NH > > For email address, replace "invalid" with "com" > > User communities for Intel Software Development Products > http://softwareforums.intel.com/ > Intel Fortran Support > http://support.intel.com/support/performancetools/fortran > My Fortran blog > http://www.intel.com/software/drfortran Hi Steve Sorry I got distracted by the other gfortran bug thread. I attached the definition (derived type) in another reply. But here is a simpler structure that still causes problem: type ESMF_Field sequence type (ESMF_FieldType), pointer :: ftypep ESMF_INIT_DECLARE end type As you can see this structure has only 2 memebers (ESMF_INIT_DECLARE is a macro and gets translated to type ESMF_Field sequence type (ESMF_FieldType), pointer :: ftypep integer(8) :: isInit = 76838410 end type What's troubling is that even something like this causes alignment warnings. And due to interop requirement, we can't rearrange the order of ftypep and isInit in ESMF_Field definition. Fei
From: Steve Lionel on 4 Apr 2008 15:35
On Fri, 04 Apr 2008 15:00:45 -0400, Fei Liu <fei.liu(a)gmail.com> wrote: >What's troubling is that even something like this causes alignment >warnings. And due to interop requirement, we can't rearrange the order >of ftypep and isInit in ESMF_Field definition. Why is it "troubling"? For example, you have an integer*8 field that follows a pointer. On a 32-bit system, the pointer would be four bytes, making the 8-byte integer field misaligned. The compiler is trying to be helpful here. Since you know you want this, just disable the warning as I indicated in my initial reply. You can do it on a per-type basis or globally. -- Steve Lionel Developer Products Division Intel Corporation Nashua, NH For email address, replace "invalid" with "com" User communities for Intel Software Development Products http://softwareforums.intel.com/ Intel Fortran Support http://support.intel.com/support/performancetools/fortran My Fortran blog http://www.intel.com/software/drfortran |