R + OpenMP

October 21, 2009

The following patch is corresponding to ROMP‘s Google code web site file:


16c16
  `type`  function `name`(`arg.str`)
48c48
  `type` function `name`(`arg.str`)
78c78
  function `name`()
99c99
  integer function ifelse(cond,x,y)
132c132
 # system("gfortran -dynamiclib -O3 main.f90 -o main.so")
134c134
  system("gfortran -fopenmp -lpthread -shared -O3 main.f90 -o main.so -fPIC")
157c157
 NTHREADS=2

The result is amazing:

> source("/home/gongyi/Desktop/romp/Romp_01a.R")
[1] "times for pureR"
   user  system elapsed 
  3.584   0.268   3.905 
[1] "times for Romp"
   user  system elapsed 
  0.060   0.004   0.051 

Leave a comment