Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jul 29, 2010 1:46 pm 
Offline
Senior Newbie

Joined: Mon Aug 04, 2008 1:35 pm
Posts: 5
I'm doing research into development of a computer vision algorithm to perform classification on a certain type of image. My prototype for the tester is written in Python, a file called "test.py". It runs through all of the images in a given directory, classifies them, prints data about them to the controlling terminal, and also stores the data in a CSV file. It does this in about 30 sec an image right now (need to speed it up later obviously).

When I only had 60 images I was running tests on, it completed successfully after about 25 minutes. I would usually run it in the background with:
Code:
nohup python test.py > test.out 2> test.err < /dev/null


I added more images to my directory so it is now 200+ images. Now the process keeps dying before completion! It just stops at a random point in the classification of an image. The process continues running at 1-2% CPU for a while, then usually it dies (sometimes it doesn't--I just noticed one that has been running for 16 hours at 1% CPU and 80% memory). I've tried it both backgrounded/nohuped and running it in the foreground. I'm starting to think this might be a problem with Linode.

Anybody encountered anything like this before? Any solutions?


Top
   
 Post subject:
PostPosted: Thu Jul 29, 2010 1:54 pm 
Offline
Junior Member

Joined: Mon Dec 28, 2009 2:52 pm
Posts: 29
What does dmesg say? Maybe it's being reaped by the kernel.

You can attach strace to a background process to see the syscalls it's executing.

You can similar things if you compile python with debug symbols and run it under gdb.


Top
   
 Post subject:
PostPosted: Thu Jul 29, 2010 4:43 pm 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
One suggestion: run the top command in an xterm window before starting. Either filter by user (your user name) or hit M (capital M) to sort by memory. Now run your program and watch the memory consumed with different numbers of images - 50, 100, 150, etc. and see what you find.

James


Top
   
 Post subject:
PostPosted: Thu Jul 29, 2010 7:01 pm 
Offline
Senior Newbie

Joined: Mon Aug 04, 2008 1:35 pm
Posts: 5
You called it. Python was just being a major memory hog, even though I del'd all of my variables and manually ran the garbage collector between loop iterations. I switched it to use multiprocessing and run each task as its own process. Works fine now. Thanks!


Top
   
 Post subject:
PostPosted: Fri Jul 30, 2010 9:07 am 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
Excellent.

James


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group