Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4975 Discussions

vtune and optimization flag problem

amk21
Beginner
347 Views
Hi,
I found out that when compileing with -O flag it's does not meter what optimize flag i'm using once -O is specify vtune stop collecting data.
i installed a clean Ubuntu 11.1
amir@ubuntu:~/vtune_intel_test$ uname -a
Linu
x ubuntu 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
==========================================
compile with -O
==========================================
g++ test.cpp -g -I/opt/intel/vtune_amplifier_xe_2011/include /opt/intel/vtune_amplifier_xe_2011/lib64/libittnotify.a -lpthread -ldl -O -o test
amir@ubuntu:~/vtune_intel_test$ rm -Rf r00*; amplxe-cl -collect hotspots -start-paused -- ./test; amplxe-cl -report hotspots r000hs/
Error: Cannot change state
Error: Cannot change state
Error: Cannot change state
Using result path `/home/amir/vtune_intel_test/r000hs'
Executing actions 16 % Loading data files
Warning: Cannot load data file `/home/amir/vtune_intel_test/r000hs/data.0/11058-11066.0.log' ().
Executing actions 75 % Generating a report
Summary
-------
Elapsed Time: 0.021
CPU Time: 0
Executing actions 100 % done
Using result path `/home/amir/vtune_intel_test/r000hs'
Executing actions 75 % Generating a report
Function Module CPU Time
-------- ------ --------
Executing actions 100 % done
amir@ubuntu:~/vtune_intel_test$
==========================================
compile without
==========================================
amir@ubuntu:~/vtune_intel_test$ g++ test.cpp -g -I/opt/intel/vtune_amplifier_xe_2011/include /opt/intel/vtune_amplifier_xe_2011/lib64/libittnotify.a -lpthread -ldl -o test
amir@ubuntu:~/vtune_intel_test$ rm -Rf r00*; amplxe-cl -collect hotspots -start-paused -- ./test; amplxe-cl -report hotspots r000hs/
Error: Cannot change state
Error: Cannot change state
Error: Cannot change state
Using result path `/home/amir/vtune_intel_test/r000hs'
Executing actions 16 % Loading data files
Warning: Cannot load data file `/home/amir/vtune_intel_test/r000hs/data.0/11128-11136.0.log' ().
Executing actions 75 % Generating a report
Summary
-------
Elapsed Time: 0.102
CPU Time: 0.027
Executing actions 100 % done
Using result path `/home/amir/vtune_intel_test/r000hs'
Executing actions 75 % Generating a report
Function Module CPU Time
------------------ ------ --------
foo_data_collected test 0.027
Executing actions 100 % done
this is the test.cpp code
//test.cpp : Defines the entry point for the console application.
//
#include "ittnotify.h"
void foo_data_collected()
{
for (int i=0; i<10000000L; i++);
}
void foo_data_not_collected()
{
for (int i=0; i<10000000L; i++);
}
int main(int argc, char* argv[])
{
// Assume that data collector was paused in user interface
foo_data_not_collected();
// Now resume data collecting
__itt_resume();
foo_data_collected();
// Pasue data collecting again
__itt_pause();
foo_data_not_collected();
// Resume data collecting again
__itt_resume();
foo_data_collected();
// The user shouldn't see data collecting in foo_data_not_collected() in result
return 0;
}
how can i use vtune whith -O2 or -O3 ?
Regards
Amir
0 Kudos
5 Replies
Rob5
New Contributor II
347 Views

Amk21,

This new forum post appears to be a duplicate of forum thread hereyou posted which is in process. Let us know if this is not the case.

- Rob

0 Kudos
amk21
Beginner
347 Views
this is more direct question way gcc optimization flag cause vtune to stop collecting in the previous post there where several issues
0 Kudos
Peter_W_Intel
Employee
347 Views
I never use option "-Ox" when I tried Resume/Pause API. But I think this should be a probelm.

I have reported this problem to engineering team, and willupdate on this thread if any progress.

Currently, workaround is not to use "-Ox" when using Resume/Pause API.

Regards, Peter
0 Kudos
amk21
Beginner
347 Views
i think i figure the problem the functions are inline when using -Ox flag
0 Kudos
TimP
Honored Contributor III
347 Views
Inlined functions will cause the associated data to be associated with a calling function. So it's often useful to disable in-lining for profiling.
0 Kudos
Reply