Hi Jianping,

On 17 February 2010 at 11:51, Jianping Hua wrote:
| Hi, Dirk:
| 
| Segmentation error is my stupid typo. The memory assignment in line 19
| surely should be
|     double *allvalues = new double [ nodesize ]; // to save all results
| rather than
|     double *allvalues = new double ( nodesize ); // to save all results

Oh boy, now we both look silly :)  I glanced at this for a while and thought
it looked funny. But I use std::vector so much and not new / delete[] that it
didn't click.  

That does indeed fix things.
 
| The new makefile did not work on my MBP still because of the mtune
| parameter. Basically I have to use
| CXXFLAGS := $(MPILIBS) $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) -g -O2

What I currently have has your two contributed examples in a new subdirectory
(as not everybody will have MPI around) and that use the Makefile below. Can
you try that?  It uses mpic++ -showme:.... to extract the proper values for
the header files and libraries. That works for me with Open MPI.  Can you try 
it?
 
| Surely you can add these examples to next RInside tarball.

Awesome, thanks.  We will of course give you proper credits for the 
contribution.

Dirk


## -*- mode: make; tab-width: 8; -*-
##
## Simple Makefile
##
## TODO: 
##  proper configure for non-Debian file locations,   [ Done ]
##  allow RHOME to be set for non-default R etc

## comment this out if you need a different version of R, 
## and set set R_HOME accordingly as an environment variable
R_HOME :=               $(shell R RHOME)

sources :=              $(wildcard *.cpp)
programs :=             $(sources:.cpp=)


# OpenMPI header and libraries
MPICPPFLAGS :=          $(shell mpic++ -showme:compile)
MPILIBS :=              $(shell mpic++ -showme:link)

## include headers and libraries for R 
RCPPFLAGS :=            $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS :=             $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS :=                $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK :=              $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)


## include headers and libraries for Rcpp interface classes
RCPPINCL :=             $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R 
--vanilla --slave)
RCPPLIBS :=             $(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R 
--vanilla --slave)


## include headers and libraries for RInside embedding classes
RINSIDEINCL :=          $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R 
--vanilla --slave)
RINSIDELIBS :=          $(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R 
--vanilla --slave)


## compiler etc settings used in default make rules
CXX :=                  $(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS :=             -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS :=             $(MPICPPFLAGS) $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) 
$(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
LDFLAGS =               -s
LDLIBS :=               $(MPILIBS) $(RLDFLAGS) $(RBLAS) $(RLAPACK) $(RCPPLIBS) 
$(RINSIDELIBS)

all :                   $(programs)

clean:
                        rm -vf $(programs)



-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to