2
$\begingroup$

I have been searching around for a while, and perhaps I'm just using the wrong terminology, but I haven't found a way to do this.

I have a mathematica notebook converted and saved as nobel_test.m, which runs perfectly on my own computer. Because it takes about an hour to run, I'm trying to run multiple at one time on a computer cluster that can have 100 instances going at once (named nobel). I converted my original notebook by making everything InputForm, ending with Exit[], etc, and changing outputs so that they are saved in external text files instead of printing into the notebook.

When I tested this, it ran fine by itself - the script ran, read the correct contents, created and printed the files it needed to, etc. I used the command

math -noprompt -run "<<nobel_test.m"

I also tried

math -noprompt -script "nobel_test.m"

which also works for single cases.

However, the banner opens ("The following versions are available...mathematica-8.0.4.." etc.), and while no In[1]:= or anything like that prints, it seems to enter an input-less front end that can't be closed (without quitting the kernel). It automatically closes about an hour later when the notebook finishes evaluating.

Because of this, I can only run sequentially, rather than in parallel. I thought -noprompt was supposed to prevent the banner from opening, so that you could just submit job after job to the max of your licenses; but because it opens and holds there, I have to wait until the current job is done before starting a new one.

Is there a way to quit that section without closing the kernel, or other good ways to execute several mathematica scripts at once?

Again, apologies if this is commonly asked, I'm probably not searching the correct things. Any help would be greatly appreciated!

$\endgroup$
13
  • $\begingroup$ I can't follow the second part of your question. I've never seen a message like "The following versions are available...mathematica-8.0.4..". Can you elaborate on that a bit more and show exactly what happens? Is it possible that it is not Mathematica itself that gives that message but some version selector software specific to your HPC cluster? $\endgroup$
    – Szabolcs
    Apr 17, 2013 at 18:40
  • $\begingroup$ (On out HPC cluster I need to explicitly make available the specific version of a program I want to use by doing something like module load mathematica/9.0.1) $\endgroup$
    – Szabolcs
    Apr 17, 2013 at 18:48
  • 1
    $\begingroup$ It looks like the mathematica launch script was modified on your system. That message is not printed by mathematica itself. $\endgroup$
    – Szabolcs
    Apr 17, 2013 at 19:21
  • 2
    $\begingroup$ Hi there, are you running on linux? If so have you tried using MathKernel and putting the command in the background using '&' ? For example : MathKernel -script myscript.m & . The commands you want to run in the m file are marked as initialisation cells ? $\endgroup$ Apr 18, 2013 at 10:28
  • 1
    $\begingroup$ This question appears to be off-topic because it relates to the operation of shells on Unix/Linux in general, rather than to Mathematica itself. $\endgroup$ Jan 8, 2014 at 14:18

1 Answer 1

3
$\begingroup$

From image_docter's comment:

If you are running on Linux then you may try using MathKernel and putting the command in the background using '&' ? For example :

MathKernel -script myscript.m & 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.