0
$\begingroup$

I've written a Mathematica notebook and subsequently saved it as a .m file, so that I can run it on an HPC. When I opened it, the .m file had the form

::Package::

::Input::

 "some code"

::Input::

 "some code"

and so on. When I tried to get the Mathematica module on the HPC to run this file it spat out a syntax error saying that ::Package:: and ::input:: are undefined. I have to admit, I usually run everything in a Mathematica notebook in the front-end of the Mathematica software, so I'm unsure if I'm using the .m file correctly. What is the problem here?

$\endgroup$
  • $\begingroup$ That looks like a package file. When I run on the HPC (which isn't very often), I copy the input cells into a text editor and save as a plain text file. $\endgroup$ – KraZug Nov 16 '17 at 14:33
  • $\begingroup$ @KraZug I've also tried copying the inout cells and pasting them into a text editor, then saving it as a .m file. The problem I'm finding is that when I try to create an Interpolation function using ParallelTable and then use this resulting function in an NIntegrate it is not being passed to the sub-kernels correctly and so prints the error that the integrand has evaluated to non-numerical values. I really don't understand why this is happening as I've defined all the functions/variables in ParallelEvaluate. I thought it might be to do with the file format, hence asking this. $\endgroup$ – user35305 Nov 16 '17 at 14:38
  • 1
    $\begingroup$ That sounds like a completely separate question. $\endgroup$ – KraZug Nov 16 '17 at 15:28
  • 1
    $\begingroup$ That output looks strange. Normally it would be (* ::Package:: *), i.e. those things would be commented. Only initialization cells or code cells will be exported without being commented. $\endgroup$ – Szabolcs Nov 16 '17 at 15:48
  • 1
    $\begingroup$ @Szabolcs I think I've been doing the whole .m file thing wrong - I haven't been setting the cells to initialisation cells. This might explain the problems I've been having. $\endgroup$ – user35305 Nov 16 '17 at 16:05

Your Answer

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

Browse other questions tagged or ask your own question.