Displaying 20 results from an estimated 400 matches similar to: "How to safely using OpenMP pragma inside a .C() function?"
2003 Dec 30
1
Accuracy: Correct sums in rowSums(), colSums() (PR#6196)
Full_Name: Nick Efthymiou
Version: R1.5.0 and above
OS: Red Hat Linux
Submission from: (NULL) (162.93.14.73)
With the introduction of the functions rowSums(), colSums(), rowMeans() and
colMeans() in R1.5.0, function "SEXP do_colsum(SEXP call, SEXP op, SEXP args,
SEXP rho)" was added to perform the fast summations. We have an excellent
opportunity to improve the accuracy by
2015 Dec 02
2
clang only spawns one thread
Hi,
I am using LLVM 3.6.1 to test the following code:
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
int tid, nthreads;
#pragma omp parallel sections private(nthreads, tid)
{
#pragma omp section
{
tid = omp_get_thread_num();
printf("Hello, tid = %d\n ", tid);
}
#pragma omp section
{
tid = omp_get_thread_num();
2023 May 06
1
Change DEFAULTDEPARSE to DEFAULTDEPARSE | SHOWATTRIBUTES ?
The deparse options used by default by 'deparse' and 'dput' are
c("keepNA", "keepInteger", "niceNames", "showAttributes")
but Defn.h still has
#define DEFAULTDEPARSE 1089 /* KEEPINTEGER | KEEPNA | NICE_NAMES, used for
calls */
i.e., with the SHOWATTRIBUTES bit turned off. Is that on purpose?
Note that this leads to weird
2013 May 24
0
Rcpp with OpenMP - Need example Makevars
Dear R experts,
recently I started developing a Rcpp package "OpenMPTest".
Within that package I want to use OpenMP, as in the following code example:
// header file
#include <omp.h>
using namespace Rcpp ;
RcppExport SEXP testOpenMP( SEXP nThreads ) ;
// cpp file
SEXP testOpenMP( SEXP nThreads ) {
BEGIN_RCPP
NumericVector numberThreads = NumericVector( nThreads );
2019 Feb 02
1
Set the number of threads using openmp with .Fortran?
I got this to work on Linux but it is not working on Windows. *My
understanding is that this should also work on windows, is that correct?*
If so, what should I do? differently?
To get it to work on Linux, I modified my R script as follows:
#' OpenMP Hello World
#'
#' @param nthreads The number of threads that you want to use
#' @example
#' hello(nthreads=2)
#' @export
2007 Oct 08
16
Fileserver performance tests
Hi all,
i want to replace a bunch of Apple Xserves with Xraids and HFS+ (brr) by Sun x4200 with SAS-Jbods and ZFS. The application will be the Helios UB+ fileserver suite.
I installed the latest Solaris 10 on a x4200 with 8gig of ram and two Sun SAS controllers, attached two sas-jbods with 8 SATA-HDDs each und created a zfs pool as a raid 10 by doing something like the following:
[i]zpool create
2019 Feb 01
2
Set the number of threads using openmp with .Fortran?
Hi everybody,
I'm trying to develop an R package with Fortran and OpenMP. I wrote a
simple hello world but I'm not able to set the number of threads. I found this
old email chain
<http://r.789695.n4.nabble.com/Set-the-number-of-threads-using-openmp-with-C-td2284685.html>
and
I tried to set my compile instructions accordingly but i had no luck.
*This is my makevars:*
2002 Aug 07
1
Change in NA_REAL behavior (PR#1886)
Full_Name: David Larsen
Version: 1.5.1
OS: Redhat 7.2, w98, w2000
Submission from: (NULL) (128.206.66.65)
I have c code that produces vector sequences for plotting. I use NA_REAL to
create an NA that will pass back to R to break the line. This code worked fine
upto R-1.5.0 It continues to work on Redhat7.2 Linux but on both windows98 and
windows2000 the NA_REAL returns -6.623485e-229 on both
2010 Jul 10
1
Set the number of threads using openmp with .C
Hi everybody! Could somebody help me with the following?
I'm trying to run a simple Hello World code in openmp using .C function. The
C code i have is:
#include <omp.h>
#include <stdio.h>
#include <R.h>
void hello_omp(int *n) {
int th_id, nthreads;
omp_set_num_threads(*n);
#pragma omp parallel private(th_id)
{
th_id = omp_get_thread_num();
2015 Apr 27
1
Development version of R: Improved nchar(), nzchar() but changed API
Dear Martin,
Does the work on nchar mean that bugs #16090 and #16091 will be resolved
[1,2]?
Thanks,
Mark
[1] https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16090
[2] https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16091
On Sat, Apr 25, 2015 at 11:06 PM, James Cloos <cloos at jhcloos.com> wrote:
> >>>>> "GC" == G?bor Cs?rdi <csardi.gabor at
2001 Nov 05
1
Setting NA from C code
In the maps library, NA's are inserted between polygons so lines() can
be used to draw all polygons at once. The code to do it is like this:
*x++ = NA_REAL;
*y++ = NA_REAL;
where x and y are declared as
double *x, *y, *range;
and are the arguments passed in through a .C call.
However, the values show up in R as -6.62314033633867e-229 instead of
NA, so the
2011 Sep 20
2
Is it possible to pass a function argument from R to compiled code in C?
I have a function in R that takes another function as argument:
f <- function(g, ...) { #g is expected to be a function
}
I want to see if there is a way to implement "f" in C and calling it from R
using ".C" interface. I know that I can use function pointers for my C
implementation, but I imagine it's going to be nearly impossible to pass a
function from R to C. Are
2000 Jun 19
2
dyn.load error:
Hi,
I have some S functions plus Fortran routines that I want to use in R.
They work in S, but when I try to use "dyn.load" to link fortran codes in
R , I get the following error.
thanks, reza
(I am using R-1.0.1 on windows NT, The name of fortran file (compiled
Ratfor) is deldirld.o and it's in the D:\Reza\476\tv.gonsrc.R\ directory)
>dyn.load("deldirld.o")
Error in
2011 Jul 13
1
Performance of .C and .Call functions vs. native R code
Hello,
I am in the process of writing an R extension for parallelized MCMC, with
heavy use of compiled code (C++). I have been getting my feet wet by
implementing a simple matrix-vector multiplication function in C++ (which
calls a BLAS level 2 function dgemv), and comparing it to the '%*%' operator
in R (which apparently calls a BLAS level 3 function dgemm).
Interestingly, I cannot
2012 Jul 27
2
Assigning a new name to object loaded with "load()"
I would like to load a binary file into R using load(), and then assign a new
name to it, regardless of the name it was saved under. Can you please
provide a code sample? Thank you!
--
View this message in context: http://r.789695.n4.nabble.com/Assigning-a-new-name-to-object-loaded-with-load-tp4638144.html
Sent from the R help mailing list archive at Nabble.com.
2011 Jul 22
2
Best practices for writing R functions
I am developing an R package for internal use, and eventually for public
release. My understanding is that there is no easy way to avoid copying
function arguments in R (i.e. we don't have the concept of pointers in R),
which makes me wary of freely creating chains of function calls since each
function call implies data copy overhead.
Is the above assessment fair? Are there any good write-ups
2014 Feb 10
1
Question re: NA, NaNs in R
Hi R-devel,
I have a question about the differentiation between NA and NaN values
as implemented in R. In arithmetic.c, we have
int R_IsNA(double x)
{
if (isnan(x)) {
ieee_double y;
y.value = x;
return (y.word[lw] == 1954);
}
return 0;
}
ieee_double is just used for type punning so we can check the final
bits and see if they're equal to 1954; if they are, x is NA, if
they're
2010 Jan 22
2
Optimizing C code
Hi the list,
I need to write some efficient distances function, so I read the code
for the Euclidean distance.
I do not understand the purpose of the line 11 : if x[i] and y[i] are
not NA (line 9), can dev be NA ?
Christophe
#define both_FINITE(a,b) (R_FINITE(a) && R_FINITE(b))
#define both_non_NA(a,b) (!ISNAN(a) && !ISNAN(b))
1. static double R_euclidean2(double *x, double
2013 Dec 16
1
External pointers and changing SEXPTYPE
Dear Developers,
I've been struggling through writing R extension in C. I've been using
an external pointer to store my data (please see sample below). I
encountered a very weird erroneous behaviour: when I tried to use my
external pointer to a structure holding several types of data,
including SEXPs, I discovered that SEXPs change their types between
returning from initialization
2019 Dec 09
3
Inconsistent behavior for the C AP's R_ParseVector() ?
Le lun. 9 d?c. 2019 ? 05:43, Tomas Kalibera <tomas.kalibera at gmail.com> a
?crit :
> On 12/7/19 10:32 PM, Laurent Gautier wrote:
>
> Thanks for the quick response Tomas.
>
> The same error is indeed happening when trying to have a zero-length
> variable name in an environment. The surprising bit is then "why is this
> happening during parsing" (that is why