-
Notifications
You must be signed in to change notification settings - Fork 13
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
1D plots are taking longer than expected #195
Comments
Script from @doutriaux1 import vcs
n = 500
import time
x=vcs.init(bg=True)
for i in range(n):
print i
start = time.time()
gm = vcs.create1d()
x.plot([1,2,3,4,5,4,3,2,1],gm)
x.png("crap")
end = time.time()
print "Time:", end-start
x.clear()
x.removeobject(gm) I will fix look into this. 0 |
@danlipsa @doutriaux1 this looks eerily like CDAT/cdat#1424 #83, CDAT/cdat#2040, CDAT/cdat#2135 |
@durack1 Indeed. I was just looking for that issue to reference it here. 😄 |
@danlipsa once the problem that is underlying all these is rectified I think you'll be able to close 10+ open issues across the different repos.. I know that @chaosphere2112 had started some work to address these quite sometime ago, not sure if there is a branch somewhere that could be revisited? |
@danlipsa @durack1 it does not seem like we have new vcs objects created though as the following updated script shows: import vcs
n = 10
import time
x=vcs.init(bg=True)
fastest = 100000.
elements = vcs.listelements()
cpy = vcs.elements.copy()
for i in range(n):
print i,
start = time.time()
gm = vcs.create1d()
x.plot([1,2,3,4,5,4,3,2,1],gm)
x.png("crap")
end = time.time()
elapsed = end - start
if elapsed < fastest:
fastest = elapsed
print "Time:", elapsed, "%.2i" % (elapsed/fastest*100.)
x.clear()
x.removeobject(gm)
for e in elements:
print "\t",e,len(vcs.elements[e])
if len(vcs.elements[e])!=len(cpy[e]):
print "\tMore elements in:",e,len(vcs.elements[e]) output:
|
I suspect that somehow the objects stay in memory, @danlipsa could there be vtk objects left somewhere? |
interestingly enough, the following keeps the speed constant, ther only diff is that we create a new canvas object each and everytime! @zshaheen you might want to try this in the mean time import vcs
n = 10
import time
fastest = 100000.
elements = vcs.listelements()
cpy = vcs.elements.copy()
for i in range(n):
x=vcs.init(bg=True)
print i,
start = time.time()
gm = vcs.create1d()
x.plot([1,2,3,4,5,4,3,2,1],gm)
x.png("crap")
end = time.time()
elapsed = end - start
if elapsed < fastest:
fastest = elapsed
print "Time:", elapsed, "%.2i" % (elapsed/fastest*100.)
x.clear()
x.removeobject(gm)
for e in elements:
print "\t",e,len(vcs.elements[e])
if len(vcs.elements[e])!=len(cpy[e]):
print "\tMore elements in:",e,len(vcs.elements[e]) |
@doutriaux1 VTK objects stay in memory (as they should) if there are python objects referring to them. My concern is that we should determine the cause for the slowdown the rather then working on the first problem we find. Can you run your script a couple of hundred times to see how much slower plot gets? We start with one plot a second. How long does a plot take after 500 iterations? |
@danlipsa but doing a |
@danlipsa in there: https://github.com/UV-CDAT/vcs/blob/master/vcs/VTKPlots.py#L330-L360 are we removing all vtk objects? |
@doutriaux1 Not sure. I see that we delete all renderers on layers different than 0, but I am not sure if thats all. We have to be left with one renderer after that. Can you print the number of renderers in each of your iterations? (I think you have to do one of those loops as it does not seem to be a function that directly returns the number of renderers). Alternatively, there is VTK_DEBUG_LEAKS:BOOL=ON that will print VTK objects that are not removed at the end of a program. Before we invest more time in this, how many seconds is a plot taking at iteration 500? |
@danlipsa 500 iteration:
|
@doutriaux1 That's bad! We should track this down and fix it. |
@doutriaux1 Hopefully today I'll finish a different project I've been involved in since yesterday. I'll finish up the streamlines and then I can look at this probably toward the end of the week. |
@doutriaux1 When I run your latest script on my machine, I get the the slowdown of about 20% after 400 iterations. Do you guys use mesa? |
@danlipsa yes I'm using mesa. |
@doutriaux1 @aashish24 @williams13 Indeed, with nox, I see times comparable with yours. A side note - An 'easy' way to beat matplotlib at rendering spead is to switch to a hardware accelerated driver. We'll get a factor of 4 increase in plotting speed for free - maybe more for more complex plots. |
@danlipsa I'd also add that with the speed increase comes the maintenance headache of maintaining driver-reliant code.. So "it works everywhere" may just not be the case |
1D plots slowdown because an extra renderer is added to the render window at each iteration.
1D plots slowdown because an extra renderer is added to the render window at each iteration.
the context here is diagnostics which is taking 3 times longer than other comparable codes.
@danlipsa @doutriaux1 @danlipsa
The text was updated successfully, but these errors were encountered: