varsim icon indicating copy to clipboard operation
varsim copied to clipboard

Add ability to specify maximum # of threads

Open choosehappy opened this issue 8 years ago • 1 comments

Depending on the desired number of lanes, a large number of threads can be launched which may overwhelm the system. Especially if [ number of lanes ] >> [ number of cpus]

Adding a command line argument to specify the maximum could be useful.

In my case, i've done a quick hack. Around line 431 of varsim.py, i added the following lines:

    lprocesses = []
    for i in xrange(args.nlanes):
        #.... snip.....
        art_stderr = open(os.path.join(args.log_dir, "art.lane%d.err" % (i)), "w")
        if len(lprocesses) >= MAX_NUMBER_THREADS:
            monitor_multiprocesses(lprocesses, logger)
            lprocesses = []

        # ....snip.....
        lprocesses.append(art_p)
        processes.append(art_p)

Where MAX_NUMBER_THREADS is specified elsewhere. This finishes a batch of "MAX_NUMBER_THREADS" lanes before continuing

choosehappy avatar Feb 19 '16 20:02 choosehappy

Thanks @choosehappy! I've made a note of this and will have a fix soon.

marghoob avatar Feb 19 '16 20:02 marghoob