Re: parallel code in tclforce script

From: Axel Kohlmeyer (
Date: Thu Sep 05 2013 - 02:02:36 CDT

On Thu, Sep 5, 2013 at 8:45 AM, Norman Geist
<> wrote:
> I would expect NAMD to have the full TCL included, so therefore if it is
> possible in general with TCL, why not. If you google around a little "tcl
> parallel" "tcl threading" or what might be even more interesting "tcl mpi"
> you will find a lot. You will also find a nice looking tcl/mpi interface on
> Axels Homepage. In addition with a NAMD build against MPI, you might be able
> to use the same startup environment to run your tcl script on the same nodes
> out of namd directly.

i don't think the latter will work for two reasons:

1) you are only allowed call MPI_Init() once in an application, so you
would have to implement a way to pass the MPI communicator from
charm++ through NAMD to TclMPI
2) TclForces scripts are only called on the head node (unlike TclBC),
if i remember correctly

threading may be tricky as well, since threading in Tcl has been
supported for a while as a compile time option, it has not been
compiled in by default until the very latest release.

in any case, over many years i have observed that when people ask
about needing to parallelize script code, that the best solution is
usually a different one. thus what i would recommend to do is to first
benchmark how much time is spent on the TclForces script relative to
the total time of the time step. it only makes sense to optimize or
parallelize something that takes a lot of time. second, i would try to
optimize the script. many times, there is significant optimization
potential and then the need to parallelize may vanish. third, it may
be possible to write a C plugin to do the same task (same as many VMD
plugins have little "helper modules" written in C) to do the same task
and gain a significant speedup. at that level it would also be trivial
to include OpenMP based multi-threading for additional parallelization
at least on the head node.


> Norman Geist.
>> -----Ursprüngliche Nachricht-----
>> Von: [] Im
>> Auftrag von Teerapong Pirojsirikul
>> Gesendet: Donnerstag, 5. September 2013 05:03
>> An: NAMD list
>> Betreff: namd-l: parallel code in tclforce script
>> Hi NAMD users,
>> Anyone has any idea whether or not we can write a parallel code in
>> tclforce script. I have a 'for loop' that goes through a large no. of
>> atoms and would like to parallelize it.
>> Best,
>> Tee

Dr. Axel Kohlmeyer
International Centre for Theoretical Physics, Trieste. Italy.

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:21:37 CST