library(clrng)
if (detectGPUs() >= 1) {
setBaseCreator(rep(12345,6))
setContext(grep("gpu", listContexts()$device_type)[1])
myStreamsGpu = createStreamsGpu(4)
t(as.matrix(myStreamsGpu))
myStreamsGpu2 = createStreamsGpu(6)
t(as.matrix(myStreamsGpu2)) }else {
message("No GPU context available")
}
Run the code above in your browser using DataLab