1
$\begingroup$

I try to run mathematica on a grid. Since this is my first time working on a cluster, I have no plan what to do.

I have to run a job (pbs-file).

#!/bin/sh
#
#PBS -q express

module load math/mathematica/9.0.1

echo "Started"
mathematica 'pi.m'
echo "Ended"

exit 0

I got always the error : "Can not open display". Anyone know what to do?

The file pi.m looks like:

N[ Pi, 1000 ] >>"pi_result.txt"
Quit[ ]
$\endgroup$
3
  • $\begingroup$ I think you'd need to work with cli interface, by math < pi.m . This can be tested in terminal, and if it works, submit it to queue. $\endgroup$ – Yi Wang Jul 15 '14 at 13:25
  • $\begingroup$ math instead of mathematica, maybe $\endgroup$ – acl Jul 15 '14 at 13:26
  • $\begingroup$ Dear Yi Wang, think that works. Thank you! :-) $\endgroup$ – Michael Jul 15 '14 at 13:30
6
$\begingroup$

Clusters can be significantly different from each other, so I strongly recommend you talk to someone who uses the same system and ask them for help with the details.

However, there is one thing that is clearly incorrect in your job script:

To run a script with Mathematica, you need to start the kernel (command line program), not the front end (graphical interface). Change mathematica 'pi.m' to math -script pi.m. You can also remove Quit from pi.m.

mathematica starts the graphical interface, while math will start the kernel in command line mode and can run scripts.

Before trying to run this as a job, make sure that it can be run from the command line. That is, test that math -script pi.m works when you type this on the command line.

$\endgroup$
1
  • $\begingroup$ @shrx That doesn't change the fact that it is the kernel that needs to be launched, not the front end. The front end is auto-launched by the kernel when necessary, but this is beyond the OPs question, and I think discussing this would be more confusing than helpful at this point. $\endgroup$ – Szabolcs Jul 15 '14 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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