Changes between Version 75 and Version 76 of Orio


Ignore:
Timestamp:
06/14/08 16:40:00 (15 years ago)
Author:
hartono
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Orio

    v75 v76  
    281281In the earlier AXPY-4 case, one could view the module body block as redundant, since the annotation body already contains the same program. The motivation behind requiring Orio users to include the computation itself as part of the annotation is to avoid making use of a full-fledged C compiler infrastructure that potentially will compromise the simplicity, reliability, and portability of Orio. Furthermore, another reason is to allow the computation to be expressed by using domain-specific high-level languages, thus capturing the semantics without imposing tuning constraints resulting from the use of a general-purpose language. 
    282282 
    283 Below, we present a very simple example, which extends Orio with a new module that simply rewrites the annotated code without applying any code transformations at all. The new module has no parser component since there is no necessity to extract information from the annotated code, significantly simplifying the module implementation. First, we need to create a new subdirectory (with a name `simplyrewrite`, for instance) inside `src/module`. And then, we create an ''empty'' special file `__init__.py` inside directory `src/module/simplyrewrite`, so that Python will know that this folder is a package (i.e. a Python module). After that, a file named `simplyrewrite.py` that contains the implementation of the transformation module class must be defined in directory `src/module/simplyrewrite`. So, here is how the new directory structure will look like after applying the transformation module extension. 
     283Below, we present a very simple example, which extends Orio with a new module that simply rewrites the annotated code without applying any code transformations at all. The new module has no parser component since there is no necessity to extract information from the annotated code, significantly simplifying the module implementation. First, we need to create a new subdirectory (with a name `simplyrewrite`, for instance) inside `src/module`. And then, we create an ''empty'' special file `__init__.py` inside directory `src/module/simplyrewrite`, so that Python will know that this folder is a package (i.e. a Python module). After that, a file named `simplyrewrite.py` that contains the implementation of the transformation module class must be defined in directory `src/module/simplyrewrite`. So, here is how the new directory structure will look like after adding the new transformation module extension to Orio. 
    284284 
    285285{{{ 
     
    298298}}} 
    299299 
    300 And, below is the complete code of the `SimplyRewrite` class. 
     300And, below is the detailed code of the `SimplyRewrite` class. 
    301301 
    302302{{{ 
     
    336336}}} 
    337337 
     338In the following sample, we show the input and output of the newly-added `SimplyRewrite` module. 
     339 
     340{{{ 
     341% more simplyrewrite.py  
     342/*@ begin SimplyRewrite (This is the module body code) @*/ 
     343// This is the annotation body code 
     344/*@ end @*/ 
     345 
     346% orcc simplyrewrite.py  
     347 
     348% cat _simplyrewrite.py  
     349/*@ begin SimplyRewrite (This is the module body code) @*/ 
     350        /* 
     351         perf_params = {} 
     352         module_body_code = "This is the module body code" 
     353         annot_body_code = " 
     354// This is the annotation body code 
     355" 
     356         line_no = 1 
     357         indent_size = 0 
     358        */ 
     359// This is the annotation body code 
     360/*@ end @*/ 
     361}}} 
     362 
    338363== More Detailed Documentation == 
    339364