[R-sig-hpc] request help with replication and snowFT
Hana Sevcikova
hanas at uw.edu
Sat Jul 23 01:58:35 CEST 2011
Paul,
You need to pass the 'gentype' argument into clusterApplyFT, i.e.
res<-clusterApplyFT(cl,rep(5,10), rnorm, gentype = "RNGstream")
This is because clusterApplyFT has a different default generator than
clusterSetupRNG.FT (I should change that). I guess it wasn't a big deal
because these are meant to be internal functions used through the
performParallel wrapper.
Hana
On 7/22/11 3:15 PM, Paul Johnson wrote:
> Hi, everybody.
>
> I finally got back to my hpc work and want to use the snowFT framework
> to replicate random number streams. In my test applications, I'm
> failing utterly.
>
> Here is example code from the snowFT manual, the only difference is
> that we are on OpenMPI. Run the same commands twice. I believe they
> should give the same numbers, but they don't.
>
> cl<- makeClusterFT(3, type="MPI")
> r<-10
> clusterSetupRNG.FT(cl, streamper="replicate",n=r, seed=rep(1,6))
> res<-clusterApplyFT(cl,rep(5,10),rnorm)
> stopCluster(res[[2]])
> print(res[[1]])
>
> cl<- makeClusterFT(3, type="MPI")
> r<-10
> clusterSetupRNG.FT(cl, streamper="replicate",n=r, seed=rep(1,6))
> res<-clusterApplyFT(cl,rep(5,10),rnorm)
> stopCluster(res[[2]])
> print(res[[1]])
>
>
> Here's the output.
>
>> library(snowFT)
>>
>>
>> cl<- makeClusterFT(3, type="MPI")
> 3 slaves are spawned successfully. 0 failed.
>> r<-10
>> clusterSetupRNG.FT(cl, streamper="replicate",n=r, seed=rep(1,6))
> [1] "RNGstream" "replicate"
>> res<-clusterApplyFT(cl,rep(5,10),rnorm)
>> stopCluster(res[[2]])
> [1] 1
>> print(res[[1]])
> [[1]]
> [1] -0.1456025 1.3072949 -1.0957783 0.6168508 0.6448932
>
> [[2]]
> [1] 1.63010246 -0.23033278 -0.91349106 -0.03618282 3.30093452
>
> [[3]]
> [1] 0.3667690 -0.3776691 -2.1429295 -1.0149990 -0.1546822
>
> [[4]]
> [1] -0.2193551 1.9246829 -0.1609943 -0.2835361 1.5796259
>
> [[5]]
> [1] -0.2151461 1.8466480 -0.8347105 -0.1572832 1.1244531
>
> [[6]]
> [1] -1.0051997 1.8332684 -1.0159134 -0.2503565 -1.0492845
>
> [[7]]
> [1] -0.7926305 0.9066504 -0.5414232 -0.8936676 -0.4695451
>
> [[8]]
> [1] -0.01403189 0.94844300 -1.55585713 -0.64284893 -0.96375069
>
> [[9]]
> [1] -1.5221444 0.3433271 -0.6120788 1.3496397 0.8353766
>
> [[10]]
> [1] 0.73350122 0.07025138 0.44000765 -0.32853919 -2.00299434
>
>> cl<- makeClusterFT(3, type="MPI")
> 3 slaves are spawned successfully. 0 failed.
>> r<-10
>> clusterSetupRNG.FT(cl, streamper="replicate",n=r, seed=rep(1,6))
> [1] "RNGstream" "replicate"
>> res<-clusterApplyFT(cl,rep(5,10),rnorm)
>> stopCluster(res[[2]])
> [1] 1
>> print(res[[1]])
> [[1]]
> [1] -0.8417970 0.2168521 -0.6801217 -1.1004275 1.9878556
>
> [[2]]
> [1] 0.05736959 -0.02219014 -0.24350810 -0.67493732 1.12872995
>
> [[3]]
> [1] 2.1888386 -0.6185255 0.6155721 -0.9960713 -0.3225214
>
> [[4]]
> [1] 0.2889124 -0.7812625 0.6137595 -0.4277711 -0.9265217
>
> [[5]]
> [1] 1.1439147 -0.8985090 -0.7180237 -0.8555336 -0.7178986
>
> [[6]]
> [1] 0.7085318 -0.9131429 0.8304874 0.9064519 -0.4819298
>
> [[7]]
> [1] 0.89758192 0.69964093 0.65992814 1.04772400 0.04638749
>
> [[8]]
> [1] 0.5077768 2.6082531 -0.4321813 -0.6506362 0.1527894
>
> [[9]]
> [1] -1.1617166 0.9932200 -1.1405765 0.9429077 -0.8969591
>
> [[10]]
> [1] -1.0571084 1.2550529 0.2394692 -1.1023199 -0.4573881
>
> In the cluster nodes, we have R 2.13.0 and OpenMPI version 1.4.1
>
>
More information about the R-sig-hpc
mailing list