PDA

View Full Version : Fortran arrays and Intel 11.1 compiler



MargaretKahn
10-13-2009, 09:44 PM
I'm having a problem with totalview showing the order of dimensions of fortran arrays incorrectly. E.g. with the following program

program test
real, dimension(3,2) :: x
x = reshape( (/ 1, 2, 3, 4, 5, 6 /), (/3, 2 /) )
print*, x
end program test

When I compile this with ifort (either 11.1.046 or 11.1.056) totalview shows the array dimensions as (2,3) rather than (3,2). The following is from the CLI, but it's the same from the GUI.

d1.<> dwhat x
In thread 1.1:
Name: x; Type: REAL(4)(2,3); Size: 24 bytes; Addr: 0x006aadf0
Scope: ##/short/p73/mrd599/a.out#junk.f90#MAIN_ (Scope class: Any)
Address class: proc_static_var (Routine static variable)
d1.<> dprint x
x = {
(1,1) = 1
(2,1) = 2
(1,2) = 3
(2,2) = 4
(1,3) = 5
(2,3) = 6
}
d1.<>
If I compile it with intel-fc/11.0.083 (or gfortran) the array order is correct.

d1.<> dwhat x
In thread 1.1:
Name: x; Type: REAL*4(3,2); Size: 24 bytes; Addr: 0x006a7db0
Scope: ##/short/p73/mrd599/a.out#junk.f90#test (Scope class: Any)
Address class: proc_static_var (Routine static variable)
d1.<> dprint x
x = {
(1,1) = 1
(2,1) = 2
(3,1) = 3
(1,2) = 4
(2,2) = 5
(3,2) = 6
}
d1.<>

PeterT-RogueWave
10-14-2009, 12:32 PM
Margaret,

Which version of TotalView are you using? We saw this problems when Intel 11.1 first came out, but resolved the issue in TotalView 8.7.0-0 The current version is 8.7.0-3.

I hope this helps.

Regards,

MargaretKahn
10-14-2009, 04:31 PM
Thanks Peter,
It looks like we have got a bit out of date as we have 8.6.0-1. Time to upgrade,

Margaret

dogunter
05-24-2012, 11:21 AM
Sorry to resurrect an ancient thread but we are seeing this exact same problem now with Intel 2012 (icc --version reports version 12.1.2) and Totalview 8.7. Intel 11.1.072 and TV 8.7 get it right, Intel 12.1.2 and TV 8.7 reports it wrong. We can upgrade to TV 8.9 but it will take some time. We are looking for the reason for the problem.

Thanks.

PeterT-RogueWave
06-05-2012, 12:03 PM
It's actually the same problem. The reason is simple. TotalView doesn't recognize the compiler as an Intel compiler. If you do a

readelf -wi program | grep DW_AT_producer

at various points you will see strings that help us identify the compiler. For the latest Intel compilers (I used the Fortran one for this example, but the issue is the same) I get:

DW_AT_producer : Intel(R) Fortran Intel(R) 64 Compiler XE Fixes SameLinkageName

This string is a bit different than the string we had used to identify the Intel compiler, so we don't recognize it as Intel. And we treat the Intel compiler a bit differently when it comes to arrays. So every time Intel changes the string that doesn't match our string pattern, we start showing the arrays incorrectly.

The best solution is upgrading TotalView, as that will take care of the problem. An interim solution is to create, or add to an existing .tvdrc file (in your home directory)

dset -set_as_default TV::Private::default_compiler intel_v81

If you're using other compilers, that might not be the best solution, as it might override those (not really sure, but a suspicion). You can also modify (carefully!) a resource file in
<install_path>/toolworks/totalview.8.7.0-3/linux-x86-64/lib/

Or totalview-version/platform/lib

called tvdinit.tvd

In there, about line 521 (depending on the version) you will see a set keys statement, which contains a lot of compiler matching strings and settings. You want to go to the last of the Intel strings, and change

{ {^Intel(\(R\))? Fortran Compiler} intel_v81}

to

{ {^Intel(\(R\))? Fortran} intel_v81}


That will produce the right string match and the arrays should look better. Given the dates between the release of that version of TotalView and the 12.1 Intel compiler, this may not catch all changes, but it's probably better than what you are currently seeing.