Mesham for Windows
1. What to download and requirements
2. Installing Mesham
3. Using the language
4. Installing MPI
5. Advanced Setup
What to Download
In order to install Mesham on your machine you will need three components. The server, the compiler and the runtime library. Basically, the compiler will take your source code, give it to the server to translate, and then link it with the runtime library to produce an executable. You can download these seperately, or all together. In order to install the whole language on a machine, download the "all" package.
Requirements
Java Run Time Environment from java.sun.com
A C compiler and GNU maker - MinGW is a very good choice that we suggest, at http://www.mingw.org/
An implementation of MPI (see the MPI section for further details.)
Installing Mesham
To install Mesham really all the hard work has been done for you, but you will still need to configure the language.
Unzip the language zip file and extract its contents to a directory - we would suggest c:\mesham but it really doesnt matter
Now double click the installwindows.bat file - this will run the installation script, make sure you answer all the questions correctly (if you make an error just rerun it.) The script does a number of things. Firstly it automatically configures the compiler with your settings, secondly it configures the server and lastly it compiles the compiler. If you ever want to change the settings, you will need to rerun this configuration script. To install the server but not compile the compiler, just run installwindows.bat with the option -nocompile
Lastly you will need to install the runtime library. There are a number of options here. The simplest is to use one of our prebuilt libraries. In the libraries directory there will be two zip files, one called win32binlibrary and the other win64binlibrary. Depending on whether your system is 32 or 64 bit (most commonly, Core and Core 2 processors are 64 bit) extract the contents of the zip file into the libraries directory. Then copy (or move) mesham.dll and pthreadGC2.dll into c:\windows\system32 . By the end of this step, you should have a file called libmesham.a in the libraries directory and both mesham.dll and pthreadGC2.dll in c:\windows\system32 . If you wish to compile the runtime library rather than use our prebuild ones, then read the readme file in the libraries\windows directory. Note at this stage that if you wish to distribute the executables you compile, the user must have mesham.dll and pthreadGC2.dll on their machine, but libmesham.a is required for compiling only.
Thats all the hard work done! For ease of use, we would suggest adding mc.exe (the file just compiled, in compiler\bin) into your MSDOS path. To do this, goto the control panel, system, advanced tab, click on Environment Variables and under System variables scroll down to Path and edit it to add ;c:\mesham\compiler\bin then click OK. (The ; simply separates paths, this assumes you have installed the language in c:\mesham, if not change the path accordingly.)
Note - if you ever wish to move the location of the language files, you will need to rerun installwindows.bat file to reconfigure the setup. Secondly, there is a prebuild server runner called winrunserver.bat with some default options. If you dont want to build the items, you can run this, and then run compiler/wingui.bat for the Mesham into C viewer, without any other steps that will work fine.
Using the Language
IMPORTANT - you MUST make the MPI executable files visible to Mesham. To do this, goto the control panel, system, advanced tab, click on Environment Variables and under System variables scroll down to Path and edit it to add ;c:\program files\mpich2\bin then click OK. (The ; simply separates paths, this assumes you have installed MPICH2 and in c:\program files\mpich2, if not change the path accordingly.)
As long as you have made mc.exe and the MPI executable files visible via the path, then you can create Mesham source files and compile them anywhere. We will detail how to simply get yourself up and running in this text, consult the language manual for specific language details.
First, run the server - this can be found in the server directory, and simply double click runserver.bat . The server will start up (can take a few moments) and will tell you when its ready
Now, create a file - lets call it a.mesh. For the contents just put in:
var a:=34;
print[a,"\n"];
Open a MSDOS terminal window, change the path to the directory where a.mesh is located and type mc a.mesh . The compiler should generate a.exe , and you can run it via MSDOS or by double clicking on it. There are lots of options you can do , type mc -h to find out
If there are any problems, you might need to configure/play around with your MPI implementation. Certainly with MPICH2 you might need to start the process manager, called smpd.exe in the mpich2/bin directory, and wmpiconfig.exe is required initially to register a username/password with the process manager.
If you wish only to view the C code, but not compile it, you can use the language C code viewer by double clicking windowsgui.bat in compiler\java
Installing MPI
It doesnt matter which implementation you install. Having said that, it seems that the majority of implementations have been created with Unix in mind rather than Windows. MPICH certainly supports Windows, but you need MS Visual Studio to use the automated installer.
To install MPICH for windows, make sure you have MS Visual Studio, Intel Fortran (free download from their site) and also Microsoft Visual C++ 2005 SP1 Redistributable Package (x86) from http://www.microsoft.com/downloads/thankyou.aspx?familyId=200b2fd9-ae1a-4a14-984d-389c36f85647&displayLang=en#
Then download MPICH for windows at http://www.mcs.anl.gov/research/projects/mpich2/ under releases and install. This will work automatically via the MPICH installer.
There are other options too, OpenMPI might be a possibility via Cygwin.
Advanced Setup
There are a number of additional possibilites with the language. You can install the server on a specific machine (copy the server directory to that machine) and run it, and run the clients remotely. In order to do this, when you run installwindows.bat tell the script the name of the server machine. You can override the server's default port by specifying this as a runtime argument to the script - i.e. runserver.bat 6667 will run the server on port 6667.
Commonly, running over a cluster, creating one executable is fine. However, if you wish to run your program over a hetrogeneus resource, then you can generate ISO C99 standard C via mc -c [source code name]. If you install the specific run time library for each machine, then you can manually compile the source code by using the 2nd to last comment at the end of the C file.