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

Unable to view source code when analyzing results

Spiekermann__Kevin
2,065 Views

Hello Intel Team,

I'm trying to run an academic license of VTune 2019 on a linux server with a simple Python file, test.py. I used the command line interface to collect data using: amplxe-cl -collect hotspots -r vtune_test_hotspots_results -run-pass-thru=--no-altstack python test.py I used the argument -run-pass-thru=--no-altstack based on multiple sources to remove an initial error about the stack size being too small

Source 1: http://hpc.ipp.ac.cn/wp-content/uploads/2015/12/documentation_2016/en/vtune_amplifier_xe/help/GUID-1A7D0D66-2BC0-4643-94AF-578A0BF22801.htm

Source 2: https://scc.ustc.edu.cn/zlsc/tc4600/intel/2017.0.098/vtune_amplifier_xe/help/GUID-5FA4AC5B-EF89-40A1-BF59-44D5EFB12BDA.html

I used amplxe-gui with X11 forwarding to view the results on my local machine (MacOS). However, I can only view the assembly code, as shown in the screenshot below. Can you please help me understand what I must do to view the source code? For some reason, I was not allowed to upload a .py file so simply change the extension to test.py and run with Python 3.7 to reproduce my issue. The file takes ~10 seconds to run. The output displayed at the command line has also been included below. I'm wondering if the warning "amplxe: Warning: Cannot locate debugging information for file ..." is part of the issue. Please let me know how to resolve that.

From reading other forum posts, I found some potential options such as specifying a search path and using Intel’s JIT Profling API, but I am unsure how to implement these or if there is a better/easier way to approach this problem. Thank you for your help.

 

0 Kudos
5 Replies
Spiekermann__Kevin
2,065 Views

Just making sure the Intel team has seen this. I'm still having trouble viewing the source code for Python files, and a response would be greatly appreciated. Thanks!

0 Kudos
Jennifer_D_Intel
Moderator
2,065 Views

Hi Kevin,

I'm looking into this. The first thing I should mention is that General Exploration, or Microarchitecture Exploration, does not support Python analysis. Only Hotspots, Threading, and Memory Consumption analysis types are supported. 

Secondly, you may need to set -source-search-dir=<path to sources> in your amplxe-cl command line so VTune can find them during finalization. If the results look correct but are just missing source files, I don't think you'll need to set up the JIT API.

I'll run some more test and see if there's something I'm missing.

0 Kudos
Spiekermann__Kevin
2,065 Views

Thank you for your reply and my apologies for the delay. Thanks for confirming which types of analysis VTune currently supports with Python. I think hotspots and memory consumption would be useful for my analysis if I could get them to work.

I tried adding the argument -source-search-dir so my entire command was

$ amplxe-cl -collect hotspots -run-pass-thru=-no-altstack -source-search-dir=/home/kspieker/test.py python test.py

I also tried

-source-search-dir=/home/kspieker/

so that it just searched for the corresponding directory. Unfortunately, these options did not work so I am still unable to view the source code. As shown in the image below, the option to view source code is always grayed out, so I can only view assembly code. As shown in the command line output below, there are many lines of

amplxe: Warning: Cannot locate debugging information for file ...

Is this warning relevant to my issue? Are you able to run test.py whose code is below? It simply runs a mildly intensive task while multiprocessing, which is representative of a larger code I want to analyze later. Do you have additional suggestions I can try? Or perhaps a different example that works for you? Thank you for your help

 

import numpy as np
import scipy.signal
import psutil
import time
from multiprocessing import Pool
import time

num_cpus = psutil.cpu_count(logical=False)
print(num_cpus)

def f(random_filter):
    # Do some image processing.
    return scipy.signal.convolve2d(image, random_filter)[::5, ::5]

image = np.zeros((3000, 3000))
filters = [np.random.normal(size=(4, 4)) for _ in range(num_cpus)]

pool = Pool(num_cpus)

# Time the code below.
start = time.time()
for _ in range(10):
    pool.map(f, filters)

end = time.time()
print('Elapsed time was {:.3f}'.format(end-start))

 

0 Kudos
Vasilij_L_Intel
Employee
2,065 Views

Hi Kevin,

 

There's known limitation that your code should contain "deep enough" stack at least once for VTune to be able to resolve Python symbols. Usually making a main() function and calling it from script body is enough.

 

As for missing "debugging information" it's probably because Python you use is missing debug symbols. They aren't needed for you to see Python code as it is obtained by other means, so if you're not interested in looking into native (non-Python) side of things you can safely ignore this warning.

 

Thanks,

Vasilij

0 Kudos
Spiekermann__Kevin
2,065 Views

Hi Vasilij,

Thanks for your quick reply. Good to know that the many warnings about not locating debugging information probably don't apply. I tried making a main() function and calling that (as shown below). However, the problem persists in that I can't figure out how to view VTune's analysis of the source code. It only shows assembly code and the button for "Source" is still grayed out, even after specifying the search directory when using amplxe-cl. Can you provide a working example and possibly screenshots of what you see on your end so I can try to reproduce?

Thanks for your help,

Kevin

 

import numpy as np
import scipy.signal
import psutil
import time
from multiprocessing import Pool
import time

def f(random_filter):
    # Do some image processing.
    image = np.zeros((3000, 3000))
    return scipy.signal.convolve2d(image, random_filter)[::5, ::5]

def main():
	num_cpus = psutil.cpu_count(logical=False)
	print(num_cpus)
	
	filters = [np.random.normal(size=(4, 4)) for _ in range(num_cpus)]

	pool = Pool(num_cpus)

	# Time the code below.
	start = time.time()
	for _ in range(10):
	    pool.map(f, filters)

	end = time.time()
	print('Elapsed time was {:.3f}'.format(end-start))

if __name__ == "__main__":
	main()

 

0 Kudos
Reply