From kollerma at stat.math.ethz.ch  Fri Jan 15 15:15:13 2010
From: kollerma at stat.math.ethz.ch (kollerma at stat.math.ethz.ch)
Date: Fri, 15 Jan 2010 15:15:13 +0100 (CET)
Subject: [Rd] Using multicore with an open pdf device results in corrupt pdf
	(PR#14186)
Message-ID: <20100115141513.A0F5D2831FFE@mail.pubhealth.ku.dk>

The attached code produces corrupted pdfs (test2.pdf, test4.pdf and
test5.pdf). The resulting pdf depends on how many cores are available on
the machine. 

I don't see why there should be any difference between the pdfs (exept for
the timestamp). Doing many operations involving mclapply can increase the
size of the resulting pdf by ten times!

Thank you for checking this.

require(multicore)

pdf('test.pdf')
y <- unlist(lapply(1:50, identity))
plot(y)
print(y)
dev.off()

options(cores = 3)

pdf('test2.pdf')
y <- unlist(mclapply(1:50, identity))
plot(y)
print(y)
dev.off()

pdf('test3.pdf')
y <- unlist(lapply(1:50, identity))
plot(y)
print(y)
dev.off()

options(cores = 2)

pdf('test4.pdf')
y <- unlist(mclapply(1:50, identity))
plot(y)
print(y)
dev.off()

options(cores = 8)

pdf('test5.pdf')
y <- unlist(mclapply(1:50, identity))
plot(y)
print(y)
dev.off()


--please do not edit the information below--

Version:
 platform = x86_64-unknown-linux-gnu
 arch = x86_64
 os = linux-gnu
 system = x86_64, linux-gnu
 status = 
 major = 2
 minor = 10.1
 year = 2009
 month = 12
 day = 14
 svn rev = 50720
 language = R
 version.string = R version 2.10.1 (2009-12-14)

Locale:
LC_CTYPE=de_CH.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=de_CH.UTF-8;LC_MONETARY=C;LC_MESSAGES=de_CH.UTF-8;LC_PAPER=de_CH.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_CH.UTF-8;LC_IDENTIFICATION=C

Search Path:
 .GlobalEnv, package:skewt, package:rgl, package:ggplot2, package:reshape, package:plyr, package:proto, package:VGAM, package:stats4, package:splines, package:latticeExtra, package:RColorBrewer, package:doMC, package:multicore, package:foreach, package:codetools, package:iterators, package:abind, package:seqinr, package:mvbutils, mvb.session.info, package:tools, package:robust, package:rrcov, package:pcaPP, package:mvtnorm, package:robustbase, package:MASS, package:glmmML, package:playwith, package:grid, package:gWidgetsRGtk2, package:cairoDevice, package:lattice, package:gWidgets, package:graphics, package:grDevices, package:datasets, package:fortunes, package:sfsmisc, package:stats, package:utils, package:methods, Autoloads, package:base



[Rd] Using multicore with an open pdf device results in corrupt pdf (PR#14186)
kollerma at stat.math.ethz.ch