Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'output': 0.04; 'modify': 0.05; 'option,': 0.07; 'python': 0.09; 'received:mail- lpp01m010-f46.google.com': 0.09; 'sep': 0.09; 'suggest': 0.11; 'dhananjay': 0.16; 'processors': 0.16; 'stuff,': 0.16; 'subject:core': 0.16; 'subject:submit': 0.16; 'task.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'script.': 0.17; 'input': 0.18; 'module': 0.19; 'all,': 0.21; 'bit': 0.21; '3.2': 0.22; 'script': 0.24; 'header:In-Reply-To:1': 0.25; 'library.': 0.27; 'module.': 0.27; 'message-id:@mail.gmail.com': 0.27; 'subject:jobs': 0.29; 'received:209.85.215.46': 0.30; 'url:python': 0.32; 'file': 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'faster': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'url:org': 0.36; 'url:library': 0.36; 'should': 0.36; 'uses': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'first': 0.61; 'different': 0.63; 'jobs': 0.65; 'dear': 0.66; 'computers': 0.69; 'suited': 0.71; 'nagy': 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Jh4J2E3Inp6lq0CUXvXlXULXUUj/TrLonbrqFj3jiKM=; b=sMSDcU8kqIVAttTx3TY9FO6AqJKVTIxtCWdXEJFJECnSAy9s6ZmHsvnpwgiyJN1+Io PKSWnQ77OAJQHR7sQQoxwP6j4ED/73HFFpuRdCHkhlACown4lZQI5ZJ3v+V3b7Z6PVKv bBTNNSAurxKzodoMfdct7v5fVGuYG8+1QGl7KnrtkszwKZUsC6diV8HyhZM/chsV8gq/ 1TOA/7xuttNuoiH6wcXp+U+fvAj79AkECAYVkAvLUQ/46+w63devzMsNGAV/pfejtTL5 LNoIY1PEUtzOAp1DyAP09f259mhxk/ns/K66eUCIJysbSDpnqK+JvP/QkMsmrMMHgGkv uWGg== MIME-Version: 1.0 In-Reply-To: <504ED1EB.1080008@shopzeus.com> References: <504ED1EB.1080008@shopzeus.com> From: Ian Kelly Date: Tue, 11 Sep 2012 12:41:34 -0600 Subject: Re: submit jobs on multi-core To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347388927 news.xs4all.nl 6981 [2001:888:2000:d::a6]:52634 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28895 On Mon, Sep 10, 2012 at 11:53 PM, Laszlo Nagy wrote: > On 2012-09-11 06:16, Dhananjay wrote: >> >> Dear all, >> >> I have a python script in which I have a list of files to input one by one >> and for each file I get a number as an output. >> I used for loop to submit the file to script. >> My script uses one file at a time and returns the output. >> >> My computers has 8 cores. >> Is there any way that I could submit 8 jobs at a time and get all the >> output faster ? >> In other words, how can I modify my script so that I could submit 8 jobs >> together on 8 different processors ? >> >> I am bit new to this stuff, please suggest me some directions. > > You should first look at the multiprocessing module. It is part of the > standard library. > > http://docs.python.org/library/multiprocessing.html Or if Python 3.2 is an option, the concurrent.futures module would be very well suited for this task.