Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Find the IP address of your computer using the tool of your choice (ip, hostname -I, whatismyip.com, etc.)
  2. Query the name server to obtain the name it gives you:

    Code Block
    nslookup YOU_IP_ADDRESS ad1.epfl.ch


  3. Add the following line to your MATLAB startup file:


    Code Block
    pctconfig('hostname','MY_PC_NAME.epfl.ch');


    where MY_PC_NAME is the name obtained at the previous point.

  4. Restart MATLAB.

Changing SLURM options when launching a MATLAB simulation

...

Code Block
cluster = parcluster('fidis');                                         % Create a cluster with the configuration corresponding to the Fidis machine
cluster.AdditionalProperties.AdditionalSubmitArgs = '--time 01:00:00'; % Add the option of your choice. Here, we set the time limit to 1h.

parpool(cluster)                                                       % Start the parallel pool

A short example

In this small example, we want to compute the maximum eigenvalue of some random matrices in parallel. To do this, we proceed in three steps:

  1. Create the parallel pool on the SCITAS cluster we want to use
  2. Do the actual computations
  3. Shutdown the parallel pool
Code Block
% Part 1: Create a cluster c using the 'fidis' profile and start the pool p with 28 workers (cores)
c = parcluster('fidis');
p = parpool(c, 28);

% Part 2: Do the actual computations. Here we use parfor to exploit the parallel execution of a for loop.
tic
n = 200;
A = 500;
a = zeros(1,n);
parfor i = 1:n
    a(i) = max(abs(eig(rand(A))));
end
toc

% Part 3: Shutdown the parallel pool
delete(p)

Please, note that using MATLAB Parallel Server is an interactive process, i.e. you need to keep your MATLAB instance open. This can be difficult if your computations need tens of hours to complete. In this case, you may want to consider launching them directly on the SCITAS cluster.