Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29234 Discussions

for_len_trim - what is it? Presumably compiler internal function

Ian_Watson
Beginner
1,355 Views
I have a piece of software that I have profiled and something called for_len_trim is showing up as consuming significant CPU resources.

From searching previous posts I know Intel does not document compiler internal functions, but if anyone can tell me roughly what this does, that would be very helpful.

Interestingly, for a supposedly numerically intensive application, the top of the profile looked like

time seconds seconds calls Ks/call Ks/call name
12.84 1407.03 1407.03 for_cpstr
11.97 2719.13 1312.10 for_len_trim

From previous posts I know that for_cpstr is copying strings. What does for_len_trim do?

Is there any way to get different profile so I would then know from where these were being called?

Thanks

Ian
0 Kudos
5 Replies
Hirchert__Kurt_W
New Contributor II
1,355 Views
Quoting - Ian Watson
From previous posts I know that for_cpstr is copying strings. What does for_len_trim do?

I would be greatly surprised if it did something other than implement the LEN_TRIM intrinsic function. It's possible that it is also used internally in the implementation of TRIM. [LEN_TRIM tells you where a string's trailing blanks begin; TRIM gives you a copy of the string with those trailing blanks removed.] I can't think of any other place in the language where this functionality would be used internally, so I would expect to find explicit use of either LEN_TRIM or TRIM in your source code.

-Kurt
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,355 Views

Ian,

Profile your debug version to get the address of for_len_trim.

Then debug the debug version, break early, open a dissassembly window, use GOTO address and enter the address of the for_len_trim. Insert a break point in the routine (in the dissassembly window). F5 to continue. on break check the call stack. This should lead you (eventually) to the statement in your program that calls the for_len_trim. You may have to continue throug this several times to find additional locations (or set your initial break point later in the run of your program)

Jim Dempsey
0 Kudos
Ian_Watson
Beginner
1,355 Views

Ian,

Profile your debug version to get the address of for_len_trim.

Then debug the debug version, break early, open a dissassembly window, use GOTO address and enter the address of the for_len_trim. Insert a break point in the routine (in the dissassembly window). F5 to continue. on break check the call stack. This should lead you (eventually) to the statement in your program that calls the for_len_trim. You may have to continue throug this several times to find additional locations (or set your initial break point later in the run of your program)

Jim Dempsey
Excellent suggestions all, I'm off and running - or more correctly, I can now have what I need to figure out what is going on.

Thanks very much!

ian
0 Kudos
TimP
Honored Contributor III
1,355 Views
VTune call graph may be able to instrument and show the site of the heavy usage of intrinsics.
As the gfortran run-time library is normally built with debug symbols, and the source code is public, running that under VTune event based sampling should be instructive.
0 Kudos
Ron_Green
Moderator
1,355 Views
for_len_trim is indeed the internal name for the intrinsic funtion LEN_TRIM( ) and is in libifcore.

This returns the length of a character string after trailing blanks are ignored.

ron
0 Kudos
Reply