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

How do I configure VTune Profiler when both host and target are containers?

saosudo
Beginner
1,092 Views

Sorry for the double post, I made a mistake where I should have posted.

I would like to install VTune Profiler on the host container (including xrdp) and profile the target container.
I don't see any such examples below, so please let me know.

https://software.intel.com/content/www/us/en/develop/documentation/vtune-cookbook/top/configuration-recipes/profiling-in-docker-container.html

I installed Vtune on the host using the following procedure.

host container $ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -O - | sudo apt-key add -
host container $ sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
host container $ sudo apt install intel-basekit

 
I'm not sure how to set the target.

Labels (1)
0 Kudos
1 Solution
RaeesaM_Intel
Moderator
1,027 Views

Hi,

Thank you for posting in Analyzers Forum.

You can try using docker image of Intel Base Toolkit in which VTune is already available so that you don’t need to install it separately. Please follow the below steps to successfully profile a Target container from a Host container :

 

1)     Pull oneapi-basekit image

$ docker pull intel/oneapi-basekit

2)     Create a bridge network for containers

$ docker network create -d bridge test

3)     Run the Host container

$ docker run -p 22:23 --rm -ti --name Host --network test intel/oneapi-basekit bash

4)     On another terminal. Run Target container

$ docker run -p 22:24 --rm -ti --name Target --network test intel/oneapi-basekit  bash

Note : you can install xrdp inside the container.

5)     Install ssh and enable it on both containers

$ apt-get install ssh

$ service ssh start

$ service ssh status

You will see that “ssh is running”

Note : If the installation fails . Try $ apt-get update

6)     Enable password less ssh connection between containers

In the Host container , Run the following command to generate public rsa key for connection :

$  ssh-keygen -t rsa

Follow the instructions and the key file will be created in the path you provided.

In the Target container, create the following directory:

mkdir ~/.ssh

Paste the contents of the public key you created into a file named authorized_keys inside ~/.ssh

7)     Now try ssh from Host into Target

$ ssh root@Target

     If step 7 is successful then you can try the vtune command to profile the Target container from Host container.

$ source /opt/intel/oneapi/setvars.sh and try profiling.

 

Please refer the below links for more information:

Oneapi-basekit image : https://hub.docker.com/r/intel/oneapi-basekit

Ssh enabling between containers :

https://hub.docker.com/r/intel/oneapi-basekit

https://phoenixnap.com/kb/how-to-ssh-into-docker-container

password less connection :

https://stackoverflow.com/questions/63345232/login-without-password-from-one-docker-container-into-another

https://kcaps.medium.com/passwordless-ssh-between-docker-containers-feb68133dfce

Collect data from remote target :

https://software.intel.com/content/www/us/en/develop/documentation/vtune-help/top/command-line-interface/running-command-line-analysis/configuring-analysis-options-from-the-command-line/collecting-data-on-remote-linux-systems-from-the-command-line.html

https://software.intel.com/content/www/us/en/develop/documentation/vtune-cookbook/top/configuration-recipes/profiling-remote-target-through-proxy.html

 

Hope this helps. Get back to us in case of any issues.

Regards,

Raeesa

 

View solution in original post

4 Replies
RaeesaM_Intel
Moderator
1,028 Views

Hi,

Thank you for posting in Analyzers Forum.

You can try using docker image of Intel Base Toolkit in which VTune is already available so that you don’t need to install it separately. Please follow the below steps to successfully profile a Target container from a Host container :

 

1)     Pull oneapi-basekit image

$ docker pull intel/oneapi-basekit

2)     Create a bridge network for containers

$ docker network create -d bridge test

3)     Run the Host container

$ docker run -p 22:23 --rm -ti --name Host --network test intel/oneapi-basekit bash

4)     On another terminal. Run Target container

$ docker run -p 22:24 --rm -ti --name Target --network test intel/oneapi-basekit  bash

Note : you can install xrdp inside the container.

5)     Install ssh and enable it on both containers

$ apt-get install ssh

$ service ssh start

$ service ssh status

You will see that “ssh is running”

Note : If the installation fails . Try $ apt-get update

6)     Enable password less ssh connection between containers

In the Host container , Run the following command to generate public rsa key for connection :

$  ssh-keygen -t rsa

Follow the instructions and the key file will be created in the path you provided.

In the Target container, create the following directory:

mkdir ~/.ssh

Paste the contents of the public key you created into a file named authorized_keys inside ~/.ssh

7)     Now try ssh from Host into Target

$ ssh root@Target

     If step 7 is successful then you can try the vtune command to profile the Target container from Host container.

$ source /opt/intel/oneapi/setvars.sh and try profiling.

 

Please refer the below links for more information:

Oneapi-basekit image : https://hub.docker.com/r/intel/oneapi-basekit

Ssh enabling between containers :

https://hub.docker.com/r/intel/oneapi-basekit

https://phoenixnap.com/kb/how-to-ssh-into-docker-container

password less connection :

https://stackoverflow.com/questions/63345232/login-without-password-from-one-docker-container-into-another

https://kcaps.medium.com/passwordless-ssh-between-docker-containers-feb68133dfce

Collect data from remote target :

https://software.intel.com/content/www/us/en/develop/documentation/vtune-help/top/command-line-interface/running-command-line-analysis/configuring-analysis-options-from-the-command-line/collecting-data-on-remote-linux-systems-from-the-command-line.html

https://software.intel.com/content/www/us/en/develop/documentation/vtune-cookbook/top/configuration-recipes/profiling-remote-target-through-proxy.html

 

Hope this helps. Get back to us in case of any issues.

Regards,

Raeesa

 

saosudo
Beginner
1,005 Views

Thank you for your answer.
Sorry, but I have an additional question.
How should I set up the container if I want to create target on the host network and host on the bridge network?

0 Kudos
saosudo
Beginner
995 Views

I have almost solved the problem and will describe how to set it up.


It was difficult to set up a new container, so I installed intel-basekit in an existing container.
I installed intel-basekit on both host and target. Then I configured the ssh connection settings.

The setup of ssh connection between target and host is the same as Raeesa-san's steps 5) to 7).

Finally, it was just a matter of configuring the ssh destination as usual.

Example:
IP address of docker bridge 0 (target): 172.17.0.1
SSH Port number set in /etc/ssh/sshd_config (target): 10122

I configured the VTune gui (from host) as follows

Remote Linux(SSH)
SSH destination

user@172.17.0.1:10122

0 Kudos
RaeesaM_Intel
Moderator
977 Views

Hi,


Glad that the solution provided helped and thank you for accepting it as solution. We are discontinuing monitoring this thread. Please raise a new thread incase if you face any more issues. We would be happy to help you.


Thanks and Regards,

Raeesa


0 Kudos
Reply