Commit 91873c42 authored by Aflitos, Saulo Alves's avatar Aflitos, Saulo Alves
Browse files

Added automatic adding of CPU's

parent fc0b1bdb
......@@ -22,6 +22,18 @@ def my_decider(dependency, target, prev_ni):
return not os.path.exists(str(target))
env.Decider(my_decider)
# How many CPU's can we use ?
import multiprocessing
num_cpu = multiprocessing.cpu_count()
if env.GetOption('num_jobs') <= 1:
env.SetOption('num_jobs', num_cpu)
num_threads = num_cpu/4
else:
num_threads = env.GetOption('num_jobs')
print "running with -j", GetOption('num_jobs')
# Set number of simultaneous threads to something less than the number of CPUs
# /CPUs
#############
## Scanner ##
#############
......@@ -143,7 +155,7 @@ for fileType in data:
print " ", fileType , "REVSEQ", fileName, ">", [str(x) for x in res]
print " ", fileType , "BWA IN ",[str(x) for x in res ]
mpMap = addCommand("bwa aln -t 80 %(PREFIX)s %(SOURCE)s > %(TARGET)s", {"TARGET": mapName, "SOURCE": res, "PREFIX": PREFIX})
mpMap = addCommand("bwa aln -t %(NUM_THREADS)d %(PREFIX)s %(SOURCE)s > %(TARGET)s", {"NUM_THREADS":num_threads, "TARGET": mapName, "SOURCE": res, "PREFIX": PREFIX})
print " ", fileType , "BWA OUT",[str(x) for x in mpMap]
Depends( mpMap, bwtRes )
data[fileType][fileName][0] = res
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment