user74806
user74806

Reputation: 11

How to increase the java heap memory size when running matlab in batch mode

I am running a parallel matlab code using 12 processors in a centralised cluster (linux) of my institute. The code runs fine however it is unable to print the excel files. I am using xlwrite function and have all relevant folders and files in the working directory. The error that I get is

``Error using org.apache.poi.xssf.usermodel.XSSFCell/setCellValue Java exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded

How can i change the heap memory?

Each excel file that is generated (expected) has some 45000 rows and six columns and contains integers as well as float data. (I am using the xlwrite function four times in the entire code) The input data variable that is used in the code is of some 22MB size. The same piece of code ran perfectly on a Windows machine having 32GB RAM. However I have lost access to it and hence need to know how to run it on a linux machine. The cmd file to submit the job in server is:

 #!/bin/bash
#@ output     = test.out
#@ error      = test.err
#@ job_type   =  MPICH
#@ node = 1
#@ tasks_per_node = 16
#@ class = Medium128
#@ environment = COPY_ALL 
#@ queue
Jobid=`echo $LOADL_STEP_ID | cut -f 6 -d .`
tmpdir=$HOME/scratch/job$Jobid
mkdir -p $tmpdir; cd $tmpdir
cp -R $LOADL_STEP_INITDIR/* $tmpdir
matlab < filterDataVal.m 
mv ../job$Jobid $LOADL_STEP_INITDIR

Upvotes: 0

Views: 663

Answers (2)

Ton
Ton

Reputation: 66

If you had access to the Matlab GUI you would be able to edit the Java heap size in the preference window (MATLAB/General/Java Heap Space).

Since you work on a cluster, as an alternative you can edit the preference file matlab.prf with your favorite text editor. The location of this file depends on your OS and MATLAB version, you can find it by typing prefdir in Matlab. Since you work on a Linux cluster it is probably in a subdirectory of ~/.matlab. Anyhow, simply add the following line to matlab.prf:

JavaMemHeapMax=I5000

You can replace 5000 by any number you like, it is measured in MB.

Upvotes: 1

user74806
user74806

Reputation: 11

I managed to log in to the cluster by ssh -X and then changed the heap memory through preferences settings on the GUI

Upvotes: 1

Related Questions