Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lesson_21 [2019/08/31 00:01]
argemiro
lesson_21 [2023/08/14 18:31] (current)
admin
Line 1: Line 1:
-{{ :logo_guidebook1.jpg?400 |}}+{{ :logo_logo.png?400 |}}
 \\ \\
-=====LESSON 21: Dinamica EGO script language and console launcher=====  ​+=====Dinamica EGO script language and command line tool=====  ​
 \\ \\
 \\ \\
Line 8: Line 8:
   * Naming variables with alias   * Naming variables with alias
   * [[:EGO Script|Dinamica EGO programming language]]   * [[:EGO Script|Dinamica EGO programming language]]
-  * Dinamica EGO Console launcher+  * Dinamica EGO Command Line Tool
  
  
-As a model becomes more and more complex, you may find useful ​to save it in EGO format ​to keep developing ​ the model using [[:EGO Script|EGO programming language]] on a text editor, (e.g. [[http://​notepad-plus-plus.org/​|NotePad++]] or [[http://​www.contexteditor.org|Context]]). For example, the Amazon logging model [[http://​dx.doi.org/​10.1007/​s00267-009-9337-1|(Merry et al, 2009)]] developed in Dinamica EGO involves ​more than one thousand script lines. Both script formats ([[:XML Script|EGOML/​XML]],​ [[:EGO Script|EGO]]) are 100% compatible, so users can take back and forth a model from the graphical interface to the text editor without losing any information. Advanced modelers ​will greatly benefit from this well structured and tractable programming language. ​ +Alternatively, you may want to save the model in EGO format ​in [[:EGO Script|EGO programming language]]. You can open an edit EGO script language ​on a text editor, (e.g. [[http://​notepad-plus-plus.org/​|NotePad++]] or [[http://​www.contexteditor.org|Context]]). But still it is much easier to use the graphical interface. For example, the Amazon logging model [[http://​dx.doi.org/​10.1007/​s00267-009-9337-1|(Merry et al, 2009)]] developed in Dinamica EGO has more than one thousand script lines, even a skilled programmer would take longer writing the script than by using the graphical interface. Both script formats ([[:XML Script|EGOML/​XML]],​ [[:EGO Script|EGO]]) are 100% compatible, so users can take back and forth a model from the graphical interface to the text editor without losing any information. Advanced modelers ​may use this well structured and tractable programming language. ​
- +
-<note tip>​**TIP**:​ EGO format is also a good way to merge two models, since you can cut and paste parts of scripts.</​note>​+
  
 Open again the model “simulate_deforestation_from_1997_2000_30years_ahead.xml”. To make the model more intelligible on the text editor, you first need to name some key variables and then add comments to parts of the model. Let’s do this. Select the Edit Functor tool and click on the Categorical Map “23267_1997.ers”. Open again the model “simulate_deforestation_from_1997_2000_30years_ahead.xml”. To make the model more intelligible on the text editor, you first need to name some key variables and then add comments to parts of the model. Let’s do this. Select the Edit Functor tool and click on the Categorical Map “23267_1997.ers”.
Line 26: Line 24:
 {{ :​tutorial:​script_4.1.jpg |}} {{ :​tutorial:​script_4.1.jpg |}}
  
-Now that you have learned a bit about programming with EGO script language, another resource available in Dinamica EGO is the Console Launcher. Any model saved in Dinamica EGO, either EGOML/XML or EGO, can be run from the command prompt. Running the model from the command prompt increases model performance,​ as the model becomes free of the burden of the graphical interface+Now that you have learned a bit about programming with EGO script language, another resource available in Dinamica EGO is the Command Line Tool. Any model saved in Dinamica EGO, either EGOML/XML or EGO, can be run from the command prompt.
  
-<note tip>​**TIP**: ​ Windows 32 bits only handles up to 3 gigabytes of memory for a single process. See the question [[:​faq#​performance|How much memory ​(RAM) is Dinamica EGO able to handle?​]] ​in Dinamica EGO's FAQ for additional information about memory.</​note>​+To run Dinamica EGO from the command line, simply run DinamicaConsoleX ​(where the X is the major versior number of the application -- e.g. DinamicaConsole7from a command prompt. DinamicaConsole utility ​is located ​in the Dinamica EGO installation folderThe parameters accepted by Dinamica Command Line Tool are:
  
-To facilitate running a model from the command promptwe have developed a Console Launcher toolIts use is strongly advised for complex models and others with large amount of dataAlsoConsole Launcher allows for queuing models ​and running them sequentially Call the Console Launcher from the tools subfolder in the Start/​Programs/​Dinamica EGO shortcutIt will open the following interface. +^ Dinamica Command Line Option ^ Option Description ^ 
- +| -verifier <​name>​ | Set functor verifier. | 
-{{ :​tutorial:​script_9.jpg ​|}} +| -output <​filename>​ | Write an output file representing the input model script. | 
- +| -log-level <level number> | Set the maximum execution log level. UNCONDITIONAL=0ERROR=1, WARNING=2, RESULT=3, INFO=4, INFO2=5, DEBUG=6, or DEBUG2=7
-<WRAP center round box 60%> +| -log-subsystem <level number> | Set the execution log subsystem levelGENERAL=1, OPENCL=2, SCRIPT_READER_WRITER=4,​ FUNCTOR_SCHEDULER=8,​ FUNCTOR_DEPENDENCE_GRAPH=16,​ FUNCTOR_EXECUTION=32,​ FILESYSTEM=64,​ MAP_IO_HANDLER=128,​ FUNCTOR_COPY_ANALYSIS=256, and SYSTEM=256. To use more than one, use the sum of the number of the corresponding subsystems
-Some parameters ​of Console Launcher are:  +| -predefined-seed | Use a predefined value as the seed of the random number generators. | 
- +| -processors ​<number| Override the number ​of logical processors that should be used. 0=use total number of processor cores instead. | 
--Scheduler: how the model functors are going be sequenced  +-granularity <​number>​ | Override ​the default granularity value. | 
- +-dont-run | Do not run the model script. | 
--Verifier: Type of script ​verification +| -propagate-exceptions | Propagate top-level ​exceptions. | 
- +| -beep | Beep to indicate that the execution has completed. | 
--Log Level: Maximum ​level of log report ​ +| -ask-to-close | Wait confirmation ​to close the window| 
- +| -disable-parallel-map-load | Disable loading maps in parallel. | 
--Use Predefined seed: Check it to use predefined seed to generate random numbers. Using a predefined seed forces Dinamica EGO to always generate ​the same output, even if the model is stochastic.  +-disable-parallel-functors | Disable parallel processing ​of functors. | 
- +| -disable-parallel-steps | Disable parallel processing of loop steps. | 
--Processors: number ​of processors/​cores that model will use (Use 0 to automatically detect the number available) ​ +-memory-allocation-policy <​code>​ | Policy used to control memory allocation. PREFER_MEMORY=0BALANCED=1PREFER_DISK=2,​ MEMORY_ONLY=3 ​and AGGRESSIVE=4 | 
- +| -accelerators-policy <​code>​ | Policy used to select accelerator devicesNO_DEVICES=0,​ ALL_DEVICES=1,​ and USER_CONFIG=2 | 
--Run Model: Check it to run model completelyotherwiseDinamica EGO will load all models ​and exit. Disable ​this flag to validate a large number ​of models+| -disable-native-expressions | Disable ​compilation ​of image expressions to native representation| 
-</WRAP+| -metadata-profile ​<code| Type of the profile used to write file metadata. CUSTOM=0, CSR/​UFMG_ptBR=1,​ and CSR/​UFMG_en=2. | 
- +| -map-metadata-template-filename <​filename>​ | Filename with the template used to to write map metadata. Assume the use of CUSTOM profile. | 
-You can save the Console Launcher configuration into a batch file tooThis is useful ​in case you want to couple ​Dinamica EGO with other software.+| -map-metadata-file-extension <​extension>​ | File extension used to write map metadataAssume the use of CUSTOM profile. | 
 +| -write-semicolon-in-csv | Write CSV files using semicolons as value separators. | 
 +| -session-name <​name>​ | Create session with the given name to share data between ​Dinamica EGO and an external application
 +| -list-accelerators | Show the available accelerator devices. | 
 +| -list-functors | Show the available functors. | 
 +| -version | Show version info. | 
 +| -help | Show this help. |
  
 <note tip>​**TIP**:​ another way to loosely couple other computer programs with Dinamica EGO is by means of functor [[:Run External Process]], available in the Control Tab.  By using this functor, you will be able to make a call to an external program from within Dinamica, pass to this program intermediate results and feed its output back again into the Dinamica EGO model. </​note> ​ <note tip>​**TIP**:​ another way to loosely couple other computer programs with Dinamica EGO is by means of functor [[:Run External Process]], available in the Control Tab.  By using this functor, you will be able to make a call to an external program from within Dinamica, pass to this program intermediate results and feed its output back again into the Dinamica EGO model. </​note> ​
 \\ \\
 \\ \\
-Congratulations,​ you have successfully completed this lesson! Now let’s move to the **next lesson:​** ​[[lesson_22|LESSON 19 Heuristic calibration of models by using Genetic Algorithm]]+\\ 
 +[[lesson_22|Next: Heuristic calibration of models by using Genetic Algorithm]] 
 +\\ 
 +☞[[:​guidebook_start| Back to Guidebook Start]]