Submitting jobs

You can submit non-interactive (batch) work to Artemis using the Artemis cluster profile configured in the previous section. This section will walk you through submitting an example Matlab script called quadrature.m to Artemis using the batch command. You may like to use this script to test submitting jobs to Artemis yourself. The script quadrature.m is:

parfor i=1:n
    q = q + w*bessely(4.5,((n-1)*a+(i-1)*b)/(n-1));

If you save this script to your local computer, you can run it on your local computer with following command in the Matlab Command Window:

>> quadrature

Submiting work to Artemis using the “batch” command

The quadrature.m script can be run on Artemis using the batch command in the Matlab Command Window:

>> job = batch('quadrature','Profile','Artemis')

Using multiple cores

The quadrature.m script can be run using multiple cores since it has been explicitly parallelised with a “parfor” loop. Therefore, you can request multiple CPUs using the “Pool” option to batch:

>> job = batch('quadrature','Profile','Artemis','Pool',3)

The above command initialises a parallel computing pool with 3 cores that do the computation, and one additional head core that executes the script. Therefore, the above example requests 4 cores.


You can have up to 12 cores worth of work running simultaneously. Any work that would exceed the 12 core per user limit will remain queued until there are enough cores free to run your job.

Advanced ways to use the batch function

You can also submit a function to Artemis using the batch command, rather than a script:

>> job = batch(@my_func,N,{x1,...,x2},'Profile','Artemis','Pool',3)

This job will run the function my_func using the input arguments {x1,...,x2} and will return N output arguments. Note the use of @ to create a function handle; this points to the function, rather than calling it.

The batch function can take many other options in the standard Matlab form of ‘parameter’,’value’ pairs. See the Matlab documentation for details.

Two such options are worth noting:

Your Matlab job will switch directories into the remote folder specified via the ‘CurrentFolder’ parameter before execution on Artemis. If not given, Matlab uses the current local working directory as the default value for ‘CurrentFolder’ - a folder which may not exist on Artemis! To avoid the warnings this causes, call batch with 'CurrentFolder','.', which tells Matlab not to change directories before running the job.

You can also specify additional files or folders to transfer to Artemis on a per job basis (rather than modifying your cluster profile) by including the ‘AttachedFiles’ parameter. The value for this can be a string giving the path to a file or folder (e.g. file.m), or it can be a cell-array of such strings:

>> job = batch(...,'AttachedFiles',{'important/folder/','other/file.m'})