development:scripting_languages:mathematica

This shows you the differences between two versions of the page.

— |
development:scripting_languages:mathematica [2019/10/12 07:54] (current) meesters created |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== Wolfram Mathematica ====== | ||

+ | |||

+ | [[http://www.wolfram.com/mathematica/|Mathematica]] is a computational software program used in many scientific, engineering, mathematical and computing fields. It was conceived by Stephen Wolfram and is developed by Wolfram Research of Champaign, Illinois. Mathematica is renowned as the world's ultimate application for computations. But it's much more—it's the only development platform fully integrating computation into complete workflows, moving you seamlessly from initial ideas all the way to deployed individual or enterprise solutions. | ||

+ | |||

+ | |||

+ | <WRAP center round info> | ||

+ | //**Attention**// | ||

+ | |||

+ | Members of the physics department enjoy an unlimited number of licenses. Hence, a multitude of jobs can be submitted with regard to licensing. All other users, however, share the 10 licenses the university has obtained. Hence, the number of concurrent jobs is severely limited. Jobs may crash with an appropriate error message. To avoid this limit the number of concurrently running jobs. If in doubt contact the HPC-team. | ||

+ | </WRAP> | ||

+ | |||

+ | |||

+ | ====== Usage ====== | ||

+ | |||

+ | In order to access the executables load one of the modules, e.g.: | ||

+ | |||

+ | <code bash> | ||

+ | $ module add math/Mathematica | ||

+ | </code> | ||

+ | |||

+ | For interactive computing on the login nodes (//testing only//) start ''Mathematica''. Scripts can be executed with ''math''. | ||

+ | |||

+ | See the [[http://reference.wolfram.com/mathematica/guide/Mathematica.html|vendor documentation]] for more detail. For a primer on parallelization with Mathematica we recommend this [[https://reference.wolfram.com/language/guide/ParallelComputing.html|part of the documentation]]. | ||

+ | |||

+ | ===== Submitting Jobs: Things to consider ===== | ||

+ | |||

+ | You may for example submit a mathmatica script with the following command line: | ||

+ | <code mathematica> | ||

+ | srun -n x --mem=xxx -p short --time <sometime> math -script <path to script> | ||

+ | </code> | ||

+ | where | ||

+ | |||

+ | - ''x'' reflects the number of wanted cores ( 1 <= x <= 64 ; see below on how to retrieve this number within a script) | ||

+ | - ''xxx'' the amount of memory required for the job (see the [[:memory_reservation|memory reservation]] page for hints) | ||

+ | - ''sometime'' the required [[:bsub|wall clock time]] | ||

+ | - <path to script> should indeed be a valid path (relative paths should work, too) | ||

+ | |||

+ | A reminder: | ||

+ | * If ''sometime'' > 5 h, please submit to a **long**-queue | ||

+ | * If ''x'' = 64, please submit to **nodeshort** or **nodelong**. In this case just select with ''-p <partitionname>'' a different partition. | ||

+ | |||

+ | ===== Interactive Mathematica Session ===== | ||

+ | |||

+ | You can launch an interactive Mathematica session and use the program as you would on your desktop pc. Please note that this should only be done on the compute-nodes and not on the login-nodes. | ||

+ | |||

+ | <code bash> | ||

+ | [joe_user@login]$ srun -n<ntasks> -p<partition> -A<account> -t<time> --mem<amount> --pty --preserve-env $SHELL | ||

+ | </code> | ||

+ | |||

+ | <code bash> | ||

+ | [joe_user@node]$ Mathematica & | ||

+ | </code> | ||

+ | |||

+ | ===== SLURM specific Snippets ===== | ||

+ | |||

+ | In order to retrieve the JobID, you can do | ||

+ | <code mathematica> | ||

+ | JOBID = Environment["SLURM_JOB_ID"]; | ||

+ | </code> | ||

+ | |||

+ | The job directory therefore becomes | ||

+ | <code mathematica> | ||

+ | LocalScratchDir = "/localscratch/"<>JOBID<>"/"; | ||

+ | </code> | ||

+ | |||

+ | A ramdisk can be reserved as described in [[:ramdisk|this link]]. The number of reserved cores can be retrieved with | ||

+ | <code mathematica> | ||

+ | CPUn = ToExpression[Environment["SLURM_JOB_CPUS_PER_NODE"]]; | ||

+ | Print["Number of Processes: "<>ToString[CPUn]]; | ||

+ | </code> | ||

+ | |||

+ | |||

+ | |||

development/scripting_languages/mathematica.txt · Last modified: 2019/10/12 07:54 by meesters