Ignore:
Timestamp:
Apr 6, 2015, 10:29:16 AM (9 years ago)
Author:
cfuguet
Message:

reconf: don't use all cpus when simulating with omp.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/reconfiguration/platforms/tsar_generic_iob/scripts/onerun.py

    r957 r969  
    99import argparse
    1010import multiprocessing
     11import math
    1112
    1213def run(args):
     
    117118    # OpenMP number of threads definition
    118119    ompthreads = args.threads
    119     if ompthreads < 0:
    120         if os.environ.get('SOCLIB_GDB') != None:
    121             ompthreads = 1
    122 
    123         elif args.debug != None:
    124             ompthreads = 1
    125 
    126         else:
    127             ompthreads = (args.x * args.y) / 4
    128             cpucount = multiprocessing.cpu_count()
    129             if ompthreads > cpucount: ompthreads = cpucount
     120    if ompthreads < 1:
     121        ompthreads = math.ceil(float(args.x * args.y) / 4)
     122
     123        # be nice and don't use all available processors
     124        maxcpu = math.ceil(float(multiprocessing.cpu_count()) * 2/3)
     125        if ompthreads > maxcpu: ompthreads = maxcpu
    130126
    131127    command.extend(["-THREADS", str(ompthreads)])
     
    191187
    192188    parser.add_argument(
    193         '--threads', '-t', dest='threads', default=-1,
     189        '--threads', '-t', type=int, dest='threads', default=1,
    194190        help='number of OpenMP threads')
    195191
Note: See TracChangeset for help on using the changeset viewer.