On OS X using gcc-4.5 I have
deleeuw at cuddyvalley:~/Desktop/ > echo $CFLAGS
-m64 -O3 -fopenmp -mtune=native
deleeuw at cuddyvalley:~/Desktop/ > echo $LDFLAGS
-m64 -fopenmp
for all compilations, including the compilation of
the R-devel trunk. Then after R SHLIB tiny.c I get
> dyn.load("tiny.so")
> a<-.C("tiny")
number of threads is 2
number of threads is 2
I am thread 0
I am thread 1
===============================================================
Jan de Leeuw, 11667 Steinhoff Rd, Frazier Park, CA 93225
home 661-245-1725 mobile 661-231-5416 work 310-825-9550
.mac: jdeleeuw +++ aim: deleeuwjan +++ skype: j_deleeuw
===============================================================
I am I because my little dog knows me.
Gertrude Stein
OpenMP Problem
3 messages · Jan de Leeuw, Dirk Eddelbuettel, Norm Matloff
On 17 September 2009 at 07:39, Jan de Leeuw wrote:
| On OS X using gcc-4.5 I have
gcc 4.5? Wow, living on the edge! Just yesterday on r-devel, BDR just blamed
gcc-4.4 for bugginess...
| deleeuw at cuddyvalley:~/Desktop/ > echo $CFLAGS
| -m64 -O3 -fopenmp -mtune=native
| deleeuw at cuddyvalley:~/Desktop/ > echo $LDFLAGS
| -m64 -fopenmp
|
| for all compilations, including the compilation of
| the R-devel trunk. Then after R SHLIB tiny.c I get
|
| > dyn.load("tiny.so")
| > a<-.C("tiny")
| number of threads is 2
| number of threads is 2
| I am thread 0
| I am thread 1
For what it's worth I see the same on Debian testing using gcc 4.3.
edd at ron:~/src/progs/R/openMP> cat buildMe.sh
#!/bin/sh
MAKEFLAGS='SHLIB_CFLAGS=-fopenmp' R CMD SHLIB TinyR.c -fopenmp
edd at ron:~/src/progs/R/openMP> cat runMe.r
#!/usr/bin/r
dyn.load("TinyR.so")
a <- .C("tiny")
edd at ron:~/src/progs/R/openMP> ./runMe.r
number of threads is 2
I am thread 0
number of threads is 2
I am thread 1
edd at ron:~/src/progs/R/openMP>
Dirk
Three out of two people have difficulties with fractions.
Thanks to all who replied. The key was that the -fopenmp flag is more than just a linker option. Norm