{"id":223,"date":"2013-04-23T10:13:41","date_gmt":"2013-04-23T10:13:41","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/?page_id=223"},"modified":"2017-08-16T08:45:17","modified_gmt":"2017-08-16T08:45:17","slug":"mathematica","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/mathematica\/","title":{"rendered":"Mathematica"},"content":{"rendered":"<h2>Overview<\/h2>\n<p>Mathematica is an integrated technical computing environment which combines numeric and symbolic compute engines, a graphics system, a programming language, a documentation system and connectivity to other programs. Mathematica may be used for handling complex symbolic calculations involving millions of terms, analyzing and visualizing data, numerical modeling and simulation, rapid application development, producing publication-quality output and presentations.<\/p>\n<p>Version 11.1.1, 10.0.2 and 8.0.4 is currently installed on the CSF.<\/p>\n<h2>Set up procedure<\/h2>\n<p>To set up the Mathematica environment you need to issue the following command<\/p>\n<pre>module load apps\/binapps\/mathematica\/11.1.1\r\n\r\nOR<\/pre>\n<pre class=\"in1\">module load apps\/binapps\/mathematica\/10.0.2\r\n\r\nOR\r\n\r\nmodule load apps\/binapps\/mathematica\/8.0.4\r\n<\/pre>\n<h2>Running the application interactively<\/h2>\n<p>To run Mathematica 8 interactively you should first log into the CSF using the -X switch as follows<\/p>\n<pre class=\"in1\">ssh -X -l <em>username<\/em> csf.itservices.manchester.ac.uk\r\n<\/pre>\n<p>Next, load the Mathematica modulefile<\/p>\n<pre class=\"in1\">module load apps\/binapps\/mathematica\/11.1.1\r\n<\/pre>\n<p>Finally, run Mathematica via <a href=\"\/csf2\/csf-user-documentation\/sge-interactive-jobs-qrsh\/\">qrsh<\/a><\/p>\n<pre class=\"in1\">qrsh -V -l inter -l twoday mathematica\r\n<\/pre>\n<ul>\n<li><a href=\"\/csf2\/getting-started-on-the-csf\/using-an-app-with-a-gui-x11-and-qrsh\/\">Further information about how to start X-Windows and GUI applications on the CSF<\/a>.<\/li>\n<li><a href=\"\/csf2\/csf-user-documentation\/sge-interactive-jobs-qrsh\/\">More details concerning qrsh<\/a><\/li>\n<\/ul>\n<h2>Serial batch job submission<\/h2>\n<p><strong>It is not possible to run Mathematica .nb files in batch mode.<\/strong> Instead, you must create a text-only file containing your Mathematica program. For example, create a text file called myprog.m containing the following<\/p>\n<pre class=\"in1\">Table[\r\n NIntegrate[Sin[x^n], {x, 1, 10}, MaxRecursion -&gt; 1000]\r\n , {n, 1, 70}]\r\n<\/pre>\n<p>A suitable SGE submission script, mathematica_job.sge, for the above would be<\/p>\n<pre class=\"in1\">#$ -cwd\r\n#$ -j y\r\n#$ -V\r\nmath &lt; myprog.m &gt; out.txt\r\n<\/pre>\n<p>Note that the executable that runs your script is <strong>math<\/strong> (i.e. the Mathematica Kernel) and not <strong>mathematica<\/strong> (The notebook interface)<\/p>\n<p>To run the above job you should first load the Mathematica modulefile (if you haven&#8217;t already)<\/p>\n<pre class=\"in1\">module load apps\/binapps\/mathematica\/11.1.1\r\n<\/pre>\n<p>and then use <code>qsub<\/code><\/p>\n<pre class=\"in1\">qsub mathematica_job.sge\r\n<\/pre>\n<h2>Parallel batch job submission<\/h2>\n<p>A parallel version of myprog.m is<\/p>\n<pre class=\"in1\">LaunchKernels[4];\r\nParallelTable[\r\n  NIntegrate[Sin[x^n], {x, 1, 10}, MaxRecursion -&gt; 1000], {n, 1, 70}] \/\/ AbsoluteTiming\r\nCloseKernels[];\r\n<\/pre>\n<p>A suitable submission script is<\/p>\n<pre class=\"in1\">#$ -cwd\r\n#$ -j y\r\n#$ -V\r\n## The number on the pe line (number of cores) **must** match the number you set in LaunchKernels[]\r\n#$ -pe smp.pe 4\r\nmath &lt; myprog.m &gt; out.txt\r\n<\/pre>\n<p>Note that the only difference is the <code>-pe<\/code> switch. Job submission is similar to that of serial jobs: Load the module and use qsub.<\/p>\n<h2>Further info<\/h2>\n<ul>\n<li><a href=\"http:\/\/www.applications.itservices.manchester.ac.uk\/show_product.php?id=38\">IT Services webpage for Mathematica.<\/a><\/li>\n<li><a href=\"http:\/\/www.walkingrandomly.com\/?p=3635\">Making Mathematica faster with the Compile function.<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Overview Mathematica is an integrated technical computing environment which combines numeric and symbolic compute engines, a graphics system, a programming language, a documentation system and connectivity to other programs. Mathematica may be used for handling complex symbolic calculations involving millions of terms, analyzing and visualizing data, numerical modeling and simulation, rapid application development, producing publication-quality output and presentations. Version 11.1.1, 10.0.2 and 8.0.4 is currently installed on the CSF. Set up procedure To set up.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/software\/applications\/mathematica\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":31,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-223","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/comments?post=223"}],"version-history":[{"count":16,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/223\/revisions"}],"predecessor-version":[{"id":4267,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/223\/revisions\/4267"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf-apps\/wp-json\/wp\/v2\/media?parent=223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}