Difference between pages "Download 0.5" and "The Arjuna Compiler"

From Mesham
(Difference between pages)
Jump to navigationJump to search
(Download)
 
 
Line 1: Line 1:
== Version 0.5 ==
+
<metadesc>Mesham is a type oriented programming language allowing the writing of high performance parallel codes which are efficient yet simple to write and maintain</metadesc>
 +
== Overview ==
  
Version 0.5 of Mesham is currently the latest version of the language and contains numerous additions and improvements over 0.41(b). However this version of the compiler does not explicitly support Windows (mainly in the runtime library) although it is possible to compile on Windows for more experienced developers.
+
Although not essential to the programmer, it is quite useful to know the basics of how the implementation hierachy works.
  
== Download ==
+
The core translator produces ANSI standard C99 C code which uses the Message Passing Interface (version 2) for communication. Therefore, on the target machine, an implementation of MPI, such as OpenMPI, MPICH or a vendor specific MPI is required and will all work with the generated code. Additionally our runtime library (known as LOGS) needs to be also linked in. The runtime library performs two roles - firstly it is architecture specific (and versions exist for Linux, Windows etc..) as it contains any none portable code which is needed and is also optimised for specific platforms. Secondly the runtime library contains functions which are often called and would increase the size of generated C code.
  
You can download [http://www.mesham.com/downloads/mesham5.tar.gz Mesham 0.5 here] (700KB)
+
<center>[[Image:overview.jpg|Overview of Translation Process]]</center>
  
== Installation Instructions ==
+
The resulting executable can be thought of as any normal executable, and can be run in a number of ways. In order to allow for simplicity the user can execute it by double clicking it, the program will automatically spawn the number of processors required. Secondly the executable can be run via the mpi deamon, and may be instigated via a process file or queue submission program. It should be noted that, as long as your MPI implementation supports multi-core (and the majority of them do) then the code can be executed properly on a multi core machine, often with the processes wrapping around the cores (for instance 2 processes on 2 cores is 1 process on each, 6 processes on 2 cores is 3 processes on each etc...)
  
There are three basic components required for installing Mesham - installing the client, the server and the runtime library
+
== Translation In More Detail ==
  
* Install Java RTE from java.sun.com
+
The translator itself is contained within a number of different phases. Firstly, your Mesham code goes through a preprocessor, written in Java, which will do a number of jobs, such as adding scoping information. When this is complete it then gets sent to the translation server - from the design of FlexibO, the language we wrote the translator in, the actual translation is performed by a server listening using TCP/IP. This server can be on the local machine, or a remote one, depending exactly on the setup of your network. Once translation has completed, the generated C code is sent back to the client via TCP/IP and from there can be compiled. The most important benefit of this approach is flexibility - most commonly we use Mesham via the command line, however a web based interface also exists, allowing the code to be written without the programmer installing any actual software on their machine.  
  
* Make sure you have a C compiler installed i.e. gcc
+
<center>[[Image:flexdetail.jpg|Flexibo translation in detail]]</center>
  
* Install an implementation of MPI - MPICH (version 2) and OpenMPI are both good ones, you choose
+
== Command Line Options ==
  
* The three different components must be configured to your machine and where they are situated, happily this is all automated in the installlinux script.
+
* '''-o [name]''' ''Select output filename''
Open a terminal and cd into your Mesham directory - i.e. cd /home/work/mesham
+
* '''-I[dir]''' ''Look in the directory (as well as the current one) for preprocessor files''
Then issue the command ./installlinux and follow the on screen prompts.
+
* '''-c''' ''Output C code only''
 +
* '''-t''' ''Just link and output C code''
 +
* '''-e''' ''Display C compiler errors and warnings also''
 +
* '''-s''' ''Silent operation (no warnings)''
 +
* '''-f [args]''' ''Forward Arguments to C compiler''
 +
* '''-pp''' ''Just preprocess the Mesham source and output results''
 +
* '''-static''' ''Statically link against the runtime library''
 +
* '''-shared''' ''Dynamically link against the runtime library (default)''
 +
* '''-debug''' ''Display compiler structural warnings before rerunning''
  
If there is an issue with running the command, use the command chmod +x installlinux and then try running it again.
+
== Static and Dynamic Linking Against the RTL ==
  
After running the install script, the library, compiler and server should not be moved from where they are now - this will cause problems and if required you must rerun the script and remake them.
+
The option is given to statically or dynamically link against the runtime library. Linking statically will actually place a copy of the RTL within your executable - the advantage is that the RTL need not be installed on the target machine, the executable is completely self contained. Linking dynamically means that the RTL must be on the target machine (and is linked in at runtime), the advantage to this is that the executable is considerably smaller and a change in the RTL need not result in all your code requiring a recompile.
 
 
* Now type make all
 
 
 
* If you have root access, login as root and type make install
 
 
 
* Now type make clean  (to clean up the directory)
 
 
 
Congratulations! If you have completed these 7 steps you have installed the Mesham language onto your computer!
 
 
 
== Using the Compiler ==
 
 
 
Assuming you have installed the language you will now want to start writing some code! Firstly you will need to start the Mesham translation server, cd into your mesham/server directory and type ./runserver  . The server will start up, telling you the version number and date of the Mesham compiler and then will report when it is ready.
 
 
You will need to start a new terminal, now, if you are using MPICH 2, run an mpi deamon via typing mpd &  . Create a mesham source file (look in the language documentation for information about the language itself) and compile it via mc. For instance, if the source file name is hello.mesh compile it via mc hello.mesh  . You should see an executable called hello
 
 
Run the executable via ./hello  (or whatever its called.) You do not need to (although can if you want) run it via the mpirun or mpiexec command as the executable will automatically spawn the number of processes it requires.
 
 
If you dont wish to compile, but just view the generated C code, you can run linuxgui.sh in compiler/java
 
 
 
Nb: If you wish to change the configuration information created by the installer (for an advanced user, this is not required) then you can - the installer tells you where it has written its config files and the documentation is included in the respective source folders.
 
 
 
== Runtime Library Options ==
 
 
 
Included in the runtime library (0.2) are a number of optional aspects which are disabled by default. These can be enabled by editing the make file and removing the ''#'' before the specific line. The two optional aspects are the files in support of the Gadget-2 port (peano hilbert curve, snapshot files and the parameter file) and the HDF5 support (requires the HDF5 library to be installed on the machine.)
 

Revision as of 14:46, 19 January 2013

Overview

Although not essential to the programmer, it is quite useful to know the basics of how the implementation hierachy works.

The core translator produces ANSI standard C99 C code which uses the Message Passing Interface (version 2) for communication. Therefore, on the target machine, an implementation of MPI, such as OpenMPI, MPICH or a vendor specific MPI is required and will all work with the generated code. Additionally our runtime library (known as LOGS) needs to be also linked in. The runtime library performs two roles - firstly it is architecture specific (and versions exist for Linux, Windows etc..) as it contains any none portable code which is needed and is also optimised for specific platforms. Secondly the runtime library contains functions which are often called and would increase the size of generated C code.

Overview of Translation Process

The resulting executable can be thought of as any normal executable, and can be run in a number of ways. In order to allow for simplicity the user can execute it by double clicking it, the program will automatically spawn the number of processors required. Secondly the executable can be run via the mpi deamon, and may be instigated via a process file or queue submission program. It should be noted that, as long as your MPI implementation supports multi-core (and the majority of them do) then the code can be executed properly on a multi core machine, often with the processes wrapping around the cores (for instance 2 processes on 2 cores is 1 process on each, 6 processes on 2 cores is 3 processes on each etc...)

Translation In More Detail

The translator itself is contained within a number of different phases. Firstly, your Mesham code goes through a preprocessor, written in Java, which will do a number of jobs, such as adding scoping information. When this is complete it then gets sent to the translation server - from the design of FlexibO, the language we wrote the translator in, the actual translation is performed by a server listening using TCP/IP. This server can be on the local machine, or a remote one, depending exactly on the setup of your network. Once translation has completed, the generated C code is sent back to the client via TCP/IP and from there can be compiled. The most important benefit of this approach is flexibility - most commonly we use Mesham via the command line, however a web based interface also exists, allowing the code to be written without the programmer installing any actual software on their machine.

Flexibo translation in detail

Command Line Options

  • -o [name] Select output filename
  • -I[dir] Look in the directory (as well as the current one) for preprocessor files
  • -c Output C code only
  • -t Just link and output C code
  • -e Display C compiler errors and warnings also
  • -s Silent operation (no warnings)
  • -f [args] Forward Arguments to C compiler
  • -pp Just preprocess the Mesham source and output results
  • -static Statically link against the runtime library
  • -shared Dynamically link against the runtime library (default)
  • -debug Display compiler structural warnings before rerunning

Static and Dynamic Linking Against the RTL

The option is given to statically or dynamically link against the runtime library. Linking statically will actually place a copy of the RTL within your executable - the advantage is that the RTL need not be installed on the target machine, the executable is completely self contained. Linking dynamically means that the RTL must be on the target machine (and is linked in at runtime), the advantage to this is that the executable is considerably smaller and a change in the RTL need not result in all your code requiring a recompile.