Displaying 20 results from an estimated 500 matches similar to: "Fast way to call an R function from C++?"
2019 Jun 18
2
Fast way to call an R function from C++?
For reference, your benchmark using UNWIND_PROTECT:
> system.time(test(testFunc, evn$x))
user system elapsed
0.331 0.000 0.331
> system.time(test(C_test1, testFunc, evn$x))
user system elapsed
2.029 0.000 2.036
> system.time(test(C_test2, expr, evn))
user system elapsed
2.307 0.000 2.313
> system.time(test(C_test3, testFunc, evn$x))
user system
2019 Jun 19
0
Fast way to call an R function from C++?
Hello Kevin and I?aki,
Thanks for your quick responses. I sincerely appreciate them! I can see how
complicated it is to interact with R in C. I?aki's suggestion is very
helpful, I saw there is a lot of performance gain by turning the flag on,
but sadly the best performance it can offer still cannot beat R itself. It
is interesting to see that C++ is worse than R in this special case despite
2013 Jan 26
2
[LLVMdev] Code compiling in gcc but not llvm
Hi,
This is my first post, sorry if not in the right format.
I am stuck at a place where I have a code fragment that runs in normal gcc
but fails when I give -fplugin=dragonegg.so
extern int *testfunc();
extern __typeof (testfunc) testfunc __asm__ ("" "__GI_testfunc")
__attribute__ ((visibility ("hidden")));
extern __typeof(testfunc) __testfunc;
extern __typeof
2012 Sep 21
2
Parallel Programming
I am trying to do parallel programming and I tried this
library(doSNOW)
library(foreach)
testfunc<-function(x){
x<-x+1
x
}
noc<-2
cl <- makeCluster(do.call(rbind,rep(list("localhost"),noc)), type = "SOCK")
registerDoSNOW(cl)
clusterExport(cl=cl,c("testfunc.r"))
testl<-foreach(pp=1:2) %dopar% {
testfunc(pp)
}
And this works but if I try to
2009 Aug 30
4
[LLVMdev] Perfect forwarding?
BLAST! LLVM mailing list headers are still royally screwed up...
My message is below...
On Sun, Aug 30, 2009 at 2:20 PM, Talin<viridia at gmail.com> wrote:
> Hey all, it's been a while since I have posted on this list, but I've
> been continuing my work with LLVM and getting lots done :)
>
> One question I wanted to ask is whether anyone had any advice on how to
>
2009 Sep 21
3
Basic function output/scope question
Hello Group,
I'm trying to learn R and am having a problem getting output from a
function I'm trying to write. The problem is clearly one of scope,
but I can't find the documentation that tells me how to get around the
issue.
Here is an example of my problem.
testfunc<-function(x)
{ y<-10
print(y)
print(x)
}
testfunc(4)
The variables x and y are accessible during execution
2009 Aug 05
0
[LLVMdev] Stack Management in LLVM
First off, thanks for the help so far.
>From what I have been able to tell, emitPrologue kicks in after the arguments
for the function have been copied. For example, consider the function
int testfunc( int foo, int bar );
Emitting assembly code from the llvm-gcc frontend in a small test program
gives the following for the call to testfunc
movl $1338, (%esp)
movl $1339, 4(%esp)
call
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod.
First, I define testFunc, which sorts a data frame by the first column and
returns the entries that aren't NAs, and testIt, which runs testFunc
repeatedly on a random large data frame, each time saving the return into a
dummy placeholder (for demonstration's sake).
> require(methods)
Loading required package: methods
[1] TRUE
> testFunc
2002 Aug 06
2
[ and setMethod conflict?
I noticed this oddity about [ and setMethod.
First, I define testFunc, which sorts a data frame by the first column and
returns the entries that aren't NAs, and testIt, which runs testFunc
repeatedly on a random large data frame, each time saving the return into a
dummy placeholder (for demonstration's sake).
> require(methods)
Loading required package: methods
[1] TRUE
> testFunc
2008 Nov 04
1
Help needed using 3rd party C library/functions from within R (Nvidia CUDA)
Hello,
I'm trying to combine the parallel computing power available through NVIDIA
CUDA (www.nvidia.com/cuda) from within R. CUDA is an extension to the C
language, so I thought it would be possible to do this.
If I have a C file with an empty function which includes a needed CUDA
library (cutil.h) and compile this to an .so file using a NVIDIA compiler
(nvcc), called 'myFunc.so' I
2017 Apr 05
2
Deopt operand bundle behavior
Hi!
We have started to use deopt operand bundle to make our native stacktrace deoptimizable and garbage collectable. We stumbled upon an issue and we don't know if it is really an issue on our side or really a problem within LLVM.
For example, for this input:
declare { i8*, i8* } @getCode()
define void @testFunc() {
entry:
%0 = call { i8*, i8* } @getCode()
%1 = extractvalue { i8*, i8* }
2009 Nov 23
2
categorisation of continuous variables in R
Dear all,
I'm looking for a function comparable to switch, to categorize a
continuous variable in a few levels. Off course that can be done with
a series of ifelse statements, but that looks rather clumsy. I looked
at switch, but couldn't figure out how to use it for this. I guess
that's not possible, as it only works with characters or integers, not
with intervals.
Basically,
2011 Jan 18
2
[LLVMdev] compiling a call to function in compiler
Hi,
I'm trying to follow the advice from this message:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-October/017574.html,
to create a call instruction from a function pointer. But I'm
getting...
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"),
function cast, file /usr/local/include/llvm/Support/Casting.h, line 202.
2008 Nov 10
6
Variable passed to function not used in function in select=... in subset
Hello!
I have the problem that in my function the passed variable is not used, but the variable name of the dataframe itself?- difficult to explain, but an easy example:
TestFunc<-function(df, group) {
??? print(names(subset(df, select=group)))
}
df1<-data.frame(group="G1", visit="V1", value=0.9)
TestFunc(df1, c("group", "visit"))
Result:
[1]
2008 Oct 31
1
Is there a way to vectorize this? [with correction]
** Sorry to repost. I forgot to include a function necessary to make
the example work **
I apologize up front for this being a little long. I hope it's
understandable. Please let me know if I need to clarify anything.
Several months ago I wrote a series of functions to help me take my R
analyses and build custom reports in html files. Each function either
builds or modifies a string of
2012 Jan 30
2
ode() tries to allocate an absurd amount of memory
Hi there R-helpers:
I'm having problems with the function ode() found in the package deSolve.
It seems that when my state variables are too numerous (>33000 elements),
the function throws the following error:
Error in vode(y, times, func, parms, ...) :
cannot allocate memory block of size 137438953456.0 Gb
In addition: Warning message:
In vode(y, times, func, parms, ...) : NAs
2011 Jan 18
0
[LLVMdev] compiling a call to function in compiler
On Jan 17, 2011, at 5:01 PM, Rob Nikander wrote:
> Hi,
>
> I'm trying to follow the advice from this message:
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-October/017574.html,
> to create a call instruction from a function pointer. But I'm
> getting...
>
> Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of
> incompatible
2011 Jan 18
1
[LLVMdev] compiling a call to function in compiler
On Mon, Jan 17, 2011 at 8:36 PM, Eric Christopher <echristo at apple.com> wrote:
>
> id testfunc(id a, id b) { ... }
> ...
> FunctionType *fn_type = FunctionType::get(id_type, argtypes, false);
> Value *fn = ConstantExpr::getIntToPtr(ConstantInt::get(int64_type,
> reinterpret_cast<int64_t>(testfunc)), fn_type);
> return builder.CreateCall2(fn,
2010 Oct 15
1
specify data frame by name
I'd like to be able to specify a data frame by name in a function call. Any
ideas how this can be done?
dfm <- data.frame(x=1:10)
testfunc <- function(data="dfm")
{
dat <- data
sum(dat$x)
}
print(testfunc())
--
View this message in context: http://r.789695.n4.nabble.com/specify-data-frame-by-name-tp2996534p2996534.html
Sent from the R help mailing list archive at
2004 Mar 10
1
Question concerning library function "nlme" and lexical scoping
I am running into problems calling the library function nlme from within
another function. Basically,the following function (with v a list
containing data and initialization values)
> testfunc
function(dat=v) {
test<-nlsList(result~a+(b-a)/(1+(conc/(c+z*cdiff))^d)
|rep,start=dat$init,data=dat$mixeddat)
return(nlme(test,random=b~1))
}
produces the error message
Error in eval(expr, envir,