[R] npRmpi memory error

Chris Carleton w_chris_carleton at hotmail.com
Mon Dec 6 16:22:56 CET 2010

Hi List,

I'm using npRmpi to run some density equality tests and place the
output into a matrix. I've put together some crude functions for the
purpose, but I'm receiving the following error when npdeneqtest()
reached the bootstrap;

FATAL ERROR: Memory allocation failure (type DBL_VECTOR). Program terminated.

I'm running Ubuntu Lucid 64bit with 4 cores and 12GB of memory. My R
install is also 64bit.

platform       x86_64-pc-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
major          2
minor          12.0
year           2010
month          10
day            15
svn rev        53317
language       R
version.string R version 2.12.0 (2010-10-15)

Here's the home-brew function I'm using;

npdenseqtestMatrix <- function(df1_row,df2_col,var_names,...) {
	dim_nms_row <- unique(df1_row[,'cat'])
	dim_nms_col <- unique(df2_col[,'cat'])
	tn_pval <- c()
	col_bw <- list()
	for(i in dim_nms_col) {
		col_bw[[which(dim_nms_col==i)]] <-
	for(i in dim_nms_row) {
		df1_row_bw <- npudensbw(df1_row[which(df1_row[,'cat']==i),var_names],...)
		for(j in dim_nms_col) {
			tn_pval <- c(tn_pval,npdeneqtest(df1_row[which(df1_row[,'cat']==i),var_names],df2_col[which(df2_col[,'cat']==j),var_names],bw.x=df1_row_bw,bw.y=col_bw[[which(dim_nms_col==j)]],...)$Tn.P)

Keep in mind that 'cat' is just a shorthand for Category in this case
and it's acting as a database key (largely because the data come from
GRASS). I think that my memory allocation should be unlimited (well to
the hardware potential) since I'm using 64 bit installs. I have no
experience with coding anything for parallel processing. It may also
be relevant to point out that I commonly use screen and work remotely,
but I've tried with and without screen and the result is the same
error. I can't really provide the data here because my dataset is
quite large (though I don't think large enough to fill 12GB of
memory). Any thoughts would be appreciated,


More information about the R-help mailing list