[Rinside-commits] r120 - pkg/inst/examples/mpi

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 17 02:51:02 CET 2010


Author: edd
Date: 2010-03-17 02:51:02 +0100 (Wed, 17 Mar 2010)
New Revision: 120

Modified:
   pkg/inst/examples/mpi/rinside_mpi_sample1.cpp
   pkg/inst/examples/mpi/rinside_mpi_sample3.cpp
Log:
update to minor API change as well


Modified: pkg/inst/examples/mpi/rinside_mpi_sample1.cpp
===================================================================
--- pkg/inst/examples/mpi/rinside_mpi_sample1.cpp	2010-03-17 01:44:57 UTC (rev 119)
+++ pkg/inst/examples/mpi/rinside_mpi_sample1.cpp	2010-03-17 01:51:02 UTC (rev 120)
@@ -39,11 +39,9 @@
         R.parseEvalQ( txt.str() );      // assign n with the size of sample
 
         std::string evalstr = " mean(runif(n,x,y))";  // sampling, compute the mean
-        if ( R.parseEval(evalstr, ans) )              // eval the evalstr string, return results
-            throw std::runtime_error( "R cannot evalueate '" + evalstr + "'" );
+        ans = R.parseEval(evalstr);	// eval the evalstr string, return results
+	Rcpp::NumericVector m(ans);     // convert SEXP variable to an Rcpp::NumericVector
 
-        RcppVector<double> m(ans);      // convert SEXP variable to an RcppVector
-
         sendValue = m( 0 );             // assign the return value to the variable to be gathered
 
         //gather together values from all processes to allvalues

Modified: pkg/inst/examples/mpi/rinside_mpi_sample3.cpp
===================================================================
--- pkg/inst/examples/mpi/rinside_mpi_sample3.cpp	2010-03-17 01:44:57 UTC (rev 119)
+++ pkg/inst/examples/mpi/rinside_mpi_sample3.cpp	2010-03-17 01:51:02 UTC (rev 120)
@@ -38,19 +38,14 @@
         R.parseEvalQ( txt.str() );      // assign n with the size of sample
 
         std::string evalstr = " mean(runif(n,x,y))";  // sampling, compute the mean
-        if ( R.parseEval(evalstr, ans) )              // eval the evalstr string, return results
-            throw std::runtime_error( "R cannot evalueate '" + evalstr + "'" );
+        ans = R.parseEval(evalstr);	// eval the evalstr string, return results
+	Rcpp::NumericVector m(ans);     // convert SEXP variable to an Rcpp::NumericVector
 
-        RcppVector<double> m(ans);      // convert SEXP variable to an RcppVector
-
         sendValue = m( 0 );             // assign the return value to the variable to be gathered
 
         //gather together values from all processes to allvalues
 	MPI::COMM_WORLD.Gather((const void*)&sendValue, sndcnt, MPI::DOUBLE, (void*)allvalues, rcvcnt, MPI::DOUBLE, 0);
 
-	//rinside_mpi_sample3.cpp:49: error: no matching function for call to ‘MPI::Comm::Gather(double*, int&, const MPI::Datatype&, double*&, int&, const MPI::Datatype&, int, MPI::Intracomm&)’
-	///usr/lib/openmpi/include/openmpi/ompi/mpi/cxx/comm_inln.h:320: note: candidates are: virtual void MPI::Comm::Gather(const void*, int, const MPI::Datatype&, void*, int, const MPI::Datatype&, int) const
-
         // show what inidividual node's contribution
         std::cout << "node " << myrank << " has mean " << m(0) << std::endl;
 



More information about the Rinside-commits mailing list