[R-SIG-Mac] gfortran bug?

Berend Hasselman bhh at xs4all.nl
Tue Apr 27 19:34:20 CEST 2010


On 25-04-2010, at 22:22, Andreas Noack Jensen wrote:

...
> On Mac I quite randomly get very weird results from the subroutine. It is
> like the initial values explodes to fx 2e+290 even for identical calls
> without random number generation. Most results are identical to results I
> get from a pure R code but at some calls they explode in a non systematic
> fashion.
...

I have experimented with your stuff.
Find attached the R files needed to run my test.
Below is what I have done together with the R output.
As you can see the third column of the result matrix is weird.
This result is independent from setting the seed.
Some sort of initialisation issue?
Since I haven't got a clue what rmfilter does and my memory needs some refreshing wrt dgemm,
I can't pinpoint the problem.

Berend


I am (still)  using the gfortran from gfortran-4.2.3.dmg
------------------------------------------------------------------   
I made the rmfilter.so with

MAKEFLAGS="FCFLAGS=-O2" R CMD SHLIB rmfilter.f90

NB. had to do it since this gfortran doesn't accept the -mtune=core2 option!!
----------------------------------------------------------------------
sessionInfo()

R version 2.10.1 Patched (2010-04-07 r51689) 
x86_64-apple-darwin9.8.0 

locale:
[1] en_GB/en_GB/C/C/en_GB/en_GB

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

------------------------------------------------------------------
Mac OS X 10.6.3 Intel

------------------------------------------------------------------

I ran this test job


dyn.load('rmfilter.so')
source("rmfilter.R")   

set.seed(407)

eps <- matrix(rnorm(30), ncol = 3)
eps

z <-  rmfilter(eps, array(diag(3)*0.5, c(3,3,2)))
z


with this as output

> 
> dyn.load('rmfilter.so')
> source("rmfilter.R")   
> 
> set.seed(407)
> 
> eps <- matrix(rnorm(30), ncol = 3)
> eps
              [,1]       [,2]       [,3]
 [1,]  0.841081288  1.7100891  0.9161884
 [2,]  1.072881139  1.1351244 -0.4314795
 [3,] -0.543593265 -1.0828613 -0.6333517
 [4,]  0.441951763 -1.0539372 -1.8468529
 [5,]  0.004920633 -0.9635668  0.6060301
 [6,] -0.731256023  0.4951620 -1.9168646
 [7,] -1.216400546 -1.5097126  1.1407077
 [8,] -0.210674189 -1.1110270 -0.3563495
 [9,] -0.378021236 -1.5624664 -2.5094364
[10,] -0.939183015 -0.2886860  2.1596868
> 
> z <-  rmfilter(eps, array(diag(3)*0.5, c(3,3,2)))
> z
            [,1]       [,2]          [,3]
 [1,]  0.8410813  1.7100891 1.018209e+277
 [2,]  1.4934218  1.9901689 1.018209e+277
 [3,]  0.6236583  0.7672677 1.018209e+277
 [4,]  1.5004918  0.3247811 1.018209e+277
 [5,]  1.0669957 -0.4175424 1.018209e+277
 [6,]  0.5524877  0.4487814 1.018209e+277
 [7,] -0.4066589 -1.4940931 1.018209e+277
 [8,] -0.1377598 -1.6336829 1.018209e+277
 [9,] -0.6502306 -3.1263543 1.018209e+277
[10,] -1.3331782 -2.6687046 1.018209e+277
attr(,"tsp")
[1]  1 10  1




-------------- next part --------------
A non-text attachment was scrubbed...
Name: rmfilter.R
Type: application/octet-stream
Size: 878 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20100427/152ffbdd/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test1.R
Type: application/octet-stream
Size: 157 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20100427/152ffbdd/attachment-0001.obj>


More information about the R-SIG-Mac mailing list