Changes between Version 18 and Version 19 of Tutorials

Show
Ignore:
Timestamp:
09/12/13 11:15:20 (11 years ago)
Author:
jorisborgdorff
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials

    v18 v19  
    1313 
    14142. To add MUSCLE to the path and set a few environment variables, run the following (don't forget the dot at the start!): 
    15   {{{ 
    16    . [MUSCLE_DIR]/etc/muscle.profile 
    17   }}} 
     15 {{{ 
     16  . [MUSCLE_DIR]/etc/muscle.profile 
     17 }}} 
    1818 
    19193. Now you can run `muscle2`. We will show its functionality with an example model that is packaged with MUSCLE. First go to the unzipped MUSCLE folder, and try to read `src/cxa/SimpleSubmodelExample.cxa.rb` and see what it does. To show the submodels that the example contains, run: 
    20   {{{ 
    21    cd .. 
    22    muscle2 --cxa src/cxa/SimpleSubmodelExample.cxa.rb  
    23   }}} 
    24  
    25   This example has a writer submodel `w` and a reader submodel `r`. The writer sends data to the reader, and the reader prints that data to screen. 
    26  
    27   You can run the simple example by specifying that the current MUSCLE command will run the Simulation Manager with the `--main` flag or its shorthand `-m`, and specifying all submodels that should run in this command: 
    28   {{{ 
     20 {{{ 
     21  cd .. 
     22  muscle2 --cxa src/cxa/SimpleSubmodelExample.cxa.rb  
     23 }}} 
     24 
     25 This example has a writer submodel `w` and a reader submodel `r`. The writer sends data to the reader, and the reader prints that data to screen. 
     26 
     27 You can run the simple example by specifying that the current MUSCLE command will run the Simulation Manager with the `--main` flag or its shorthand `-m`, and specifying all submodels that should run in this command: 
     28 {{{ 
    2929 muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w r 
    30   }}} 
    31  
    32   Usually, if you want to run all the submodels instances with the current MUSCLE command, specify the `--allinstances` or its shorthand `-a`: 
    33   {{{ 
    34   muscle2 -amc src/cxa/SimpleSubmodelExample.cxa.rb 
    35   }}} 
    36  
    37   So what do we observe? MUSCLE detects that it should start the Simulation Manager and a Simulation. It first starts the manager, which shows its TCP/IP address. Then the Simulation starts and it executes the submodel instances `w` and `r`. These start their respective conduits, and start 'computing'. 
    38  
    39   On local machines, these commands are sufficient to run any MUSCLE model. You can try the other examples in the `src/cxa` directory, just run 
    40   {{{ 
    41   muscle2 -amc src/cxa/[...].cxa.rb 
    42   }}} 
     30 }}} 
     31 
     32 Usually, if you want to run all the submodels instances with the current MUSCLE command, specify the `--allinstances` or its shorthand `-a`: 
     33 {{{ 
     34 muscle2 -amc src/cxa/SimpleSubmodelExample.cxa.rb 
     35 }}} 
     36 
     37 So what do we observe? MUSCLE detects that it should start the Simulation Manager and a Simulation. It first starts the manager, which shows its TCP/IP address. Then the Simulation starts and it executes the submodel instances `w` and `r`. These start their respective conduits, and start 'computing'. 
     38 
     39 On local machines, these commands are sufficient to run any MUSCLE model. You can try the other examples in the `src/cxa` directory, just run 
     40 {{{ 
     41 muscle2 -amc src/cxa/[...].cxa.rb 
     42 }}} 
    4343 
    44444. Scientific applications that are started remotely generally do not have a direct feedback to a user interface, but we will run one that does. This is why we logged in with the -X flag of SSH in step 2. 
    45   {{{ 
    46   muscle2 -amc src/cxa/LaplaceExample.cxa.rb 
    47   }}} 
    48  
    49   It will open two windows that compute temperature dissipation, that are coupled on the boundary. Red is a +1 temparature, blue a -1 temperature, and green a zero temperature. The initial condition, far right and far left correspond to zero temperature, the top to a sine function and the bottom to a cosine. Temperature is dissipated during each time step by taking the average of the four neighboring cells. The adjacent boundary is transmitted each iteration. 
     45 {{{ 
     46 muscle2 -amc src/cxa/LaplaceExample.cxa.rb 
     47 }}} 
     48 
     49 It will open two windows that compute temperature dissipation, that are coupled on the boundary. Red is a +1 temparature, blue a -1 temperature, and green a zero temperature. The initial condition, far right and far left correspond to zero temperature, the top to a sine function and the bottom to a cosine. Temperature is dissipated during each time step by taking the average of the four neighboring cells. The adjacent boundary is transmitted each iteration. 
    5050 
    51515. Take a look at all the options by running 
    52   {{{ 
     52 {{{ 
    5353 muscle2 
    54   }}} 
     54 }}} 
    5555 
    5656== Part 2: distributed execution == 
     
    5959 
    60601. Open a second terminal, and log in to another machine, or try it on the same machine. When logged in do 
    61   {{{ 
    62    . [MUSCLE_DIR]/etc/muscle.profile 
    63   }}} 
    64  
    65   Then go to the unzipped MUSCLE directory. Now we can run muscle on the same site. In the first terminal window, start the main MUSCLE with the writing submodel w. This is done by typing: 
    66   {{{ 
    67    muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w 
    68   }}} 
    69  
    70   So what do you observe? 
    71  
    72   One of the most important messages is `Started the connection handler, listening on [IPADDRESS:PORT]`. 
    73   Copy the IP address and port number.  
    74   In the second terminal, start the reading submodel r, and at the end put the `-M` or `--manager` flag 
    75   with the IP address and port: 
    76   {{{ 
    77    muscle2 -c src/cxa/SimpleSubmodelExample.cxa.rb r -M [IPADDRESS:PORT] 
    78   }}} 
    79  
    80   What happens in both terminals? 
     61 {{{ 
     62  . [MUSCLE_DIR]/etc/muscle.profile 
     63 }}} 
     64 
     65 Then go to the unzipped MUSCLE directory. Now we can run muscle on the same site. In the first terminal window, start the main MUSCLE with the writing submodel w. This is done by typing: 
     66 {{{ 
     67  muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w 
     68 }}} 
     69 
     70 So what do you observe? 
     71 
     72 One of the most important messages is `Started the connection handler, listening on [IPADDRESS:PORT]`. 
     73 Copy the IP address and port number.  
     74 In the second terminal, start the reading submodel r, and at the end put the `-M` or `--manager` flag 
     75 with the IP address and port: 
     76 {{{ 
     77  muscle2 -c src/cxa/SimpleSubmodelExample.cxa.rb r -M [IPADDRESS:PORT] 
     78 }}} 
     79 
     80 What happens in both terminals? 
    8181 
    82822. To isolate the output from the Simulation Manager, we can run it separately. 
    8383 
    84   In the first terminal window, start the Simulation Manager: 
    85   {{{ 
    86    muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb 
    87   }}} 
    88  
    89   In the second terminal, start the submodels. Again, replace the port number 
    90   with the one that is printed by the Simulation Manager. 
    91   {{{ 
    92    muscle2 -ac src/cxa/SimpleSubmodelExample.cxa.rb -M [IPADDRESS:PORT] 
    93   }}} 
    94  
    95   What happens in both terminals? 
     84 In the first terminal window, start the Simulation Manager: 
     85 {{{ 
     86  muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb 
     87 }}} 
     88 
     89 In the second terminal, start the submodels. Again, replace the port number 
     90 with the one that is printed by the Simulation Manager. 
     91 {{{ 
     92  muscle2 -ac src/cxa/SimpleSubmodelExample.cxa.rb -M [IPADDRESS:PORT] 
     93 }}} 
     94 
     95 What happens in both terminals? 
    9696 
    97973. To do distributed computing, also install MUSCLE on another node 
    98   {{{ 
    99   ssh user@node2 
    100   [INSTALL MUSCLE...] 
    101   . MUSCLE_DIR/etc/muscle.profile 
    102   }}} 
    103  
    104   And go to the source directory of MUSCLE. We will perform the same experiment, 
    105   but now on different hosts. So on the first node, for instance run only `w` 
    106   {{{ 
    107   muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w 
    108   }}} 
    109  
    110   On the other node, we now also need to specify which host and port the other 
    111   MUSCLE instance is running on 
    112   {{{ 
    113    muscle -c src/cxa/SimpleSubmodelExample.cxa.rb -M [IPADDRESS:PORT] r 
    114   }}} 
    115  
    116   What is the output in node one? And on the other? 
     98 {{{ 
     99 ssh user@node2 
     100 [INSTALL MUSCLE...] 
     101 . MUSCLE_DIR/etc/muscle.profile 
     102 }}} 
     103 
     104 And go to the source directory of MUSCLE. We will perform the same experiment, 
     105 but now on different hosts. So on the first node, for instance run only `w` 
     106 {{{ 
     107 muscle2 -mc src/cxa/SimpleSubmodelExample.cxa.rb w 
     108 }}} 
     109 
     110 On the other node, we now also need to specify which host and port the other 
     111 MUSCLE instance is running on 
     112 {{{ 
     113  muscle -c src/cxa/SimpleSubmodelExample.cxa.rb -M [IPADDRESS:PORT] r 
     114 }}} 
     115 
     116 What is the output in node one? And on the other? 
    117117 
    118118**Related:** inter-cluster executions can be done with the `--intercluster` tag, 
     
    1461461. Try the different scenarios and see what the differences are between the configuration files. 
    1471472. Modify the configuration files to get different geometries or transformations. For example (pick one): 
    148   * add a submodel instance so that you get a coupling between West - Middle - East; 
    149   * change the filters and see how it affects the computations (see [wiki:Configuration#Filters Filter documentation]); or 
    150   * modify the file `src/laplace/filter/InvertFilter` to do something additional (see [wiki:"Java API#Filters" Java filter documentation]) 
    151   * modify the file `src/laplace/terminal/DoubleArraySource.java` to do something additional, such as computing a function instead of sending a fixed number (see [wiki:"Java API#Terminals"  Java terminal documentation]) 
     148 * add a submodel instance so that you get a coupling between West - Middle - East; 
     149 * change the filters and see how it affects the computations (see [wiki:Configuration#Filters Filter documentation]); or 
     150 * modify the file `src/laplace/filter/InvertFilter` to do something additional (see [wiki:"Java API#Filters" Java filter documentation]) 
     151 * modify the file `src/laplace/terminal/DoubleArraySource.java` to do something additional, such as computing a function instead of sending a fixed number (see [wiki:"Java API#Terminals"  Java terminal documentation]) 
    152152 
    153153== Part 4: a diagram of your tightly coupled model ==