Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: running calculations in a batch mode


  • To: mathgroup@smc.vnet.net
  • Subject: [mg12033] Re: running calculations in a batch mode
  • From: "P.J. Hinton" <paulh@wolfram.com>
  • Date: Fri, 24 Apr 1998 01:52:06 -0400
  • Organization: Wolfram Research, Inc.
  • References: <6h70dm$t90@smc.vnet.net>

On 17 Apr 1998, Tatyana Polenova wrote:

> How can I launch Mathematica jobs in background? I would like to be able
> to set up calculations that take long time and log out of the system. I
> am using SGI (IRIX 6.4). Currently the program is written as
> Mathematica notebook; does it have to be rewritten as a plain file or
> one can evaluate the definitions using the Front End, and then quit the
> Front end leaving the jobs running?
> thanks you very much

It isn't possible to start kernel-based batch calculations directly from
the front end, but by saving the inputs in your notebook as a package,
you can export your calculations from your notebook to a plain text
file that is suitable for input on a batch job. 

Click open Edit -> Preferences on the front end.  On the resulting
dialog box, set the scope to be Notebook.  Then in the Lookup line of
this dialog box, enter the characters "AutoGen."  This should open up
some submenus to the AutoGeneratedPackage option.  Set this to
Automatic, and the front end will automatically export all
initialization cells in InputForm to a file that has the same base
filename as your notebook, but with the .m extension that is used to
denote Mathematica packages.  This export will take place each time you
save your notebook.  The automatic generation can be turned off by
setting the AutoGeneratedPackage function to be None. 

Next, within your notebook, select each cell that contains a calculation
you want to run as part of a batch file.  Click on the front end menu
command sequence Cell -> Cell Properties -> Initialization Cell.  This
will mark each cell that you selected as an initialization cell.  The
.m file created by the front end can be used as an input for batch mode
operation.

Running the kernel in batch mode question that gets asked every month or
so on this newsgroup.  The answer can be found in the booklet _Getting
Started with Mathematica under Unix and X_, p. 30.  This material is
also available under the System Information portion of the online help.

The syntax for running batch calculations in the kernel, regardless of
Unix flavor is: 

	math < infile > outfile

Where "math" is the shell command that you invoke to run the kernel by
itself.  In most cases it will be "math", but if this doesn't work, 
contact your system administrator to find out what command this may be.


The file "infile" is a the file containing the inputs to the kenrel. 
The file "outfile" is the file where where output is to be directed. 
If you want your inputs to be echoed in the outfile, then you will need
to add the following expression to the beginning of infile:

	AppendTo[$Echo, "stdout"]

If you wish to log your results in the form of a notebook rather than a
plain text file, you can use the package
ProgrammingInMathematica`NotebookLog`, which is described in Roman
Maeder's book _Programming in Mathematica_, 3rd ed.

-- 
P.J. Hinton
Mathematica Programming Group           paulh@wolfram.com Wolfram
Research, Inc.                  http://www.wolfram.com/~paulh/




  • Prev by Date: Questions about "collecting" complex exponentials and simplifying expressions
  • Next by Date: Re: Speeding up ReadList[]?
  • Prev by thread: running calculations in a batch mode
  • Next by thread: 4D interpolation