Using Matlab and access to sample Matlab scripts

From InelasticDataReduction
Jump to navigation Jump to search

Matlab packages for Inelastic Scattering data analysis used in ISIS include Horace and Mslice. The packages have home pages with extensive descriptions, but most recent and useful sample scripts are provided to users on the file system using HoraceExampleScripts folder, placed on users desktop at:

 /home/[USER'S_FEDERAL_ID]/Desktop/HoraceExampleScripts 

by a script defined in the isiscompute skel configuration.


Isiscompute servers provide users with access to recent version of Matlab and substantial number of floating licenses. Usually number of free licences is sufficient for users doing experiments and data analysis, but if Matlab does not start due to licensing issues, number of available licences can be checked using simple bash script (command):

#!/bin/bash
# check network licence for Matlab
/usr/local/MATLAB/R2014a/etc/glnxa64/lmutil lmstat -c /usr/local/MATLAB/R2014a/licenses/network.lic -a

Horace and Mslice are configured to be accessible from Matlab in two ways:

  • Using startup.m file, which is copied from skel configuration to each user home folder when user account is created. See the description of startup.m file at Mslice and Horace configuration pages for the detailed description of this file contents.
  • By adding special horace_on and similar mslice_on scripts to Matlab default search path. The scripts are doing roughly the same as startup.m file but allow user to initialize Horace and Mslice from arbitrary folder user wants to start Matlab from (not only from his or her home folder) and allows user to reinitialize these packages. This may be convenient for dealing with some errors in the analysis packages or when trying to resolve out of memory situations.

Configuring Matlab to access horace_on and mslice_on scripts

Configuring Matlab to access horace_on and mslice_on scripts on isiscompute server requests superuser access and involves the following steps:

One needs to go to matlab installation folder e.g.

 /usr/local/MATLAB/R2015b/toolbox/local/

and edit pathdef.m file:

 sudo vim pathdef.m

where find the rows:

p=[...
%%% BEGIN ENTRIES %%%
matlabroot,'/toolbox/matlab/lang:',...

and modify them as follows:

p=[...
%%% BEGIN ENTRIES %%%
'/usr/local/mprogs/Users:', ...
 matlabroot,'/toolbox/matlab/lang:',


where /usr/local/mprogs/Users folder is the folder where appropriately configured horace_on and mslice_on scripts can be found. See Configure Horace and Configuring Mslice for details on how to configure these scripts. Note, that the syntax of the changes to pathdef.m has to be exact to avoid problem with Matlab components search path.

Configuring Matlab 2015b to work with gcc8.4.5 for combining using mex code on RHEL7

By default, Maltab 2015b mex code works with GCC4.7 but RHEL 7 default compiler is GCC4.8 and downgrading to gcc 4.7 is not straightforward. From other side, the table below shows, that using mex code for combining files on isiscompute cluster is very beneficial:

Combining sqw files on isiscompute server
Code and settings Combining speed Mb/s Time to combine 142Gb (min) use_mex_for_combine1) mex_combine_thread_mode
Matlab 2015b, buffer N/A 67 37 false N/A
combine_sqw.mex. buffer 1024, 598 4 true 1
combine_sqw.mex. buffer 1024 517 5 true 0

Notes:

  1)The thread mode is set up by Horace setup command: 
   set(hor_config,'use_mex_for_combine',1,'mex_combine_thread_mode',1); 
   See Horace setup for the details of configuring Horace to use mex files.

Apparently, one can use gcc 4.8 compiler, but to use multi-threaded combining, the following changes have to be done for Matlab 2015b, assuming Matlab and gcc4.8 are installed in the system in default locations.

 >>cd /usr/local/MATLAB/R2015b/sys/os/glnxa64
 >>rm libstdc++.so.6 
 >>ln -s /usr/lib64/libstdc++.so.6.0.19 libstdc++.so.6

The changes causes no known negative effects on Matlab or Horace under Maltab2015b.

Back to setting up Mantid