|
Title: Mac OS X - not using full CPU % in top Post by: belson17 on March 20, 2010, 10:59:16 PM Hi,
I've written a parallel python program and I'm running it on a Mac Pro with 8 cores, but I've noticed that sometimes all of the processors are hardly used. Looking at the output of "top", they hover around 1-5% usage when they should be in the 90-100% range. It's especially odd because sometimes the processors are fully used, depending on the parameters of my program. It only seems to be a problem for large runs (just my luck!), and I can't see a pattern. Has anyone else had this problem? I'm attaching a small part of the code below but it might be a bit hard to understand as it's part of a more complicated script. Code: # The following submits jobs and then retrieves the results jobs=[] modulesNeeded = ("numpy","field","terminalColors","innerProduct","transforms",\ "struct","re","IOBla","subprocess","copy") #"h5py" eventually for r in range(0,numRowChunks): #for c in range(0,numColChunks): functionArgs = (forwardFiles,adjointFiles[rowList[r]:rowList[r+1]],parf,\ numModes,fileType,maxSnapshotsList) jobs.append(job_server.submit(formM,functionArgs,(),modulesNeeded)) M = numpy.zeros((numRows,numCols)) for r in range(0,numRowChunks): M[rowList[r]:rowList[r+1],:] = jobs[r]() Thanks! Title: Re: Mac OS X - not using full CPU % in top Post by: ppdnam on March 24, 2010, 11:10:58 AM Hi,
Promise I'm not following you! I actually came on to post something similar to this issue I've been experiencing... I'm running an 8-core Opteron 2380 with 64Gb RAM, running FC11, 2.6.30.10-105.fc11.x86_64 I'm using Python 2.6 and pp 1.5.7. I set 16 workers on a task with ~70 jobs (SMP, of course). The nature of these jobs varies, and for most methods, "top" shows 16 python instances all hammering the CPU. One particular task, however, once submitted, tends to run on the parent python process - ie, after one job finishes, the next starts (I guess this is "serial python"!) Sometimes, I get a couple of jobs farmed out to the waiting python processes, but rarely - the bulk of the work is done by the python process itself. I can't easily ascertain if the processor load is due to the distribution of the arguments to the workers, or if it is doing the job itself (I suspect the latter). It is worth noting that the amount of data sent as arguments in this method is quite high. As with the OP, reducing the number of runs tends to farm out all the jobs to the workers. I wonder - is there some "judgment" as to when the job is run locally rather than shipped out? Perhaps this is based on the time it would take to pickle the args as well as the number of workers? I can't really provide any code-snippets as the code is a behemoth, and more than a little involved! FWIW, I'm not using restart, nor have I changed the pickle protocol: Code: job_server = ppserver.Server(ncpus,ppservers=ppservers) Hope this adds to the discourse! D Title: Re: Mac OS X - not using full CPU % in top Post by: Vitalii on May 10, 2010, 01:45:07 AM Submitted tasks never actually run on parent process.
If that process is the one with high load the reasons might be: 1) time to pickle is higher then execution time 2) heavy callback method |