I have access to a cluster that uses SLURM. I am not very knowledgeable about using clusters, so figuring out how to submit Mathematica jobs was a challenge but eventually something was worked out. Now, I am using my code to do multiple simulations, and depending on parameters, it can take ~3 hours to a day to generate the data. The problem is, plotting this data takes a long time when I do it on my computer (I use Graphics instead of ListPlot, as well, to try to speed it up some), and I would greatly prefer if I could generator the plot and export it to png/pdf like how I generate the data and export it to a .txt file for later usage.

Now, to test submit Mathematica jobs, I just made a really quick script that was focused on what I was hoping to do with my code/jobs:

data = Table[i, {i, 10}];
dPlot = ListPlot@data;
Export["try.txt", data, "CSV"];
Export["try.png", dPlot];

Now, when I comment out the .png export, the code runs fine, and a text file prints out. However, when I include the Export["try.png", dPlot]; line, in the .err file, I find the text:

Qt issued a fatal error: QXcbConnection: Could not connect to display localhost:12.0

Qt tried to load plugins from:

Mathematica was installed in /c1/apps/mathematica/11.3.0
/c1/apps/mathematica/11.3.0/Executables/Mathematica: line 130: 19063 Aborted (core dumped) "${MathematicaFE}" -topDirectory "${TopDirectory}" "$@"

I cannot make heads nor tails of this error message, though it appears, in the .out file, that the plot was generated:

Out[]: - Graphics -

My question is this: in this sort of environment, is it not possible to export plots, even though it appears that the plot is being generated?

I tried to look up "hpc", but most of the posts seem concerned with parallelization, and only 6 results popped up when I searched "SLURM". Any advice would be appreciated.

  • $\begingroup$ Perhaps, distro used on cluster is missing some libs, can you log into console and check uname -a? If you have gnuplot, try to generate png with it. I don't think, WM graphics can benifit from multi CPU/GPU (unless you want to generate several plots and then merge them). Also, try specialized tools, like paraview. $\endgroup$
    – I.M.
    Jun 9, 2020 at 6:07
  • $\begingroup$ @I.M. Thanks for the comment. I was indeed able to open an interactive gnuplot session and then follow a demo to make a plot. This gives me the idea to try to import my data into gnuplot and try plotting it that way. I hadn't considered combining multiple plots together, which might be worthwhile since I plot after generating all my data. I have never heard of paraview before, so I'll look into it. Thanks for the comment! $\endgroup$
    – Illari
    Jun 9, 2020 at 14:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.