[Cook] parallel confusion

Jerry Pendergraft jerry at endocardial.com
Sat Jun 21 14:07:54 EST 2003


On Fri, 20 Jun 2003, Jody Hagins wrote:

> 
> I am trying to cook in parallel (actually using multiple machines). 
> Misunderstanding of several comments in the UG have caused terrible
> confusion.
> 
> Specifically, when I write a recipe, do all local variables have to have
> thread IDs?
No - if you use the local keyword, they are thread safe.
> 
> What is the granularity of an ET (execution thread)?
> 
> Does the entire recipe run in the same ET, or is it possible for each
> command within a recipe to be run in separate ETs?
You should try to keep each recipe to a single command. Because multiple
commands will definately run in different threads, even on different
machines. Having said that, remember you can do many things in a
"single" command for example on of my more pathalogical ones:

   local cmd = [unsplit " " [catenate "PATH=" [getenv PATH]]
      \[ -d [ts_C_dir] \] || mkdir [ts_C_dir] &&
      /usr/local/bin/build_test_script --debug [ts_src] [C_file] &&
      [compile-cmd %1 %2] [target_flags]
        -D[catenate ARCH [arch-to-identifier %1]]
        '-DRCS_ID\="'%3_ID'"' -c [C_file]
        -o [target]                        &&
      [post_proc] [C_file]] ;

    [cmd];

Note the && makes this series of commands be treated as one single one.

> 
> If all variables are shared among all ETs, then is it safe to reference
> target, need, and other builtin variables, or will they take on the
> value of the most recent ET?
Those, along with any you declare with local are thread save.
> 
> When I build local variables, do they all need to have thread-id
> somewhere in their name, or is this just the case for global variables?
Actually I don't see how thread-id is much use for global variables.
> 
> Is there some way to declare a variable as per-thread, so it does not
> always have to be referenced as [myvar[thread-id]]?
As above  local myvar = ...
is per thread.
> 
> Does anyone have any cookbooks that run correctly and safely in parallel
> mode?
I have lots. I regularly build large projects in parallel across multiple
machines of some 4 separate architecture types.

> 
> 
> 
> Again, I really appreciate all the help.  Someday I will be supplying
> assistance, instead of being the one requiring it all the time...
Great - all the better.
> 
> 
> Thanks again!
> 
> 
> 




More information about the Cook-users mailing list