© Copyright 1994 Maui High Performance Computing Center.

LINDA INTRODUCTION

  1. Overview
    1. What is Linda?
    2. The Linda Model
    3. Master/Worker Model using Virtual Shared Memory

  2. Linda Basics
    1. Definitions
    2. Operations
    3. Templates
    4. Template Matching Rules

  3. Example Code
    1. Fortran-Linda - Hello World
    2. C-Linda - Hello World
    3. Features Illustrated in Fortran Code
    4. Features Illustrated in C Code

  4. Linda Programming Environment
    1. Code Development System (CDS)
    2. Environment Setup
    3. Compilers

  5. Using Linda Code Development System
    1. The TupleScope Visual Debugger
    2. Tuple Class Windows
    3. TupleScope Run Modes
    4. The Debugger

  6. Exercise 1

  7. Arrays in C-Linda
    1. Array Specification
    2. Multidimensional Arrays
    3. Template Matching and Arrays

  8. Arrays in Fortran-Linda
    1. Array Specification
    2. Fortran 90 array subsection
    3. Template Matching and Arrays

  9. Hints and Miscellaneous

  10. Exercise 2,3,4...

  11. Acknowledgements and References

Overview: What is Linda?


Overview: The Linda Model




Overview: Master/Worker Model using Virtual Shared Memory





Linda Basics: Definitions


Linda Basics: Operations

There are four basic operations


Linda Basics: Templates


Linda Basics: Template Matching Rules


Example Code

Below is a simple example in the use of C and Fortran Linda. In this example, a master process creates a number of parallel "hello_world" processes, each of which prints the message:

"Hello world from process i"
where i is a different number for each process.

While both the C and Fortran versions exhibit the same behavior, they demonstrate two different termination strategies.


Example Code: Fortran-Linda - Hello World

C ******************************************************************
C File: hello_world.fl
C
C Simple Fortran Linda Example
C*******************************************************************
C
       subroutine real_main
       integer i, NPROC
       parameter (NPROC=8)
C
       out('count', 0)
       do 100 i=1, NPROC
       eval('worker', hello(i))
 100   continue
C
       in ('count', NPROC)
       print *, ' Hello world is finished'
       end
C
       subroutine hello(id)
       integer id, j
C
       print *, ' Hello world from process ',id
       in ('count', ?j)
       out ('count', j+1)
C
       return
       end

Example Code: C-Linda - Hello World


 /***********************************************************************
 * File: hello_world.cl
 *
 * Simple C Linda example
 ***********************************************************************/

 real_main(argc,argv)
 int argc;
 char *argv[];
 {
 int nworker, j, hello();
 nworker=atoi (argv[1]);

 for (j=0; j < nworker; j++)
   eval ("worker", hello(j));
 for(j=0; j < nworker; j++)
    in("done");

 printf("Hello_world is finished.\n");
 }

 /** subroutine hello **/

 int hello (i)
 int i;
 {
 printf("Hello world from number %d.\n",i);
 out("done");
 return(0);
 }


Example Code: Features Illustrated in Fortran Code

This example illustrates a number of features of Fortran-Linda:


Example Code: Features Illustrated in C Code

This examples illustrates the following features of C-Linda:


Linda Programming Environment

There are two execution models on the SP2:


Linda Programming Environment: Code Development System (CDS)


Linda Programming Environment: Environment Setup


Linda Programming Environment: Compilers




Using Linda Code Development System (CDS)

  • To use the CDS system, set the following environment variable to cds:

  • An example of setting the environment variable, compiling the "hello_world" program and running the executable is listed below.

  • Note that there is a warning of "no matching Linda op".


    Using Linda Code Development System: The TupleScope Visual Debugger

    To use TupleScope, you must compile with the

    -linda tuple_scope
    option and be using cds:

    using c shell

      %setenv LINDA_CLC cds
      %clc -o array.out -linda tuple_scope array.cl
    

    using korn shell

      %export LINDA_CLC=cds
      %clc -o array.out -linda tuple_scope array.cl
    

    Press this image to see a larger version.


    The TupleScope display consists of two parts: the control panel window and a separate window for each tuple class.


    Using Linda Code Development System: Tuple Class Windows


    Using Linda Code Development System: TupleScope Run Modes

    The TupleScope run modes are controlled by buttons in the control panel:
    
    
    

    Using Linda Code Development System: Using the Debugger


    Exercise 1


    Arrays in C-Linda: Array Specification

    In C-Linda operations arrays have the attribute of having a fixed or varying length.


    Arrays in C-Linda: Multidimensional Arrays


    Arrays in C-Linda: Template Matching and Arrays


    Arrays in Fortran-Linda: Array Specification

    In Fortran-Linda operations arrays have the attribute of having a fixed or varying length.


    Arrays in Fortran-Linda: Fortran 90 Array Sections


    Arrays in Fortran-Linda: Template Matching and Arrays

    
    
    
    


    Hints and Miscellaneous


    Exercise 2,3,4...

    
    
    
    

    Acknowledgements and References

    C-Linda User's Guide & Reference Manual, Version 2.5.2, Scientific Computing Associates, Inc.

    Fortran Linda User's Guide, Version 2.5.2, Scientific Computing Associates, Inc.

    Presentation materials, David Turner, Scientific Computing Associates, Inc., New Haven, CT

    We gratefully acknowledge David Turner of Scientific Computing Associates, for the use of his presentation materials and assistance in reviewing this documentation, and Scientific Computing Associates, New Haven, CT, for the use of portions of the C-Linda User's Guide & Reference Manual and Fortran Linda User's Guide materials.


    © Copyright 1994, Maui High Performance Computing Center. All rights reserved.

    Documents located on the Maui High Performance Computing Center's WWW server are copyrighted by the MHPCC. Educational institutions are encouraged to reproduce and distribute these materials for educational use as long as credit and notification are provided. Please retain this copyright notice and include this statement with any copies that you make. Also, the MHPCC requests that you send notification of their use to help@mail.mhpcc.edu.

    Commercial use of these materials is prohibited without prior written permission.

    Last revised: 3/20/95 Blaise Barney