From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Tue Jan 06 2009 - 10:06:25 CST

On Tue, 6 Jan 2009, Maxim Paliy wrote:

MP> Dear VMD experts,
MP> My tcl scripts start to go slowly because of big nested loops,
MP> and I wonder if it is possible at all
MP> to execute a part of a tcl script in parallel
MP> (e.g. to spread a big independent loop around)?

not directly.

MP> my VMD recognizes 4 processors on the linux machine where it is run.
MP> but not speedup of tcl is noticeablle.
MP> I've red a note somewhere that VMD can execute some tasks in parallel,
MP> though..

the tcl interpreter is not threaded.

threading support (as well as GPGPU support) is incrementally
added to some of the commands that VMD adds to the tcl
interpreter and - in principle - you can write your own using
the tcl plugin/dso mechanism. you would be most welcome
to help with this, there is still a lot of work to do.

how much you would benefit from multithreading, however,
depends a lot on what VMD functionality you use and how your
scripts are written. multi-threading will not help you a
lot, if you script code scales badly with problem set size
and you may be better off optimizing your script code first.

particularly, if you have many levels of loop nesting, then
you may gain a lot from moving loop invariant data out of
the loop and storing the precomputed results somewhere.

once you have exhausted that possibility, you could consider
rewriting some of the more time-consuming parts as a DSO
and (optionally) parallelize it.

cheers,
   axel.

MP>
MP>
MP> Thank you in advance for your suggestions,
MP> Maxim
MP>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
=======================================================================
If you make something idiot-proof, the universe creates a better idiot.