I'm new to Mathematica and am trying to adapt a pre-existing notebook, designed for manual evaluation of individual simulation outputs, to batch process the outputs of multiple simulations. Currently, I'm just trying to find a way to execute the notebook's contents from the command line. I'm using a bash script to execute the notebook for each
The original method, executing the cells of the notebook using the interface, takes approximately 2 min to run.
Calling the notebook from the command line is dramatically slower (>15 min). I've used the following approaches:
MathKernel -noprompt -run < myScript.m $simID MathKernel < myNotebook.nb $simID MathKernel -script myScript.m $simID
myScript.m is the
myNotebook.nb after conversion in Mathematica to a script (and with all the inline graphics text removed).
I'm puzzled by the difference but don't have a deep understanding of Mathematica or the notebook to script conversion. I'd be grateful for any suggestions, because the current calculation time is way too slow for batch processing.
Edit: It might be useful to know that the notebook mainly produces figures and saves them to pdf. It performs some simple optimizations (e.g., FindClusters). I'm using Mac OS X 10.6.