0

I am trying to run a Matlab code in the HPC of my university. The code is submitted using qsub and a bash file.

In order to use Matlab R2019b, I have been instructed that: To make use of Matlab R2019b add the following to the top of your script after the scheduler flags

export PATH=/username/local/matlab/bin:$PATH

I'm having troubles in doing that. At the moment, my bash file opens Matlab R2015b (instead of Matlab R2019b). (Note: in place of username I have put my actual username). This is my bash:

#$ -S /bin/bash
#$ -l h_vmem=4G
#$ -l tmem=4G
#$ -l h_rt=24:0:0
#$ -cwd
#$ -j y

#Run 3 tasks where each task has a different $SGE_TASK_ID ranging from 1 to 3
#$ -t 1-3

#$ -N try
date
hostname


#Output the Task ID
echo "Task ID is $SGE_TASK_ID"

export PATH=/username/local/matlab/bin:$PATH


matlab -nodisplay -nodesktop -nojvm -nosplash -r "main_1; ID = $SGE_TASK_ID; main_2; exit"

I have also tried with export PATH=/username/local/matlabR2019b/bin:$PATH but the issue persists.

Also, if from the terminal I type cd /home/username/local it tells me that the folder does not exist. How is that possible?

13
  • Where is Matlab actually installed in? It's impossible to help you without this info. Also for some reasons I believe it must be $HOME/local/matlab/bin:$PATH, and not what is proposed. Aug 27, 2020 at 13:27
  • The instructions say (exact quoting): "Matlab 2019b is installed locally on the compute nodes rather than in share apps. To make use of it add the following to the top of your script after the scheduler flags export PATH=/username/local/matlab/bin:$PATH" Aug 27, 2020 at 13:29
  • 1
    In short please show the output of find / -name matlab -xdev 2>/dev/null. If it returns nothing remove -xdev Aug 27, 2020 at 13:29
  • 1
    Please run the command I've given earlier. Don't be annoying and inattentive. Aug 27, 2020 at 13:43
  • 1
    OK, then change it to find / -name matlab -type f -xdev 2>/dev/null and run it again. Post the output in your question, not in a comment. Aug 27, 2020 at 13:44

1 Answer 1

1

To locate which matlab is being used by the script, at the command line, try

PATH="/username/local/matlab/bin:$PATH"   ; export PATH

The quotes guarantee correct assignment of path if there are space characters in the directory tree to the command. Then enter

which matlab

that will give you the fullpath to the matlab command, which should give you insights as to what is getting precedence and why. Sometimes, the output of

whereis matlab

will give you other hints to help solve the PATH precedence issue.

If you have more than one installation of matlab, you may need to purge the offending one.

If you have only one installation of matlab, you need to do a complete package removal (including config files) using whichever tool you prefer, then re-install the package. You might be suffering from some old config values applicable to earlier versions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .