1

I am working on a LSF server and using a bsub command to run a perl wrapper script to an R script. Here is my command:

bsub -XF -n 1 -R "rusage[mem=16]" -We 60 -J <job_array> -o out.log 'script.pl <script arguments>'

This perl script is calling an R script that does some calculations, and then prints a PNG plot. R is set up on our LSF cluster in such a way that it doesn’t allow to initiate a PNG device without enabling X11 forwarding. I have X11 forwarding enabled and this works fine until I want to use Job arrays. According to the LSF manual, job arrays are incompatible with X11 forwarding.

This would require us to change the scripts to write to PDF files instead of PNG, however, we do not want to change the scripts that we are currently using, as those are part of a bigger, publicly available pipeline and we would not want any discrepancies between the publicly available and the locally installed version.

Is there anyway we can use R to write PNG plots without X11 forwarding?

Thanks!

Komal Rathi
  • 4,164
  • 13
  • 60
  • 98
  • So would I be correct in saying if you are at the R console with X11-forwarding disabled and you do something like `png("test.png"); plot(rnorm(100)); dev.off()`, you don't get a plot? – maccruiskeen Dec 14 '15 at 22:16
  • I get a plot but it is empty. – Komal Rathi Dec 14 '15 at 22:18
  • Okay, on my cluster without X11 I do get a plot so I'm not sure how to help – maccruiskeen Dec 14 '15 at 22:24
  • Sorry, I meant the png file is created but it is empty. I don't get a plot. – Komal Rathi Dec 14 '15 at 22:31
  • 2
    This is a repeat question, hence closed. (Basic) PNG needs x11 for font-metrics, so either use a different device (one of the Cairo devices can create PNG without x11) -- or use `xvfb-run` to 'fake' a virtual x11 server. – Dirk Eddelbuettel Dec 14 '15 at 22:41
  • The perl scipt is a wrapper for 12 R scripts, some of which are X11 dependent. How can I modify my bsub command to account for xvfb-run? I have never used it so not sure how to apply it. – Komal Rathi Dec 14 '15 at 22:43
  • 1
    If `prog arg1 arg2 arg3` is your existing call then `xvfb-run prog arg1 arg2 arg3` would be your new call. Just like `nice` or `time` or ... – Dirk Eddelbuettel Dec 14 '15 at 23:11
  • Will installing a local R version and using that will solve this issue? I am guessing it is not that simple though. – Komal Rathi Dec 15 '15 at 22:10

0 Answers0