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

Intel Vtune cannot find python source file

Rhonda99
Beginner
1,945 Views

This is an old problem as is demonstrated as in https://community.intel.com/t5/Analyzers/Unable-to-view-source-code-when-analyzing-results/td-p/1153210 . I have tried all the listed methods, none of them works, and I cannot find any more solutions on the internet. Basically vtune cannot find the custom python source file no matter what is tried. I am using the most recently version as of speaking. Please let me whether there is a solution.

For example, if you run the following program.

def myfunc(*args
    # Do a lot of things. 

if __name__ = '__main__':
    # Do something and call myfunc

Call this script main.py. Now use the newest vtune version (I have using Ubuntu 18.04), run the vtune-gui and basic hotspot analysis. You will not found any information on this file. However, a huge pile of information on Python and its other codes are found (related to your python environment). In theory, you should be able to find the source of main.py as well as cost on each line in that script. However, that is simply not happening.

Desired behavior: I would really like to find the source file and function in the top-down manual (or any really). Any advice is welcome.

Labels (1)
0 Kudos
1 Solution
Johny_P_Intel
Employee
1,900 Views

VTune offer full support for profiling python code and the tool should be able to display the source code in your python file as you expected. Could you please check if the function you are expecting to see in the VTune results, ran long enough?


Just to confirm that everything is working fine, I wrote a matrix multiplication code as shown below (don't worry about the accuracy of the code itself):

---------------------------------------------------

def matrix_mul(X, Y):

  result_matrix = [ [ 1 for i in range(len(X)) ] for j in range(len(Y[0])) ]

  # iterate through rows of X

  for i in range(len(X)):

    # iterate through columns of Y

    for j in range(len(Y[0])):

      # iterate through rows of Y

      for k in range(len(Y)):

        result_matrix[i][j] += X[i][k] * Y[k][j]


  return result_matrix


-----------------------------------------------


Then I called this function (matrix_mul) on my Ubuntu machine with large enough matrices so that the overall execution time was in the order of few seconds.


I used the below command to start profiling (you can also see the VTune version I used):

/opt/intel/oneapi/vtune/2021.1.1/bin64/vtune -collect hotspots -knob enable-stack-collection=true -data-limit=500 -ring-buffer=10 -app-working-dir /usr/bin -- python3 /home/johnypau/MyIntel/temp/Python_matrix_mul/mat_mul_method.py


Now open the VTune results in the GUI and under the bottom-up tab, order by "Module / Function / Call-stack" (or whatever preferred grouping is).


You should be able to see the the module (mat_mul_method.py in my case) and the function "matrix_mul". If you double click, VTune should be able to load the sources too. Please let me know if you still have difficulties viewing your code.


Regards,

Johny



View solution in original post

0 Kudos
5 Replies
ChithraJ_Intel
Moderator
1,934 Views

Hi Rhonda,

 

Thanks for reaching out to us.

As this question is specifically about running a python application using Intel Vtune Profiler, we are moving this query to Intel Analyzers Forum  for a faster resolution.

 

Regards,

Chithra

 

0 Kudos
ChithraJ_Intel
Moderator
1,916 Views

Hi Rhonda,


We are forwarding your query to Subject Matter Experts who can help you to solve this issue.


Regards,

Chithra


0 Kudos
Johny_P_Intel
Employee
1,901 Views

VTune offer full support for profiling python code and the tool should be able to display the source code in your python file as you expected. Could you please check if the function you are expecting to see in the VTune results, ran long enough?


Just to confirm that everything is working fine, I wrote a matrix multiplication code as shown below (don't worry about the accuracy of the code itself):

---------------------------------------------------

def matrix_mul(X, Y):

  result_matrix = [ [ 1 for i in range(len(X)) ] for j in range(len(Y[0])) ]

  # iterate through rows of X

  for i in range(len(X)):

    # iterate through columns of Y

    for j in range(len(Y[0])):

      # iterate through rows of Y

      for k in range(len(Y)):

        result_matrix[i][j] += X[i][k] * Y[k][j]


  return result_matrix


-----------------------------------------------


Then I called this function (matrix_mul) on my Ubuntu machine with large enough matrices so that the overall execution time was in the order of few seconds.


I used the below command to start profiling (you can also see the VTune version I used):

/opt/intel/oneapi/vtune/2021.1.1/bin64/vtune -collect hotspots -knob enable-stack-collection=true -data-limit=500 -ring-buffer=10 -app-working-dir /usr/bin -- python3 /home/johnypau/MyIntel/temp/Python_matrix_mul/mat_mul_method.py


Now open the VTune results in the GUI and under the bottom-up tab, order by "Module / Function / Call-stack" (or whatever preferred grouping is).


You should be able to see the the module (mat_mul_method.py in my case) and the function "matrix_mul". If you double click, VTune should be able to load the sources too. Please let me know if you still have difficulties viewing your code.


Regards,

Johny



0 Kudos
Johny_P_Intel
Employee
1,864 Views

Hi Rhonda99,


Can we assume that this issue is resolved? Did you get a chance to try this again as suggested above?


Regards,

Johny



0 Kudos
Johny_P_Intel
Employee
1,835 Views

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.


Regards,

Johny



0 Kudos
Reply