[Rd] Does dlltools in 64-bit rtools for windows support 64-bit machine type?

2012-12-31 Thread Johan Johansson
Hi,

I've been trying to get the python bridge (rpy2) to build for 64-bit R
and python. The current stumbling block is that mingw can't use the
python27.lib file that comes with CPython and so I need to generate
libpython27.a.

When I use dlltool from rtools to do that however, I end up with a 32-bit file:

>"G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool" -e libpython27.a -d 
>python27.def python27.dll
>objdump -f libpython27.a

libpython27.a: file format pe-i386

More problematically, x86_64 is not listed as supported by objdump:

Usage G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool 

   -m --machine Create as DLL for .  [default: i386]
possible : arm[_interwork], i386,
mcore[-elf]{-le|-be}, ppc, thumb

Am I doing it wrong?

Regards,
Johan

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] weird bug with parallel, RSQlite and tcltk

2012-12-31 Thread Karl Forner
Hello,

I spent a lot of a time on a weird bug, and I just managed to narrow it down.

In parallel code (here with parallel::mclappy, but I got it
doMC/multicore too), if the library(tcltk) is loaded, R hangs when
trying to open a DB connection.
I got the same behaviour on two different computers, one dual-core,
and one 2 xeon quad-core.

Here's the code:

library(parallel)
library(RSQLite)
library(tcltk)
#unloadNamespace("tcltk")

res <- mclapply(1:2, function(x) {
db <- DBI::dbConnect("SQLite", ":memory:")
}, mc.cores=2)
print("Done")   

When I execute it (R --vanilla  < test_parallel_db.R), it hangs
forever, and I have to type several times CTRL+C to interrupt it. I
then get this message:

Warning messages:
1: In selectChildren(ac, 1) : error 'Interrupted system call' in select
2: In selectChildren(ac, 1) : error 'Interrupted system call' in select

Then, just remove library(tcltk), or uncomment
unloadNamespace("tcltk"), and it works fine again.

I guess there's a bug somewhere, but where exactly ?

Best,

Karl Forner

Further info:


R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-unknown-linux-gnu (64-bit)

ubuntu 12.04 and 12.10

ubuntu package tk8.5

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Does dlltools in 64-bit rtools for windows support 64-bit machine type?

2012-12-31 Thread Duncan Murdoch

On 12-12-30 9:07 AM, Johan Johansson wrote:

Hi,

I've been trying to get the python bridge (rpy2) to build for 64-bit R
and python. The current stumbling block is that mingw can't use the
python27.lib file that comes with CPython and so I need to generate
libpython27.a.

When I use dlltool from rtools to do that however, I end up with a 32-bit file:


"G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool" -e libpython27.a -d 
python27.def python27.dll
objdump -f libpython27.a


libpython27.a: file format pe-i386

More problematically, x86_64 is not listed as supported by objdump:

Usage G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool 

-m --machine Create as DLL for .  [default: i386]
 possible : arm[_interwork], i386,
mcore[-elf]{-le|-be}, ppc, thumb

Am I doing it wrong?


You aren't using the same flags as R uses in its builds.  For 64 bit 
builds, it uses these flags (from MkRules.rules):


DLLTOOLFLAGS=--as $(BINPREF)as $(DT_ARCH) -k

DT_ARCH = -m i386:x86-64 --as-flags --64

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Does dlltools in 64-bit rtools for windows support 64-bit machine type?

2012-12-31 Thread Prof Brian Ripley

On 31/12/2012 18:19, Duncan Murdoch wrote:

On 12-12-30 9:07 AM, Johan Johansson wrote:

Hi,

I've been trying to get the python bridge (rpy2) to build for 64-bit R
and python. The current stumbling block is that mingw can't use the
python27.lib file that comes with CPython and so I need to generate
libpython27.a.


BTW, 'mingw' is irrelevant as it has not been used by R for a long time. 
 Mingw's dlltool is indeed 32-bit only.



When I use dlltool from rtools to do that however, I end up with a
32-bit file:


"G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool" -e libpython27.a
-d python27.def python27.dll
objdump -f libpython27.a


libpython27.a: file format pe-i386

More problematically, x86_64 is not listed as supported by objdump:

Usage G:\Rtools\gcc-4.6.3\i686-w64-mingw32\bin\dlltool 

-m --machine Create as DLL for .  [default:
i386]
 possible : arm[_interwork], i386,
mcore[-elf]{-le|-be}, ppc, thumb

Am I doing it wrong?


You aren't using the same flags as R uses in its builds.  For 64 bit
builds, it uses these flags (from MkRules.rules):

DLLTOOLFLAGS=--as $(BINPREF)as $(DT_ARCH) -k

DT_ARCH = -m i386:x86-64 --as-flags --64


The irrational mess of flags in GNU bintools is not our doing, and 
suggestions upstream to support e.g. -m64 have fallen on deaf ears.  At 
least a useR does not need to divine this from the bintools 
documentation (at least at the time I had to read the sources as it was 
not in the bintools manual).




Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] weird bug with parallel, RSQlite and tcltk

2012-12-31 Thread Marius Hofert
Dear Karl,

I get exactly the same warning messages with an Rmpi minimal example (also took
me a while to narrow it down). I posted it on R-sig-hpc (more appropriate for
these issues I believe), some days ago, but haven't received an answer yet.

Cheers,

Marius

PS: https://stat.ethz.ch/pipermail/r-sig-hpc/2012-December/001572.html

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] weird bug with parallel, RSQlite and tcltk

2012-12-31 Thread Simon Urbanek

On Dec 31, 2012, at 1:08 PM, Karl Forner wrote:

> Hello,
> 
> I spent a lot of a time on a weird bug, and I just managed to narrow it down.
> 

First, tcltk and multicore don't mix well, see the warning in the documentation 
(it mentions GUIs and AFAIR tcltk fires up a GUI event loop even if you don't 
actually create GUI elements). Second, using any kind of descriptors in 
parallel code is asking for trouble since those will be owned by multiple 
processes. If you use databases files, etc. they must be opened in the parallel 
code, they cannot be shared by multiple workers. The latter is ok in your code 
so you're probably bitten by the former.

Cheers,
Simon



> In parallel code (here with parallel::mclappy, but I got it
> doMC/multicore too), if the library(tcltk) is loaded, R hangs when
> trying to open a DB connection.
> I got the same behaviour on two different computers, one dual-core,
> and one 2 xeon quad-core.
> 
> Here's the code:
> 
> library(parallel)
> library(RSQLite)
> library(tcltk)
> #unloadNamespace("tcltk")
> 
> res <- mclapply(1:2, function(x) {
>   db <- DBI::dbConnect("SQLite", ":memory:")
> }, mc.cores=2)
> print("Done") 
> 
> When I execute it (R --vanilla  < test_parallel_db.R), it hangs
> forever, and I have to type several times CTRL+C to interrupt it. I
> then get this message:
> 
> Warning messages:
> 1: In selectChildren(ac, 1) : error 'Interrupted system call' in select
> 2: In selectChildren(ac, 1) : error 'Interrupted system call' in select
> 
> Then, just remove library(tcltk), or uncomment
> unloadNamespace("tcltk"), and it works fine again.
> 
> I guess there's a bug somewhere, but where exactly ?
> 
> Best,
> 
> Karl Forner
> 
> Further info:
> 
> 
> R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows"
> Copyright (C) 2012 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
> Platform: x86_64-unknown-linux-gnu (64-bit)
> 
> ubuntu 12.04 and 12.10
> 
> ubuntu package tk8.5
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] weird bug with parallel, RSQlite and tcltk

2012-12-31 Thread Simon Urbanek

On Dec 31, 2012, at 4:20 PM, Marius Hofert wrote:

> Dear Karl,
> 
> I get exactly the same warning messages with an Rmpi minimal example (also 
> took
> me a while to narrow it down). I posted it on R-sig-hpc (more appropriate for
> these issues I believe), some days ago, but haven't received an answer yet.
> 

AFAIR MPI doesn't support forking.

Cheers,
Simon


> Cheers,
> 
> Marius
> 
> PS: https://stat.ethz.ch/pipermail/r-sig-hpc/2012-December/001572.html
> 
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 
> 

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel