starting gui multisplit from code

General issues of interest both for network and
individual cell parallelization.

Moderator: hines

Post Reply
oren
Posts: 55
Joined: Fri Mar 22, 2013 1:03 am

starting gui multisplit from code

Post by oren »

Hi
I have what seems to be a weird question. Usually when I want to do multisplit on a model that I am running. I do:
Tools-> Parallel Computing -> threads=8 & Multiplit on
Refresh

and it works. But I can't seems to find the correct commands so that this clicks will be automatically run from the code,
When I do the following code:

pc.nthread(8)
pc.multisplit()

I do not see any improvement in the speed of the simulation. Only when I click on the gui on Multisplit checkbox I then see any effect on the simulation time..
I understand that there need to be some kind of load balance command, but I can't seem to find it.

How can I activate the gui Multisplit() command via code?

Thank You
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: starting gui multisplit from code

Post by ted »

The simplest way to proceed is to first save a configured ParallelComputeTool to a session file. Then you can load that session file and you'll get multithreaded execution, but the only line of code you have to write is a load_file() or xopen() statement that reads the ses file.

"Oh, but I might want to change the number of threads."

Easy. After you load the ses file, there will be an instance of the ParallelComputeTool class called ParallelComputeTool[0]. Just do this:

Code: Select all

// assumes the number of threads you want is called nthr
objref pct
pct = ParallelComputeTool[0]
object_push(pct)
change_nthread(nthr, 1)
object_pop(pct)
You can also turn multsplit on and off--just substitute
multisplit(1) // 0 to turn off
for the change_nthread() statement.

Be sure to read the Programmer's Reference about object_push() and object_pop(). Also examine the ParallelComputeTool's .ses file, and look in the hoc library at the contents of parcom.hoc and maybe you'll get some new ideas.
oren
Posts: 55
Joined: Fri Mar 22, 2013 1:03 am

Re: starting gui multisplit from code

Post by oren »

Thank You,
Working Great!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: starting gui multisplit from code

Post by ted »

Write as little code as necessary. Saves time and effort, avoids mistakes.
Post Reply