Skip to content

Warning: This page is waiting for an update, the Brazos cluster is no longer in operation.

Please contact Mitchcomp help if you have any questions.

This is a guide to set up Matlab-cdmstools in the CDMS Machines for Analysis at Texas A&M. The instructions also work foy your personal machine, provided you compile Root 5.34 properly. If you have questions contact us (Jorge D. Morales and Richard Lawrence).

Basics and background

This guide provides instructions for setting up MatCAP in the Brazos Cluster. Also this works for personal machines, provided you compile root accurately and don’t have compiler conflicts (notes on past experience is provided for this matter). For our cluster, Root has been set up already by us, so all you need to do is source it accurately. As far as the MatCAP repository, you need to import it from the git repository; that part is the same regardless of the system.

This guide will show steps for the Brazos Cluster, and then give advice (since some steps depend on the platform) for personal machines. Example code and command instructions will be typed in black boxes (note command/terminal input is preceded by >$).

login.brazos.tamu.edu – Brazos Cluster

1. Log in to the machine (with X term activated)

>$ ssh -X {username}@login.brazos.tamu.edu

 

2. Set up the environment to load Root (5.34) through miniconda, and to load Matlab 2015a. You must do this every time you log-in.

>$ export PATH=/home/hepxadmin/miniconda/bin:$PATH 
>$ export LD_LIBRARY_PATH=/home/hepxadmin/miniconda/lib
>$ module load gcc/4.8.2 matlab/R2015a

Note: This also sets up the path to the root libraries and the libblas libraries required by cdmstools (cdmsbats).

3. In your home area, create a designated folder for your analysis. This folder will contain cdmstools, the created matlab initialization files, and additional setup files (only a couple of them). It is recommended to keep all of them in the same location. And every time you start matlab for cdmstools analysis locate yourself there to load the startup scripts accurately.

 >$ mkdir cdms_matlab
>$ cd cdms_matlab

4. Import the cdmstools repository. To do this you will have to set up a couple of variables, an ssh config file, and finally run cvs. For this you need to be able to log in to any of the stanford machines, alternatively you can get a cdmstools copy from another member of our group, and skip this part.

  • Edit your ssh config file. If it doesn’t exist it will be created:
    >$ emacs ~/.ssh/config 

    – Append the following:

    Host neroHostname nero.stanford.edu
     port 26user {your-username}

    (Save the file and exit)

  • Go to the directory where you want to locate the code in.
    – Check out the code:
    >$ git clone --recursive nero:/data/git/Analysis/MatCAP.git // or scdmstools_*.git

5. Run the following script (just type the following command). It will replace some make files, adding the paths to the libraries in miniconda, and libblas (makeCAP.mk, linalgebra/makeCAP.mk, CAP_auto_config.m), as well as adding a link to the boost c++ headers. It is important that you are in the location of cdmstools (but not inside it!).

>$ ~hepxadmin/matCAPgit_fixes/fix_brazosCAP.sh {your-abolute-path}/MatCAP 

6. In the cluster you need to request an interactive session, otherwise the load on the login node will exceed the quota and your session will stop working. Go to the Matlab and Interactive Sessions guide for more information about this. For now, just run an interactive session like this (this will open Matlab):

>$ srun -p interactive --pty --x11=first --mem 8000 matlab 

7. Matlab is open, now set up MatCAP. This will set up all the files and compile the code, it is only needed once, or if you make new calculated cuts and ‘update’ your CVS package. You should be in the directory created in step 2.

  • The following are commands/input for Matlab:
    i. Go to the directory where the config files are located:
    >$ cd cdms_matlab/MatCAP/setup

    ii. You only need to run this once, next time you work MatCAP will already be set up and compiled! This will initialize the cdmstools configuration and compilation.

    >$ MatCAP_auto_config
    • – You will be asked for input, choose (type) the following when prompted, some of them are ready for you to hit enter, some of them need to be re-defined as follows (replace {your-path} with the absolute path of the directory):

      • CAP directory:
        {your-path}/cdms_matlab/MatCAP
      • CAP_buffer directory:
        {your-path}/cdms_matlab/CAP_buffer
      • Default data directory (recommended):
        /fdata/hepx/store/user/cdms_data/
      • Default cal directory (recommended): Same as above
      • startup.m path (recommended):
        {your-path}/cdms_matlab // the same level as MatCAP directory
      • Then the CAP MEX files will be compiled.
      • You might see (orange) warnings, that’s ok, and messages indicating successful compilations. You should read:
        Done with compiling BatTools!
        Done with compiling cdmstools mex files!
        MatCAP_auto_config is now finished. You should be able to run CAP_init after restarting Matlab without any problems.
  • iii. Exit Matlab
     >$ exit 

8. MatCAP is ready, you just need to load it upon starting Matlab. You are set! (Note: check the ~FCCS/ directory to make sure there are FCCS/root/data and FCCS/root/cuts directories under it. Create them if they are not here.)

  • Open Matlab again, always open it where you put the startup.m file.
    >$ srun -p interactive --pty --x11=first --mem 8000 matlab
    • Again Matlab input:
      >$ CAP_init 

      This line initializes all the MatCAP tools once everything is compiled.

    • After the check is done, you will be prompted to load data. The first time, select independent files to create a .matlist file, or select all files within a path. The following times you don’t need to click on every dataset but instead in the saved filelist.
  • For a MatCAP package that is already set up (i.e. if you have already followed all the steps above successfully), the only things you need to do after logging in are:
    >$ export PATH=/home/hepxadmin/miniconda/bin:$PATH 
    >$ export LD_LIBRARY_PATH=/home/hepxadmin/miniconda/lib 
    >$ module load gcc/4.8.2 matlab/R2015a 
    >$ cd {your-path}/cdms_matlab/
    >$ srun -p interactive --pty --x11=first --mem 8000 matlab(in MATLAB)>$ CAP_init

 

cdms2.physics.tamu.edu

1. Log in to the machine (with X term activated)

>$ ssh -X {username}@cdms2.physics.tamu.edu

 

2. In your home area, create a designated folder for your analysis. This folder will contain cdmstools, the created matlab initialization files, and additional setup files (only a couple of them). It is recommended to keep all of them in the same location.

 >$ mkdir cdms_matlab
>$ cd cdms_matlab

 

3. Import the cdmstools repository. To do this you will have to set up a couple of variables, an ssh config file, and finally run cvs. For this you need to be able to log in to any of the stanford machines, alternatively you can get a cdmstools copy from another member of our group, and skip this part.

  • Edit your ssh config file
    >$ cd 

    – Go to your home dir

    >$ emacs .ssh/config 

    – Edit this file, if it doesn’t exist it will be created. Append the following:

    Host titus
       Hostname titus.stanford.edu
       port 26
       user georgemm01

    (Save the file and exit)

  • Set up the variables for CVS
    >$ export CVS_RSH=ssh
    >$ export CVSROOT=titus:/home/cvs
  • Checkout your copy of CVS
    >$ cd {path-to}/cdms_matlab

    – Go to the directory of step 2

    >$ cvs checkout cdmstools

    – This will create a directory called cdmstools and import all the files

 

4. Replace 2 fixed files (in three locations). These files were corrected to be able to compile in Matlab 2014, simply copy them over the old ones before compiling. They are residing in Jorge’s home area, copy them like this:

>$ cp /home/georgemm01/Applications/matlab2014_fixes/CAP_make_binaries_root.m {path-to}/cdmstools/CAP_aux/. 
>$ cp /home/georgemm01/Applications/matlab2014_fixes/makeBatTools.m {path-to}/cdmstools/mex_code/BatTools/.
>$ cp /home/georgemm01/Applications/matlab2014_fixes/makeBatTools.m {path-to}/cdmstools/mex_executables/BatTools/.

 

5. Source Root. Add the following lines in your .bashrc file and source it.

>$ emacs ~/.bashrc

– Edit the file and add the following lines

## ROOT CONFIGURATION VARIABLES ##
. /usr/local/root/bin/thisroot.sh
export ROOTSYS=/usr/local/root
export PATH=$ROOTSYS/bin:$PATH
export LD_LIBRARY_PATH=$ROOTSYS/lib

 

6. Open Matlab and set up CDMStools. This will set up all the files and compile the code, only needed once (as all the steps in so far, it is a configuration step). You should be in the directory created in step 2.

  • >$ matlab

    – Open Matlab (if it’s the first time you will have to set up your activation/license). The following are commands/input for Matlab

    • i. Go to the directory where the config files are located
      >$ cd cdmstools/setupUtility 

      ii. You only need to run this once, next time you work cdmstools will already be set up and compiled!This will initialize the cdmstools configuration and compilation, you will be asked for input, choose (type) the following when prompted:

      >$ CAP_auto_config 
      • CAP directory:
        {path-to}/cdms_matlab/cdmstools/CAP/
      • CAP_user directory:
        {path-to}/cdms_matlab/cdmstools/CAP_user/
      • bootStrap directory:
        {path-to}/cdms_matlab/cdmstools/generalUtility/bootStrap/
      • cdmstools directory:
        {path-to}/cdms_matlab/cdmtools/
      • User matlab directory (recommended):
        {path-to}/cdms_matlab
      • startup.m path (recommended):
        {path-to}/cdms_matlab
      • Default data directory: Up to you (suiting the data you want to analyze, if you brought any). This one is just for convenience so you don’t have to click too much when looking for data
      • Default cal directory: Same as above
      • CAP_buffer:
        {path-to}/cdms_matlab/CAP_buffer/
      • Then you will be asked if you want to compile CAP MEX files. Choose 1 (re-compile)
      • You might see (orange) warnings, that’s ok, and messages indicating successful compilations. You should read:
        CAP_auto_config is now finished. You should be able
        to run CAP_init after restarting Matlab without any problems.
    • iii. Exit Matlab
       >$ exit 

 

7. CAP is ready, you just need to load it upon starting Matlab. You are set!

  •  >$ matlab

    – Open Matlab again (always open it where you put the startup.m file). Again Matlab input:

    • >$ CAP_init 

      This line initializes all the CAP tools once everything is compiled. You only need to run it like this the first time (or after re-compilations), otherwise you can skip the time-consuming checks by doing:

      CAP_init('',0)
    • After the check is done, you will be prompted to load data. The first time, select independent files to create a .matlist file, and the following times you don’t need to click on every dataset but instead in the saved filelist.

Advice for Personal Machines

Setting up cdmstools depends on the versions of your Root version, your Matlab version (2013 or 2014), and thus in the compiler version (gcc, g++, gfortran). These are the versions that I found useful:

  • Root 5.32/04
    • Most easily compiled with gcc-4.4 g++-4.4 gfortran-4.4
    • May need a couple of tweaks when compiling in Ubuntu(14.04), or Fedora(19)
      • Create a soft link: {path-to-root}/bin/rmkdepend -> /usr/bin/rmkdepend
      • Adding the
        #include <"include/resource.h">

        in a TUnix.cxx file (will catch if compiling fails), and will need to add this header file under /usr/include of your machine

      • Make sure to have installed all the libraries needed (build prerequisites)
  • gcc, g++, and gfortran 4.4 or 4.8
    • 4.8 works even though compiling the MEX code in matlab produces a lot of warnings
    • 4.4 worked better in Ubuntu (matching the resources used in root), but in fedora everything worked with 4.8
  • Matlab Version
    • 2014 will compile only if the matlab2014_fixes files are copied over the older ones, basically they attend minor changes in the mex function input
    • 2013 works without any of the aforementioned changes in the cdmstools code
  • Boost C++
    • May beed to compile and source the boost c++ libraries
    • Can follow the quick fix used in the Brazos cluster? It also worked in Ubuntu, but wasn’t needed in Fedora