Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'no stats' when profiling numpy on anaconda 3.5 #80

Open
trofimander opened this issue Jun 23, 2016 · 10 comments
Open

'no stats' when profiling numpy on anaconda 3.5 #80

trofimander opened this issue Jun 23, 2016 · 10 comments

Comments

@trofimander
Copy link
Contributor

trofimander commented Jun 23, 2016

Profiling the following script:

import numpy as np

n = 5000
a = np.random.random((n, n))
b = np.random.random((n, n))
c = np.dot(np.abs(a), b)

Produces:

macbook-pro-4:test_profiler0 traff$ /Users/traff/anaconda/bin/python3.5 -m vmprof test_numpy.py 
no stats
macbook-pro-4

Mac OSX 10.11.5
Anaconda 3 - 4.0.0 - 64
vmprof 0.2.7

@jonashaag
Copy link
Contributor

First, if your program takes only a few milliseconds to run, that may be too fast for vmprof to collect any data at all. Second, vmprof collects only data about pure Python code, but numpy is implemented almost entirely in C, which is why you won't see anything useful with your example.

Btw does anyone know of a Python profiler that can look into the C stack?

@methane
Copy link
Contributor

methane commented Jun 23, 2016

Released version doesn't support Python 3.5.1. See #60

@trofimander
Copy link
Contributor Author

@methane Thanks!

@trofimander
Copy link
Contributor Author

@fijal Could you please release the fix?

@fijal
Copy link
Member

fijal commented Jun 27, 2016

I've release the fix

@fijal fijal closed this as completed Jun 27, 2016
@fijal
Copy link
Member

fijal commented Jun 27, 2016

To be precise: I've release the mentioned pull request, but not the fix for this issue, will reopen that one

@fijal fijal reopened this Jun 27, 2016
@planrich
Copy link
Contributor

I have tried the same script now with 0.4.3 on mac os x 10.12.3. It revealed an issue on mac: a signal is delivered after vmprof.disable() is called (which terminated the program with SIGPROF). The signal handler is now set to SIG_IGN (signal ignore) which passes. I'm trying to find a better solution though.

Here is the native profile:
http://vmprof.com/#/567aa150-5927-4867-b22d-dbb67ac824ac

@liufuyang
Copy link

Okay I seem encountered this issue, tired with python 3.5.1 or 3.6.1 both not working.
vmprof version 0.4.3

python -m vmprof -o output.log xx.py

(xx.py print stuff and output.log generated)

vmprofshow output.log

Traceback (most recent call last):
  File "/Users/fuyangliu/Tradeshift/supplier-matching/python3.6-env/bin/vmprofshow", line 11, in <module>
    sys.exit(main())
  File "/Users/fuyangliu/Tradeshift/supplier-matching/python3.6-env/lib/python3.6/site-packages/vmprof/show.py", line 160, in main
    pp.show(args.profile)
  File "/Users/fuyangliu/Tradeshift/supplier-matching/python3.6-env/lib/python3.6/site-packages/vmprof/show.py", line 64, in show
    tree = stats.get_tree()
  File "/Users/fuyangliu/Tradeshift/supplier-matching/python3.6-env/lib/python3.6/site-packages/vmprof/stats.py", line 106, in get_tree
    top = self.get_top(self.profiles)
  File "/Users/fuyangliu/Tradeshift/supplier-matching/python3.6-env/lib/python3.6/site-packages/vmprof/stats.py", line 97, in get_top
    raise EmptyProfileFile()
vmprof.stats.EmptyProfileFile

Is this a related problem?

Stuff in xx.py

def f_a():
    for x in range(100):
        print(x)

if __name__=='__main__':
    f_a()

@planrich
Copy link
Contributor

planrich commented Apr 1, 2017

it seems that 100 iterations is not enough for a single signal to occur. I get the same issue, try to run at least 1000 iterations...

planrich added a commit that referenced this issue Apr 1, 2017
…isplay a profile that really has not point in looking at)
@planrich
Copy link
Contributor

planrich commented Apr 1, 2017

It now displays the following (the warning is only displayed if the profiling took less than 1 second):

WARNING: The profiling completed in less than 1 seconds. Please run your programs longer!
No stack trace has been recorded (profile is empty)! Did your program not run long enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants