Processing tips on CCAR systems

Any CCAR user can use the common use Linux systems for data processing. In this section we'll be adding tips that should help the user to better prepare long running scripts and programs (Matlab, IDL, C, Fortran, etc) to run smoothly on CCAR systems.



1. For programs or scripts that run for multiple days, it is highly recommended that the user include check points in their code. So if the computer is rebooted or crashes, the entire code does not need to be re-run. Users must keep in mind that the common use systems are used by multiple people to run data processing and because of this, chances are higher that the system might encounter problems resulting in the need to reboot the system. Also there are times when the Linux computers need to be rebooted into their new Kernels or general maintenance needs to be done. In either case, having check points included into your programs will make life alot easier for you to restart your program and have it pick up where it left off.



2. For those who find Matlab lacking, you can try something we have available on all CCAR Linux systems called Matplotlib. It's a Python module that allows you to do everything Matlab will do and in many cases, it's easier to use and graphical outputs look better. At least that is what I'm told! Here's a description.

Matplotlib is a 2D plotting library that works with the high-level programming language Python. It is free, has a MATLAB like interface, and provides higher quality images for presentations and publication. Additionally, matplotlib provides some capabilities that MATLAB does not. For example, transparent legends or linked axes (when the user zooms into one subplot, all other subplots also zoom into the same region). For sample images and the code used to generate them, see the following website:
http://matplotlib.sourceforge.net/gallery.html



3. If you are using Matlab and want to try to utilize systems with multi-core processors, please check the following link on how to write your Matlab code correctly. Matlab does not use multiple cores by default.
Using MATLAB on Multicore Machines
Speeding up MATLAB Applications



4. For projects directories, you have to make sure to change the group permissions so that the entire group can access newly created directories and files.
Here's the Linux command:

For a single file -> chmod g+rw FILENAME

For a directory and everything within -> chmod -R g+rw DIRECTORYNAME



5. If you want to run any type of process in the background and have the ability to completely log off the system, please follow these directions:

- Log into the system you want to do the processing on
- Open a terminal window and type the following:
screen

-Now type your command (matlab in this example) command:
nohup matlab -nodisplay -nodesktop -nojvm -nosplash < in_file > out_file.txt &
where:
in_file = input matlab script file
out_file.txt = matlab command windows output

-Next hold ctrl-a then hit the d key to disconnect from the terminal
Now the process will continue to run even if you log off completely.

- Once the process is done, log back into the same Linux system, and type:
screen -r
This will reconnect you to the running process. Now just type "exit" and you are done.



6. Printing plots directly from Matlab.
There have always been problems trying to print plots from Matlab directly. It always seems to fail or the options are just not set right. Thanks to CCAR's own Elliot Barlow, the secret to getting plots to print has been solved.
- Start with an open figure, and select "Print Preview" from the file menu. The preview window should open up showing your figure, only in black and white.
- Click on the color tab along the top left, and click the color button. Your figure should now appear in color in the preview on the right.
- Since MATLAB automatically attempts to fill the page with the figure, it may be necessary to make them smaller. Do this by clicking on the Layout tab, click the "Use manual size and position" button, and you can change the dimensions manually. Note that if you resize the image, the aspect ratio may be changed; just select one dimension and click "Fix aspect", at which point that dimension will be changed to restore the original aspect ratio.
- Alternately, if you want to really use up the whole page, click the Landscape button near the bottom of the panel, and then make sure that the Auto (Placement and size) button is selected to make sure the image fills the paper.
- When you're done, click the print button, and make sure to select the right printer.


We'll be adding more to this section when issues occur.