Changes between Version 74 and Version 75 of Orio


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

--

Legend:

Unmodified
Added
Removed
Modified
  • Orio

    v74 v75  
    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). 
     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 applying the transformation module extension. 
     284 
     285{{{ 
     286% pwd 
     287/home/username/orio 
     288 
     289% tree src/module/ 
     290src/module/ 
     291|-- __init__.py 
     292|-- module.py 
     293`-- simplyrewrite 
     294    |-- __init__.py 
     295    `-- simplyrewrite.py 
     296 
     2971 directories, 4 files 
     298}}} 
     299 
     300And, below is the complete code of the `SimplyRewrite` class. 
    284301 
    285302{{{ 
     
    319336}}} 
    320337 
    321 ''Currently under construction'' 
    322  
    323338== More Detailed Documentation == 
    324339