Grid Computing Toolbox Shell Scripts and Batch Files - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Toolboxes : Grid Computing : Grid/Batch

Grid Computing Toolbox Shell Scripts and Batch Files


This section discusses using the Grid modes, hpc and mpi, and the shell scripts supporting them. These scripts are intended to be run from the operating system command interpreters.

Using Mode = MPI

The Grid Computing Toolbox (GCT) library code can utilize operating system implementations of the MPI standard (see http://www.mcs.anl.gov/research/projects/mpi/). This document outlines the basics of setting up and using MPI.

Windows

The current library supports Microsoft's MPI implementation, msmpi, found on the Windows Server 2008 HPC clusters. Other MPI implementations may work but have not been tested.

Server Setup

The default location of the  Grid toolbox server installation  is <maple>\toolbox\Grid  where <maple> represents where the main Maple program is installed. Additionally, you should create the directory\shared\mpi plus subdirectories. The directory \shared\mpi\bin will contain additional scripts that are used by client workstations submitting Grid code to the cluster. The file  maple.ini contains generic settings to enable the Grid MPI procedures.

The Maple command Grid[Setup]("mpi", mpidll="msmpi"); instructs the Grid toolbox to use the "mpi" interface instead of the default local implementation. The second argument, "msmpi" refers to the operating system basename of the MPI implementation dll or shared library. This dll or shared library should be found in one of the directories named in the PATH environment variable.

Notes:

The \shared\mpi directory on the head node should be shared with all the other compute nodes in the cluster. This is because any Maple GCT code submitted will be stored in the \\headnode\shared\mpi\grid subdirectory. Also any output generated will be stored there.

This directory must allow read/write persmission for Grid users as their temporary files will be placed there. User files will be placed in \shared\mpi\grid\<username> where <username> will be the user who submitted the job.    

Also the compute nodes should be configured so that PATH environment variable contains the directory for the cmaple.exe program.

 

 

Linux

 

The current library supports the MPICH MPI implementation, MPICH2. Before you start setting up the Grid toolbox, you must ensure that you have a copy of MPICH2 installed on in the same location on each machine that you will be using for Grid computing.

You will need to have passwordless ssh logins for all computational nodes or else the mpiexec program used for job submission will prompt you for a password for every node when a job is submitted.

 

Server Setup

 

Before you can run the mpilauncher scripts, you must setup the machines you will be using for Grid computing, by performing the following steps.

1. 

Create an NFS network share on one machine in the network that all users can read and write from. For example, /var/mpi.

> exportfs -o rw,root_squash,sync,no_subtree_check :/var/mpi

Other machines must mount this share at the same location and be readable and writable by all users. For example,

mount -t <type> grid01.myserver.com:/var/mpi/var/mpi

2. 

The Grid toolbox creates user directories in this shared location to store intermediate work files, specifically maple code and output.

3. 

Create a hostfile in the shared mount location, for example in the /var/mpi/hostfile directory. This hostfile should contain the hostname of each host, one per line, that MPICH2 can use as Grid nodes.

Optionally, after each hostname you can add a colon and a number to indicate how many nodes can be run on that host.

If you create this file in the shared mount location, for example, /var/mpi/hostfile, then all machines can share the same hostfile.

Example hostfile:

grid01.myserver.com    # Can handle 1 nodes

grid02.myserver.com:2  # Can handle 2 nodes

grid03.myserver.com:4  # Can handle 4 nodes, maybe a quadcore

grid04.myserver.com:2  # Can handle 2 nodes

 

4. 

Install the Grid toolbox on each machine. The default location of the  Grid toolbox server installation  is <maple>/toolbox/Grid  where <maple> represents where the main Maple program is installed.  

 

Notes:

Also the compute nodes should be configured so that PATH environment variable contains the directory for the xmaple program.

The Maple command Grid[Setup]("mpi", mpidll="mpich"); instructs the Grid toolbox to use the "mpi" interface instead of the default local implementation. The second argument, "mpich" refers to the operating system basename of the MPI implementation dll or shared library. This dll or shared library should be found in one of the directories named in the PATH environment variable.

 

Running the MPIlauncher Scripts

This script can be used to submit a file containing Maple code directly to a  Grid running MPI from an Operating System command line.

Before running the mpilauncher script make sure that Grid cluster is setup as per the instructions in the previous section.

The mpi launcher can be invoked using the following script command and a combination of options and parameters:

<maple>/toolbox/Grid/bin/mpilauncher -s  hh nn  ff
<maple>/toolbox/Grid/bin/mpilauncher -q|-r|-c  hh  jj
<maple>/toolbox/Grid/bin/mpilauncher -a  hh
<maple>/toolbox/Grid/bin/mpilauncher -d  ss   

where the script command parameters are defined as:

hh

localhost

nn

number of nodes requested for the job

ff

absolute file path to Maple code

jj

job id of submitted job

ss

seconds for delay

 

and the script command options are defined as:

-s

submit Maple file, ff to nn nodes

-q

query status of running job jj

-r

retrieve results of completed job jj

-c

cleanup/remove temp files and output of completed job jj

-d

sleep for ss secs

-a

get number of total and available nodes

 

To get the total number of available nodes use the command:

mpilauncher -a hh

where hh is localhost.

To set a pause in the excecution of the batch file, use the command

mpilauncher -d ss

where ss is the length of the pause

To submit the Maple script file containing your Maple code use the command:

mpilauncher -s hh nn fff

When you run the mpilauncher script, the Maple script you specified with parameter ff is submitted to the mpi program and then delegated to the appropriate nodes.

The Maple script is copied to a file in tthe shared directory that you created in the previous section. The name of the file will be of the form jj.mpl where jj is the job id for this submission.

Maple output is saved in maple_jj.stdout.txt and maple_jj.stderr.txt. Where jj is the job id.

To check the status of the submitted job use the command:

mpilauncher -q hh jj

where hh is localhost and jj is the job id of the submission.

The command returns one of the following status messages:

Done

– 

the job is complete

Failed

– 

the job was submitted but failed

Aborted

– 

the job was aborted (usually done by a System Administrator)

Active

– 

the job is running on the grid

Created

– 

the job was submitted but is not running yet

To retrieve the results of a submitted job use the command:

  mpilauncher -r  hh job 

The contents of the file will be returned to the console.

To clean up results and temporary files from the head node use the command:

mpilauncher -c hh job

This will delete the file associated with the job id.

 

 

 

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam