[Rd] Default accessor in S4 classes

2013-01-07 Thread Chris Jewell
Hi All,

I'm currently trying to write an S4 class that mimics a data.frame, but stores 
data on disc in HDF5 format.  The idea is that the dataset is likely to be too 
large to fit into a standard desktop machine, and by using subscripts, the user 
may load bits of the dataset at a time.  eg:

 myLargeData - LargeData(/path/to/file)
 mySubSet - myLargeData[1:10, seq(1,15,by=3)]

I've therefore defined by LargeData class thus

 LargeData - setClass(LargeData, representation(filename=character))
 setMethod(initialize,LargeData, function(.Object,filename) 
 .Object@filename - filename)

I've then defined the [ method to call a C++ function (Rcpp), opening the 
HDF5 file, and returning the required rows/cols as a data.frame.

However, what if the user wants to load the entire dataset into memory?  Which 
method do I overload to achieve the following?

 fullData - myLargeData
 class(fullData)
[1] data.frame

or apply transformations:

 myEigen - eigen(myLargeData)

In C++ I would normally overload the double or float operator to achieve 
this -- can I do the same thing in R?

Thanks,

Chris

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


[Rd] R with ATLAS avoids Linux cpu affinity

2010-12-06 Thread Chris Jewell
Hi all,

I have a problem with cpu affinity in my R-2.11.1 installation compiled against 
ATLAS running on a Linux (Ubuntu 10.04) cluster under GridEngine.  I wish to 
use Grid Engine's core binding feature to bind user processes into the number 
of cores they request on the cluster, thus preventing badly behaved 
multi-threaded libraries from consuming more cores than requested.  An example 
of this is R compiled against multithreaded ATLAS, which needs to be bound into 
a single core if a user submits a 1 core job.  Grid Engine achieves this 
through the sched_setaffinity system call under Linux 2.6.  For most 
applications (including if I write a test C program that uses ATLAS BLAS), this 
works well, and prevents threads from 'leaking' outside the cpu set they are 
assigned.  However, R appears to be able to avoid the core binding.  This is 
*very* strange as I was under the impression that any child processes or 
threads inherit the cpu affinity of the parent.

Does anyone have experience of this and could offer a comment or solution?

Thanks,

Chris

--
Dr Chris Jewell
Department of Statistics
University of Warwick
Coventry
CV4 7AL
UK
Tel: +44 (0)24 7615 0778

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


Re: [Rd] R with ATLAS avoids Linux cpu affinity

2010-12-06 Thread Chris Jewell

On 6 Dec 2010, at 16:03, Dirk Eddelbuettel wrote:
 AFAICT R should not alter CPU affinity.  So if I were you I'd swap the BLAS
 implementation and try again.  As you are on Ubuntu, you can try the MKL that
 comes with the (now a littler older) Revolution R in Ubuntu 9.10; otherwise I
 can highly recommend the GotoBLAS2 helper package listed in my paper for a
 local GotoBLAS2 built.   The script may be out of sync with the fairly recent
 license change of GotoBLAS2 (to the more liberal BSD license permitting
 redistribution).  With some luck we will GotoBLAS2 deb packages in future
 Debian and Ubuntu releases.


Thanks for the comments, Dirk.  I take your point about ATLAS having the cores 
compiled in.  I have replaced ATLAS with ACML, and all works fine.

Cheers,

Chris


--
Dr Chris Jewell
Department of Statistics
University of Warwick
Coventry
CV4 7AL
UK
Tel: +44 (0)24 7615 0778

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