running MATLAB on HPC ....(MATLAB Job Script: Output Log Shows No Data After Running)

7 views (last 30 days)
Hi,
I'm running a MATLAB job on an HPC cluster using SLURM. The script successfully generates a plot and saves it as a PNG file, but the `.out` file only displays the MATLAB startup banner and doesn't show any data or output from the script. The output log shows:
```
< M A T L A B (R) >
Copyright 1984-2021 The MathWorks, Inc.
R2021a (9.10.0.1602886) 64-bit (glnxa64)
February 17, 2021
To get started, type doc.
For product information, visit www.mathworks.com.
```
Here is the batch script I used:
```bash
#!/bin/bash
#SBATCH --job-name=sinewave_plot # Job name
#SBATCH --nodes=1 # Number of nodes
#SBATCH --ntasks=1 # Number of tasks (one task for this MATLAB job)
#SBATCH --cpus-per-task=1 # Number of CPU cores per task
#SBATCH --mem=2G # Memory per node
#SBATCH --time=00:10:00 # Wall time (format: days-hours:minutes:seconds)
#SBATCH --output=sinewave_plot_%j.out # Standard output log
#SBATCH --error=sinewave_plot_%j.err # Standard error log
# Load MATLAB module
module purge
module load apps/matlab/R2021a
# Run MATLAB script
matlab -nodisplay -nosplash -r "run('plot_sinewave.m'); exit;"
```
Is there something I'm missing that would cause the `.out` file to not capture the output from the MATLAB script? I've checked that the script runs without errors interactively, and the `.err` file is empty.
Thanks for your help!
  2 Comments
Sam Marshalik
Sam Marshalik on 5 Sep 2024
Hey Manish,
If you run MATLAB non-interactively as you are doing, you should see things that are displayed to the MATLAB command window in the output file. This will not show your .png, but if you have something like "disp(var)" in your script, you should see that in the .out. Similarly, you want to make sure your code does not have semi-colons (;) to avoid supressing the output. What kind of things are you not seeing that you would expect to see?
Swastik Sarkar
Swastik Sarkar on 16 Sep 2024
Could the plot_sinewave.m file be shared? This will help in understanding the expected output when it is run.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!