Analyzers
Support for Analyzers (Intel VTune™ Profiler, Intel Advisor, Intel Inspector)
4728 Discussions

Vtune Stops the container when generating hotspots result for process from other container

HarshGautam
Employee
809 Views

Hi, 

I am running vtune in one container with pid =host. 
And Application is running in other container as shows as python process. 

I am trying to profile the hotspots result for each functions and loops So I am access the application as process in vtune container. 
As soon I start the hotspots results for the running process using pid, Container itself stops and fails the vtune result. 

Is there a way to fix it. 
Or if there is other way to get a result for analysis  application flow and identify sections of code that take a long time to execute. 

Let me know.

Labels (1)
0 Kudos
1 Solution
JaideepK_Intel
Moderator
563 Views

Hi Gautam,

 

Yes, we can profile the target application container using the process id. Since you are trying to profile a Python application, source code information may not be available. You can see only assemble information in generated reports.

 

Thanks,

Jaideep

 

View solution in original post

7 Replies
JaideepK_Intel
Moderator
780 Views

Hi,

 

Thank you for posting in Intel forums.

We're working on this internally. We'll get back to you soon with an update. Could you please share the Vtune version and OS details .

 

Thanks,

Jaideep

 

HarshGautam
Employee
761 Views

Hi Jaideep, I am using latest version of vtune. 
Its 2021 version. 

JaideepK_Intel
Moderator
748 Views

Hi,

 

Please follow the below steps to profile on a Target container from a Host container:

Create a bridge network for containers:

 

docker network create -d bridge test

 

Note: For each row 1st run the Host container command and then run the Target container command.

Host container (VTune installed)

Target container

Command to start Host container:

  • docker run --rm -dti --name Host --network test --cap-add CAP_SYS_ADMIN <Image_name> bash

Command to start Target container:

  • docker run --rm -dti --name Target --network test --cap-add CAP_SYS_ADMIN <Image_name> bash
  • docker exec -it <containerID> bash
  • docker exec -it <containerID> bash

Install ssh and enable it on both containers:

  • apt-get update
  • apt-get install ssh
  • service ssh start
  • service ssh status

You will see that “ssh is running”

Install ssh and enable it on both containers:

  • apt-get update
  • apt-get install ssh
  • service ssh start
  • service ssh status

You will see that “ssh is running”

Enable password less ssh connection between containers​

To generate public rsa key for connection :

  •  ssh-keygen -t rsa (key will be saved in this path (/root/.ssh/id_rsa.pub))

copy the content inside "id_rsa.pub" to the Target : ~/.ssh/authorized_keys

In the Target container, create the following directory:

  • mkdir ~/.ssh
  • cd ~/.ssh
  • touch ​authorized_keys
  •  vi authorized_keys (Copy the contents of the "id_rsa.pub" file from the host and paste the content in this file)

After copying the content inside "id_rsa.pub" to the Target : ~/.ssh/authorized_keys, follow one of the following methods:

Method 1 (using command line):

  • vtune -target-system ssh:root@Target -target-install-dir=/tmp/vtune_profiler -collect hotspots --app-working-dir=/usr/bin -- /usr/bin/python3  <Path to the python application in the Target container>

Method 2 (using GUI):

  • vtune-backend --allow-remote-ui --web-port=7788 --enable-server-profiling &

2links will be generated after running the above command. Open any one of the links in a browser

  • In configure analysis under "where" tab, click on "Remote linux(ssh)"
  • Fill ssh destination as: root@Target
  •  Fill VTune Profiler installation directory on the remote system as: /tmp/vtune_profiler (keep it as default)
  • Temporary directory: /tmp (keep it as default)

Note​:  Press deploy after following the above steps

In launch application:

  • Application: /usr/bin/python3 (in target system give path to where python is located)
  • Application Parameters: <Path to the python application in the Target container>(eg:/root/try.py)

 

Webpage looks like this if you follow Method 2

JaideepK_Intel_0-1641392775836.png

Webpage looks like this after clicking the deploy button

JaideepK_Intel_0-1641393148931.png

 

Please refer below links for more information:

1. https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/set-up-analysis-target/...

2. https://www.intel.com/content/www/us/en/develop/documentation/vtune-help/top/launch/containerization...

3. https://www.intel.com/content/www/us/en/develop/documentation/vtune-cookbook/top/configuration-recip...

 

Thanks,

Jaideep

 

JaideepK_Intel
Moderator
636 Views

Hi HarshGautam,


If this resolves your issue, make sure to accept this as a solution. This would help others with similar issue. Thank you have a great day ahead.


Thanks,

Jaideep




HarshGautam
Employee
591 Views

Hi Jaideep, Thanks for the solution.  But this solution will not work with my situation. 

Sorry I was not clear before. 

I do have container with application running inside of it. And vtune container is running in other container. 
I can not change / install any thing in application container. Therefore the solution is not suitable for the scenario which I have. 

 

Is there a way, Without installing / changing into application I can profile the container ?
I am able to target the application container using process id. But it does not give the expected profiling result. 

 

JaideepK_Intel
Moderator
564 Views

Hi Gautam,

 

Yes, we can profile the target application container using the process id. Since you are trying to profile a Python application, source code information may not be available. You can see only assemble information in generated reports.

 

Thanks,

Jaideep

 

JaideepK_Intel
Moderator
552 Views

Hi,


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks,

Jaideep


Reply