Maple 10.0 Sample Batch File with Explanation

The following text shows the commands in the sample batch command, along with a description of what each section is doing.

Red indicates sections which need some customization by the user, with items in red bold italics ALWAYS needing customization for the individual user name or directory/file names. Black sections would normally not need any modification.
 
This first section of code sets the machine requirements and provides information for Cluster Controller to schedule the job.  This section requires modification by the user.

@echo off
REM Sample batch file for Maple 10.0
REM
REM ccs account = your_login_id
REM ccs nodes = 1
REM ccs type = batch
REM ccs minutes = 20
REM ccs requirements = development

The next section calls the setup file which sets the appropriate path, registry settings, and other environment variables for Maple.

REM --- Call setup file
call setup_maple.bat

The next section defines two variables.  For more information on these variables see Maple software page.

REM --- set ROOTDIR, JOB_NAME, and INPUT_FILE variables.
set ROOTDIR=H:\users\%USERNAME%\maple
set OUTDIR=%ROOTDIR%\output

The next section creates a local directory on T:. It deletes any old files and subdirectories. This section should not normally be modified by the user.

REM --- Create temp directory on T: 
T:
del /Q T:\%USERNAME%
rd /Q /S T:\%USERNAME%
mkdir \%USERNAME%
cd \%USERNAME%

The next section copies files from the user's ROOTDIR to the local temporary directory.

REM --- copy the input files from ROOTDIR 
copy %ROOTDIR%\myprog_1.txt  T:\%USERNAME%\
copy %ROOTDIR%\myprog_2.txt  T:\%USERNAME%\
copy %ROOTDIR%\mydata_1.txt  T:\%USERNAME%\
copy %ROOTDIR%\mydata_2.txt  T:\%USERNAME%\
copy %ROOTDIR%\metadata_1.txt  T:\%USERNAME%\
copy %ROOTDIR%\metadata_2.txt  T:\%USERNAME%\

File metadata_1.txt: this file will be run by maple.  It requires the program_file myprog_1.txt and the data_file mydata_1.txt.

# DEFINE PROGRAM, DATA and OUTPUT FILES
program_file:="T:/your_login_id/myprog_1.txt " ;
data_file:="T:/your_login_id/mydata_1.txt";
output_analysis_file:="T:/your_login_id/myout_1.analysis";
# DEFINE MAPLE PROGRAM OPTIONS and SET PARAMETERS
# RUN PROGRAM
read(program_file);
quit;

The next line runs 2 Maple programs on a dual processor machine, the first in the background, the second in the foreground.

REM Run one program as a background process
start /b call cmaple t://%USERNAME%//metadata_1.txt
 
REM Batch script will not proceed until this program finishes
call cmaple t://%USERNAME%//metadata_2.txt

The next section executes a loop which checks to see if Maple has completed running, so that the job waits until Maple is done executing before going to the next line. This section presumes that the first program creates a unique file of the form *_1.analysis just before it ends.

:waitsomemore
call sleep.bat 60
if not exist *_1.analysis goto waitsomemore

The next section copies the output files back to the user's OUTDIR and cleans up the local temporary space. 

REM --- copy the output files back to the directory OUTDIR.
copy /Y T:\%USERNAME%\*.analysis %OUTDIR%>>%OUTDIR%\stdout 2>>%OUTDIR%\stderr

REM --- clean up files from this job (delete folder and everything in it)
cd /D T:\
rmdir /S /Q T:\%USERNAME%

This last line of the file ends the batch job.

ccrelease