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
starting gui multisplit from code
Moderator: hines
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: starting gui multisplit from code
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:
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.
"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)
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.
Re: starting gui multisplit from code
Thank You,
Working Great!
Working Great!
-
- Site Admin
- Posts: 6300
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: starting gui multisplit from code
Write as little code as necessary. Saves time and effort, avoids mistakes.