[Rcpp-devel] how to get rid of the warning message: no graphics system to unregister

Dirk Eddelbuettel edd at debian.org
Mon Feb 13 21:13:00 CET 2012

On 13 February 2012 at 13:38, Haiying Pang wrote:
| Darren,
| I did create the R instance in main(), and pass the reference to another
| function. I do have 1000 CPUs calling that function, but as they don't create
| new R reference, how come there are so many warning messages?   
| After reading your message in another thread of yours, I realize that the
| troublesome part might be that the R reference is passed to a function that
| many other CPUs call. what should I do to fix it? if I let each cpu creates its
| own instance of R, will that end up with more warning messages?  

Now we're talking. Thanks for actually sharing your problem in proper terms.

In short, you can't do that.

R is single threaded, and you have to make sure that only thread calls back
to R.  If you have a suitable problem, you can do what is shown in the mpi/
example directory:  wrap RInside inside on an MPI aware program. That way MPI
takes care of getting your program to the nodes, and each node gets its own
copy.  Naturally, this means that you cannot just work on one large chunk of
data.  You need to think your problem through, and maybe RInside is simply
not part of the solution --- it does make any R restrictions (such as single
threadedness) go away.

| On Sat, Feb 11, 2012 at 8:34 PM, Darren Cook <darren at dcook.org> wrote:
|     > I am calling a R function through Rcpp and RInside in my c++ program
|     > in Linux. There are a lot of warning messages saying "no graphics
|     > system to unregister" ...Is there anyone who knows the reason and how
|     > to avoid the printing of such warning messages?
|     Generally, once you track down the line causing the problem,
|     suppressWarnings() (an R function) might help. Or
|     suppressPackageStartupMessages() or suppressMessages() may help.
|     For the cause, are you running on a machine with no GUI or X server?
|     However, a google suggests this is a message related to shutting down R,
|     and implies your script has corrupted something. There appears to be no
|     fix as they, like Dirk, insisted on a reproducible example.
|     I'm wondering why you would be starting up and shutting down R so many
|     times in your script. Do you create one RInside instance, either as a
|     global, or in main() and then pass it around by reference? Or are you
|     create RInside instances inside other functions, or inside loop bodies?
|     If the latter, can you refactor to do the former so you only have one
|     instance?
|     HTH,
|     Darren
|     --
|     Darren Cook, Software Researcher/Developer
|     http://dcook.org/work/ (About me and my work)
|     http://dcook.org/blogs.html (My blogs and articles)
|     _______________________________________________
|     Rcpp-devel mailing list
|     Rcpp-devel at lists.r-forge.r-project.org
|     https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| --
| Haiying Pang
| ----------------------------------------------------------------------
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

More information about the Rcpp-devel mailing list