Changes between Version 14 and Version 15 of PhalUserGuide

Show
Ignore:
Timestamp:
03/23/09 12:41:19 (16 years ago)
Author:
ismael (IP: 62.57.1.15)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PhalUserGuide

    v14 v15  
    1 = P-HAL User Guide = 
     1= ALOE Linux User Guide = 
    22 
    3 This section describes first steps on launching and running a waveform in P-HAL.  
    4 If you plan to develop applications or you just want to learn more about P-HAL, you should read the [wiki:PhalDeveloperGuide P-HAL Developer Guide] and the [wiki:PhalManual P-HAL Manual]. 
     3This section describes first steps on launching and running a waveform in ALOE for Linux.  
     4If you plan to develop applications or you just want to learn more about ALOE, you should read the [wiki:PhalDeveloperGuide ALOE Developer Guide] and the [wiki:PhalManual ALOE Manual]. 
    55 
    6 Here you will learn how to download a waveform from our repository (you will need a user/pwd to access) and launch it. You will also get familiar with most of P-HAL commands. 
     6Here you will learn how to download a waveform from our repository (you will need a user/pwd to access) and launch it. You will also get familiar with most of ALOE commands. 
    77 
    8 At this point we assume that you have downloaded and installed P-HAL on your computer (see [wiki:PhalInstallGuide Install Guide]) and that your are familiar with Linux at user level. 
     8At this point we assume that you have downloaded and installed ALOE on your computer (see [wiki:PhalInstallGuide Install Guide]) and that your are familiar with Linux commands at user level. 
    99 
    1010[[BR]] 
    1111 
    12 == Launching P-HAL == 
     12== Launching ALOE == 
    1313 
    14 Before starting P-HAL, you must create a directory where Manager Daemons will look for configuration files, application definitions and executables (PhalManual). This path will be passed as the first parameter to the P-HAL launcher. You can download a sample directory from our repository: 
     14Before starting ALOE, you must create a directory where Manager Daemons will look for configuration files, application definitions and executables (PhalManual). This path will be passed as the first parameter to the ALOE launcher. You can download a sample directory from our repository: 
    1515 
    1616{{{ 
    17 svn checkout http://147.83.118.229/svn/phal-apps/trunk/phal-repositories 
     17svn checkout http://flexnets.upc.edu/svn/phal-apps/trunk/phal-repositories 
    1818}}} 
    1919 
    2020You will see that this directory as, among others, the following '''mandatory''' subdirectories: 
    2121   * logs: Here waveform's modules will store their logs, in per-waveform sub-directories. 
     22   * reports: This is where statistics value reports are written 
    2223   * swman_execs: Here modules' binaries can be reached (can contain symbolic links), in per-platform sub-directories. 
    2324   * swman_apps: Path for application definitions (e.g.: wimax.app) 
     
    2829'''NOTE''': Make sure that swman_execs/linux contains (or links to) your waveform binaries compiled for the platform you plan to launch them. 
    2930 
    30 Now you can launch P-HAL console passing the phal-repositories path (just downloaded) as an argument: 
     31Now you can launch ALOE console passing the phal-repositories path (the one you downloaded) as an argument: 
    3132{{{ 
    3233runph phal-repositories 
    3334}}} 
    3435 
    35 You just got into the P-HAL environment! By the moment, you can't do anything because you need to download an application first. This will be explained in the following section. After that, we will see how it can be loaded and run.  
     36You just got into the ALOE environment! By the moment, you can't do anything because you need to download an application first. This will be explained in the following section. 
    3637 
    3738[[BR]] 
     
    3940More optional arguments can be passed to runph in the shell. The command accepts the following arguments: 
    4041{{{ 
    41 runph [repository_path] -c [platform_cfg_file] -i [xitf_cfg_file] -p [priority] -d [debug_level] -r [fifo_report] [--daemon] [-o output_file] 
     42runph [repository_path] -c [platform_cfg_file] -i [xitf_cfg_file] -p [priority] -d [debug_level] [--daemon] [-o output_file] 
    4243}}} 
    4344Where: 
     
    4748 * ''-p [priority]'': Needs root privileges. Kernel priority level for waveform processes, see Performance Notes. ''Default'': 20 
    4849 * ''-d [debug_level]'': Sets platform debug level. Currently only 2 modes are supported, level=0 or level!=0, where the first means normal operation and the second prevents EXEC daemon to kill processes which violated real time policies. ''Default'': 0 
    49  * ''-r [fifo_report]'': File where the platform will log (in columns, for Matlab compatibility) the instantaneous waveform internal fifo utilization (in kilobytes). ''Default'': No report. 
    50  * ''--daemon'': Run PHAL in background. You should specify an output file (for standard output) so you can track what's happening. Also '''cmdman''' daemon should be launched as a daemon preventing to read from input (see below, Launching P-HAL as a Daemon). ''Default'': Foreground. 
     50 * ''--daemon'': Run PHAL in background. You should specify an output file (for standard output) so you can track what's happening. Also '''cmdman''' daemon should be launched as a daemon preventing to read from input (see below, Launching ALOE as a Daemon). ''Default'': Foreground. 
    5151 * ''-o [output_file]'': File to redirect standard output. ''Default'': None, terminal stdout. 
    5252 
     
    5959 
    6060{{{ 
    61 svn checkout http://147.83.118.229/svn/phal-apps/trunk/wimax 
     61svn checkout http://flexnets.upc.edu/svn/phal-apps/trunk/wimax 
    6262}}} 
    6363 
    64 This will download all the files to a directory called wimax. You can enter there and compile your files as usually, paying attention on '''linking them to the P-HAL SW API Library''' (see DeveloperGuide). 
    65  
    66 Remember that you can commit your changes in the application using the Subversion service, just get into the wimax directory and type: 
    67 {{{ 
    68 svn commit  
    69 }}} 
    70  
    71 To download the latest version in the server type (again, from the downloaded directory): 
    72 {{{ 
    73 svn update 
    74 }}} 
    75  
    76 These commands, however, can create conflicts if other users are working with the same files, we recommend to read [http://svnbook.red-bean.com/nightly/en/svn-book.html Subversion Manual] to learn more about this powerful tool. 
     64This will download all the files to a directory called wimax. You can enter there and compile your files as usually, paying attention on '''linking them to the ALOE SW API Library''' (see DeveloperGuide). 
    7765 
    7866[[BR]] 
    7967 
    80 == Running a waveform: Basic P-HAL commands == 
     68== Running a waveform: Basic ALOE commands == 
    8169 
    82 PHAL can be controlled from a text console typing commands. Again, we recommend you to read PhalManual if you are not familiar with the P-HAL environment. Basically, running a waveform compromises 3 steps: ''loading'', ''initializing'' and ''running''. You will do such by typing the appropiate commands in the input console. In the next example, we will load, initialize and run the example waveform Wimax: 
     70ALOE can be controlled from a text console typing commands. Basically, running a waveform compromises 3 steps: ''loading'', ''initializing'' and ''running''. You will do such by typing the appropriate commands in the input console. In the next example, we will load, initialize and run the example waveform Wimax: 
    8371 
    84 Once P-HAL has been started with the appropriate arguments (see first section), we will load the waveform by typing in the prompt:  
     72Once ALOE has been started with the appropriate arguments (see first section), we will load the waveform by typing in the prompt:  
    8573{{{ 
    8674runph$: phload wimax 
     
    112100== Customizing your Platform == 
    113101 
    114 P-HAL Linux launcher admits two configuration files as arguments which modify certain Platform parameters. In this section we describe how to configure such parameters and what implications do they have: 
     102ALOE Linux launcher admits two configuration files as arguments which modify certain Platform parameters. In this section we describe how to configure such parameters and what implications do they have: 
    115103 
    116104'''Platform Configuration File''': This file has one mandatory section, ''[cpu_info]'', and N optional sections, ''[daemon]''. The second selects which daemons (and their path) will be launched by runph. You can add or remove them according to which daemons you need in your platform (see PhalManual). This sections have two fields only: 
     
    118106 * ''output'': File to redirect standard output (for logging purposes) 
    119107 
    120 In the CPU section, you can specify some default P-HAL configuration parameters. '''Note''': This parameters are overridden by the ones passed as arguments to the P-HAL Launcher. See section above for more details. 
     108In the CPU section, you can specify some default ALOE configuration parameters. '''Note''': This parameters are overridden by the ones passed as arguments to the ALOE Launcher. See section above for more details. 
     109 * ''name'': The name of the processor. 
    121110 * ''mips'': Capacity in MIPS of your computer. 
    122111 * ''tslot'': Duration of the time slot, in microseconds. 
     
    127116 * ''priority'': Priority level for objects 
    128117  
    129 '''External Interfaces Configuration File''': This files has one section for each external TCP interface of your platform. Before creating a network of P-HAL platforms, you should be very familiar with the P-HAL Environment concepts as it compromises selecting which daemons will run every platform, which depends on your network architecture. The format of the file is a set of sections (''[xitf]'') with the following mandatory fields: 
     118'''External Interfaces Configuration File''': This files has one section for each external TCP interface of your platform. Before creating a network of ALOE platforms, you should be very familiar with the ALOE Environment concepts as it compromises selecting which daemons will run every platform, which depends on your network architecture. The format of the file is a set of sections (''[xitf]'') with the following mandatory fields: 
    130119 * ''id'': Identification of the interface (hexadecimal 16-bit integer). Not any value is accepted as it is used by daemons to discover the purpose of the interface. It must be one of the following: 
    131120  * 0x1: Master Control Interface. 
     
    142131[[BR]] 
    143132 
    144 == Launching P-HAL as a Daemon == 
     133== Launching ALOE as a Daemon == 
    145134 
    146 Running P-HAL in background is often interesting when long time executions are going to be performed. In foreground executions, disconnecting user terminal (or ssh session) will kill P-HAL processes as they inherit from user session. This can be prevented to happen if the user launches P-HAL with the ''daemon'' option (as an argument or in the platform configuration file, see above) and appropriate selects an output for text messages. 
     135Running ALOE in background is often interesting when long time executions are going to be performed. In foreground executions, disconnecting user terminal (or ssh session) will kill ALOE processes. This can be prevented to happen if the user launches ALOE with the ''daemon'' option (as an argument or in the platform configuration file, see above) and appropriate selects an output file. 
    147136 
    148 When running in this mode, '''CMDMANAGER''' daemon must be also launched as daemon as it can't read commands from standard input anymore, and a tcp socket should be created for this purpose. Then, another CMDMANAGER process (local or remote) can connect to it and send normal P-HAL commands (as if it was local). 
     137When running in this mode, '''CMDMANAGER''' daemon must be also launched as daemon as it can't read commands from standard input any more, and a tcp socket should be created for this purpose. Then, another CMDMANAGER process (local or remote) can connect to it and send normal ALOE commands (as if it was local). 
    149138 
    150139To do so, make sure you follow these steps: 
    151  1. Modify Platform configuration file, adding the field '''run_as_daemon'''=''yes'' to the CPU section or launch P-HAL with the '''--daemon''' argument. 
    152  2. Modify Platform configuration file, adding the field '''output_file'''=''hwapi_log_file'' to the CPU section or launch P-HAL with the '''-o''' ''hwapi_log_file'' argument. 
     140 1. Modify Platform configuration file, adding the field '''run_as_daemon'''=''yes'' to the CPU section or launch ALOE with the '''--daemon''' argument. 
     141 2. Modify Platform configuration file, adding the field '''output_file'''=''hwapi_log_file'' to the CPU section or launch ALOE with the '''-o''' ''hwapi_log_file'' argument. 
    153142 3. Modify Platform configuration file, changing the arguments of the '''cmdman''' enabling it to listen to input connections ('''-l''') and run as daemon ('''-d'''). At this step, your configuration file should show something like the following: 
    154143  {{{ 
     
    166155   path=cmdman -l -p 
    167156  }}} 
    168  4.Then, if you specified '''work_path''' field in your configuration file, note that you can launch P-HAL without specifying a work directory, as it has already been defined. You can, thus, simply do: 
     157 4.Then, if you specified '''work_path''' field in your configuration file, note that you can launch ALOE without specifying a work directory, as it has already been defined. You can, thus, simply do: 
    169158  {{{ 
    170159  runph 
    171160  }}} 
    172   from any directory and P-HAL will be started at background. 
     161  from any directory and ALOE will be started at background. 
    173162 5. Now to perform commands you must connect to it (from a local or remote machine): 
    174163  {{{ 
    175   cmdman -c 192.168.1.1 
     164  cmdman -c 127.0.0.1 
    176165  }}} 
    177   where 192.168.1.1 should obviously be replaced by the IP address of the host where you launched the daemon. In this screen, you can type commands as usual and exit typing Ctrl+C. You will notice as you can re-connect with the same command and perform more commands. 
    178   At this point, you can exit your ssh session normally. P-HAL will keep running at background. When you login again, connect again with the previous cmdman command. Also, keep track of the output files (specifiyed at the configuration file) for errors or unusual behaviour. 
    179  6. Finally, you can kill PHAL by sending a INT signal. P-HAL install a simple shell command to do such: 
     166  where 127.0.0.1 should obviously be replaced by the IP address of the host where you launched the daemon. In this screen, you can type commands as usual and exit typing Ctrl+C. You will notice as you can re-connect with the same command and perform more commands. 
     167  At this point, you can exit your ssh session normally. ALOE will keep running at background. When you login again, connect again with the previous cmdman command. Also, keep track of the output files (specified in the configuration file) for errors or unusual behaviour. 
     168 6. Finally, you can kill ALOE by sending a INT signal. ALOE installs a simple shell command to do such: 
    180169  {{{ 
    181170  killph 
     
    194183 if you have a pentium/athlon processor with sse extensions. 
    195184 
    196  * '''Disable statistics or logs'''. These services may use a certain amount of CPU and bandwidth resources, disabling them may increase global performance. You can do that entering the following command in the P-HAL console: 
    197  {{{ 
    198  runph$: hwcmd stats_off 
    199  runph$: hwcmd logs_off 
    200  }}} 
    201  You can re-enable them substituting 'off' by 'on'. 
    202  
    203185 * Run waveform processes with '''higher priority'''. Use the optional argument ''-p [priority]'' to set a lower kernel priority to your waveform processes. Normal kernel priorities are 0 and higher, if you choose lower priority for waveform processes, they will low with lower priority which may increase performance and/or time resolution. Use this option with caution, because if your component hangs (i.e. because of an infinite loop), any process would get scheduled, preventing it to be killed, which may totally freeze your computer. 
    204186 
    205  * '''Increase Kernel time resolution'''. Another measure you can adopt to achieve a higher performance can be increasing the kernel timer frequency. To do such you must recompile your kernel. How to do that is out of the scope of this document, however, if you use ''menuconfig'', the option you have to change is at '''Processor type and features->Timer frecuency'''. Setting that to 1000 Hz implies a resolution of 1ms which, with at 10ms slot duration may be quite enough. 
     187 * '''Increase Kernel time resolution'''. Another measure you can adopt to achieve a higher performance can be increasing the kernel timer frequency. To do such you must recompile your kernel. How to do that is out of the scope of this document, however, if you use ''menuconfig'', the option you have to change is at '''Processor type and features->Timer frecuency'''. Setting that to 1000 Hz implies a resolution of 1ms which, with at 10ms slot duration should be enough. 
    206188 
    207189