Installing MIDASsort for Windows

Microsoft C/C++ compiler

MIDASsort for Windows uses the Microsoft C/C++ compiler to build your sort program. The version currently supported is Microsoft Visual Studio 10.0. There is a free version - Microsoft Visual Studio 2010 Express.
If you do not already have a fully installed version of Microsoft C/C++ then you will need to follow these instructions to download and install Microsoft's free distribution.
If you think you already have the C/C++ compiler installed a quick check is to start a Command Prompt window and enter the command cl. If you do not get a response from the C/C++ compiler then either it is not installed or not fully installed. To be fully installed various environment variables must be set - for example PATH, INCLUDE and LIB - to include references to the compiler installation.

Obtaining Microsoft Visual Studio 2010 Express

The following link should take you to the support page on the Microsoft Website for Visual Studio.
Select Visual C++ 2010 Express. Install in the normal way. The default install should also contain the SDKs needed to obtain the required C header files.
The default install will create the directories C:\Program Files\Microsoft Visual Studio 10.0 and C:\Program Files\Mircosoft SDKs. In the case of Windows64 Program Files changes to Program Files (x86).

You will need to modify your PATH, INCLUDE and LIB environment variables as follows


echo Setting environment for using Microsoft Visual Studio 10.0  (2010)

set PATH=C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files\Microsoft Visual Studio 10.0\VC\VCPackages;%PATH%
set INCLUDE=C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE;%INCLUDE%
set LIB=C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;%LIB%
set LIBPATH=C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;%LIBPATH%

echo Adding files from the SDK
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.0A\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib;%LIB%

As mentioned previously in the case of Windows64 Program Files changes to Program Files (x86) everywhere.
Also if you do not install in the default location then appropiate changes have to be made.

Obtaining MIDASsort

A full installation requires:-

Download MIDASsort  4 Mbytes

Download MIDAS Services for Windows  2.5 Mbytes

Note that these are both .tar.gz files. Windows has been known to change the suffix to .tar.tar or other corruptions!!

Installing MIDASsort

First (if not already done) follow these instructions to install the MIDAS base.
Expand the 2 files obtained previously (Winzip does a good job) into the directory containing the MIDAS base installation. Directories MIDASsort and Win32 will be created.

It is assumed that you will install the software using the base directory c:\midas. This is not essential and you can install in any location you choose EXCEPT that the path MUST NOT contain an embedded space. (Ie c:\Program Files\MIDAS is NOT acceptable).
The environment variable MIDASBASE should be set to the installation directory. By default MIDASBASE is set to c:\MIDAS\.
In the following instructions [MIDASBASE] is used to denote the installation directory.

Copy the shortcut SortSas from the directory [MIDASBASE]\MIDASsort\Win\Desktop to your desktop. A suitable icon for this can be found in [MIDASBASE]\MIDASsort\Win.
Copy the file [MIDASBASE]\Win32\bin\#.exe to c:\Windows\System32 (or equivalent). [Just allows used of # as a comment character in the command scripts - or add [MIDASBASE]\Win32\bin to your PATH environment variable]

Start the software services

Note - when using Windows FireWall you may have to permit the following services to run as you start them. Normally this needs only to be done once. This will also be true if using any third party firewall.
At each step allow the services to start before going on to the next step.
The desktop icon is a shortcut to a cmd file which is executed. This will create a Windows Command Prompt Window and launch the service tasks in most cases with High priority.
You may iconise (miminise) the window but do not close it unless you really wish to terminate the services. On the other hand closing the window is the easiest way to terminate the service tasks.

Create the directory [MIDASBASE]\log if it does not already exist.
Edit the file c:\Windows\system32\drivers\etc\hosts (or equivalent) and add the "host" egmsg as an alias for localhost.

Start the MessageLogger, ShObjManager and ShMemSas deamons by double click on the MIDAS icon labelled SortSas on the desktop.
The command file c:\MIDAS\MIDASsort\Win\StartUp\SortSas.cmd will be run.
The command file looks like this:-

echo off
#
#    startup script for Windows required for MIDASsort services
#
#    set environment variable which is the base  MIDAS directory
#    Note the trailing \ is in this case important!!
set MIDASBASE=c:\MIDAS\
cd %MIDASBASE%
#
set PATH=%MIDASBASE%MIDASsort\Win\bin;%MIDASBASE%Win32\bin;%PATH%
#
#    start the Message Logger program 
startup MessageLogger
sleep 3
#
#    start the Shared Object Manager 
startup ShObjManager
sleep 3
#
#    start the Shared Memory Spectrum Server
del %MIDASBASE%%Host%.shmemsas
startup ShMemSas %MIDASBASE% SortSas   %Host%.shmemsas
sleep 5
#
#
echo startup complete
The output will be as follows.
C:\MIDAS\Win32\StartUp>echo off
MIDAS Message Logger: Starting the RPC interface
MIDAS Message Logger: Created RPC Program 28000240 Version 1 on UDP port 10240.
MIDAS Message Logger: Message Logger using directory c:\midas\log
MIDAS Message Logger: Entering server loop
ShObjManager installed
Could not find c:\MIDAS\.shmemsas
Message logger contacted.
initMemSas: MemSASBlock.10230
Spectrum Access Server Installed on port 10230
startup complete
This starts the service programs MessageLogger.exe and ShObjManager.exe Unix/Linux treats Shared Memory as persistent. So if a program creates a Shared Memory object it will exist until deleted or the system is rebooted. Windows, however, will delete any Shared Memory objects created by a program when that program terminates. The MIDASsort software uses Shared Memory to hold global data and parameters used by the software and these are required to persist for the duration of the session. The ShObjManager is used to actually create any Shared Memory areas needed by the MIDASsort software components and hence these will exist while the ShObjManager is running and after the program "creating" them has terminated.
This also starts the service program ShMemSAS.exe which will be the owner of all histograms created (in Shared memory) by the MIDASsort program. If the service task is terminated all histograms will be lost (unless you have prevously saved them to disc).

Note - If you install MIDASsort in a directory other than c:\MIDAS then you will have to change set MIDASBASE=c:\MIDAS\ accordingly.

Run MIDASsort session

Copy the shortcut MIDASsort from the directory [MIDASBASE]\MIDASsort\Win\Desktop to your desktop. A suitable icon for this can be found in [MIDASBASE]\MIDASsort\Win.
Double click on the MIDASsort icon to start the session. The shortcut runs the command file [MIDASBASE]\MIDASsort\Win\StartUp\MIDASsort.cmd in order to establish the environment for the compiler and start the MIDAS session. If you have installed the compiler to a different location to that described here you may need to change the command file accordingly.
The command file looks like this:-

@echo off

echo Setting environment for using Microsoft Visual Studio 10.0  (2010)

set PATH=C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN;C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files\Microsoft Visual Studio 10.0\VC\VCPackages;%PATH%
set INCLUDE=C:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE;%INCLUDE%
set LIB=C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;%LIB%
set LIBPATH=C:\Program Files\Microsoft Visual Studio 10.0\VC\LIB;%LIBPATH%

echo Adding files from the SDK
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.0A\include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.0A\lib;%LIB%

echo Adding cygwin
set PATH=%PATH%;C:\cygwin\bin

echo Adding MIDASsort
set MIDASBASE=c:\MIDAS\
set PATH=%MIDASBASE%MIDASsort\Win\bin;%MIDASBASE%Win32\bin;%MIDASBASE%bin_Win;%PATH%

echo Starting MIDASsort
cd %MIDASBASE%bin_Win
wish85.exe -MIDASAPPLICATION=MIDASsort

Note - If you install MIDASsort in a directory other than c:\MIDAS then you will have to change set MIDASBASE=c:\MIDAS\ accordingly.

Note - If you are using Windows64 then the MIDASsort shortcut should be changed to start MIDASSort64.cmd.

Once the session has started click on the menu item SortTool to start MIDASsort.

GNU C/C++ and f77 compilers

The GNU compilers (Cygwin environment) provide an alternative C compiler and provide the only supported Fortran compiler.
If you do not already have an installation of the Cygwin environment complete with gcc and (optionally) g77 then these can be obtained at www.cygwin.com
Installation of MIDASsort is the same as for the Microsoft compilers as above except that in the command file c:\MIDAS\MIDASsort\Win\StartUp\SortSas.cmd Cygwin must be added to the PATH (if not already there).

echo Adding Cygwin
set PATH=%PATH%;C:\cygwin\bin

You can switch between the Microsoft compiler and GNU compilers by using the Use GNU Compilers? checkbox in the MIDASsort Settings window.

When you Start a MIDASsort run a command file is written (see dialog window) which can be used to rerun the sort if for any reason you cannot understand why the sort is failing. This can be invaluable if for any reason (such as a corrupt or damaged installation the sort program does not start).

The sort runs in a command prompt window which requires you to enter any character to terminate the run. This enables output from the sort to be read before the window closes.

 return to MIDASsort home page