Dear,
When trying to use directive OpenMP in my code, I observed that the directive ones were being considered as commentaries.
Compiling with command R CMD SHLIB xxx.f95 - fopenmp and calling the function in the R verified that threads was not being considered.
I was to observe the options of the compiler
R CMD SHLIB --help
Usage: R CMD SHLIB [options] files | linker options
Build a shared library for dynamic loading from the specified source or
object files (which are automagically made from their sources) or
linker options.? If not given via '--output', the name for the shared
library is determined from the first source or object file.
Options:
? -h, --help??? ??? print short help message and exit
? -v, --version??? ??? print version info and exit
? -o, --output=LIB??? use LIB as (full) name for the built library
? -c, --clean??? ??? remove files created during compilation
? --preclean??? ??? remove files created during a previous run
? -n, --dry-run??? ??? dry run, showing commands that would be used
Windows only:
? -d, --debug??? ??? build a debug DLL
How can I enable -fopenmp for use with R CMD SHLIB?
? ???????????? F?bio Mathias Corr?a
Estat?stica e Experimenta??o Agropecu?ria/UFLA
____________________________________________________________________________________
Veja quais s?o os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
Changing options in R CMD SHLIB
5 messages · Fabio Mathias Corrêa, Brian Ripley
Please see the manual -- 'Writing R Extensions'. If you want to use custom compiler flags, you use a Makevars or personal .Makevars file. Something like PKG_FCFLAGS=-fopenmp (you haven't told us your OS or version of R).
On Mon, 19 Oct 2009, Fabio Mathias Corr?a wrote:
Dear, When trying to use directive OpenMP in my code, I observed that the directive ones were being considered as commentaries. Compiling with command R CMD SHLIB xxx.f95 - fopenmp and calling the function in the R verified that threads was not being considered. I was to observe the options of the compiler R CMD SHLIB --help Usage: R CMD SHLIB [options] files | linker options Build a shared library for dynamic loading from the specified source or object files (which are automagically made from their sources) or linker options.? If not given via '--output', the name for the shared library is determined from the first source or object file. Options: ? -h, --help??? ??? print short help message and exit ? -v, --version??? ??? print version info and exit ? -o, --output=LIB??? use LIB as (full) name for the built library ? -c, --clean??? ??? remove files created during compilation ? --preclean??? ??? remove files created during a previous run ? -n, --dry-run??? ??? dry run, showing commands that would be used Windows only: ? -d, --debug??? ??? build a debug DLL How can I enable -fopenmp for use with R CMD SHLIB? ? ???????????? F?bio Mathias Corr?a Estat?stica e Experimenta??o Agropecu?ria/UFLA
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
I use linux Mint and R.2.9.2 Thank you! ? ???????????? F?bio Mathias Corr?a Estat?stica e Experimenta??o Agropecu?ria/UFLA --- Em ter, 20/10/09, Prof Brian Ripley <ripley at stats.ox.ac.uk> escreveu:
De: Prof Brian Ripley <ripley at stats.ox.ac.uk> Assunto: Re: [Rd] Changing options in R CMD SHLIB Para: "Fabio Mathias Corr?a" <fabio.ufla at yahoo.com.br> Cc: r-devel at r-project.org Data: Ter?a-feira, 20 de Outubro de 2009, 5:08 Please see the manual -- 'Writing R Extensions'.? If you want to use custom compiler flags, you use a Makevars or personal .Makevars file. Something like PKG_FCFLAGS=-fopenmp (you haven't told us your OS or version of R). On Mon, 19 Oct 2009, Fabio Mathias Corr?a wrote:
Dear, When trying to use directive OpenMP in my code, I
observed that the directive ones were being considered as commentaries.
Compiling with command R CMD SHLIB xxx.f95 - fopenmp
and calling the function in the R verified that threads was not being considered.
I was to observe the options of the compiler R CMD SHLIB --help Usage: R CMD SHLIB [options] files | linker options Build a shared library for dynamic loading from the
specified source or
object files (which are automagically made from their
sources) or
linker options.? If not given via '--output', the
name for the shared
library is determined from the first source or object
file.
Options: ? -h, --help??? ??? print short help message
and exit
? -v, --version??? ??? print version info and
exit
? -o, --output=LIB??? use LIB as (full) name for
the built library
? -c, --clean??? ??? remove files created
during compilation
? --preclean??? ??? remove files created during
a previous run
? -n, --dry-run??? ??? dry run, showing
commands that would be used
Windows only: ? -d, --debug??? ??? build a debug DLL How can I enable -fopenmp for use with R CMD SHLIB? ? ???????????? F?bio Mathias Corr?a Estat?stica e Experimenta??o Agropecu?ria/UFLA
-- Brian D. Ripley,? ? ? ? ? ? ? ? ? ripley at stats.ox.ac.uk Professor of Applied Statistics,? http://www.stats.ox.ac.uk/~ripley/ University of Oxford,? ? ? ? ? ???Tel:? +44 1865 272861 (self) 1 South Parks Road,? ? ? ? ? ? ? ? ? ???+44 1865 272866 (PA) Oxford OX1 3TG, UK? ? ? ? ? ? ? ? Fax:? +44 1865 272595
____________________________________________________________________________________ Veja quais s?o os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com
Dear,
I managed to use directives OpenMP in R.
To compile I used the gfortran directly. For example:
gfortran-shared-O2 teste.f90-fopenmp-fPIC
By using the code in R, it works perfectly!
However, I need to use some specific libraries of R, for use in C functions in Fortran 95.
When compiling using the command:
gfortran-shared-O2-o teste.f90 myrandom.c func.out -fopenmp -fPIC
However, I need to indicate the path for the compiler to use the files of the type: Rmath.h, R.h and others.
I observed the project ROMP and the library Rcsdp. The developers of the library Rcsdp in the installation file present the following modification in the compiler for enable the OpenMP.
CFLAGS=CFLAGS=-O3 -march=nocona -m64 -fprefetch-loop-arrays -ftree-vectorize -ftree-vectorizer-verbose=1 -fopenmp -ansi -Wall -DNOSHORTS -DBIT64 -DUSEOPENMP -I../include
LIBS=LIBS=-static -L../lib -lsdp -llapack -lptf77blas -lptcblas -latlas -lgomp -lrt -lpthread -lgfortran -lm
I already tried
~/Fortran/parallel/tri $ export PKG_FCFLAGS= -fopenmp
bash: export: `-fopenmp': not a valid identifier
I could indicate the path of the files R.h, Rmath.h and other to the gfortran? How?
Thank you!
? ???????????? F?bio Mathias Corr?a
Estat?stica e Experimenta??o Agropecu?ria/UFLA
____________________________________________________________________________________
Veja quais s?o os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com
Thank you very much!!! Problem solved!! I use export PKG_FCFLAGS=-fopenmp
dyn.load("teste.so")
system.time(abc3 <- .Fortran("mxv", as.integer(m), as.integer(n), as.double(a), b, as.double(c)))
In parallel region - Thread ID 1
In parallel region - Thread ID 1
In parallel region - Thread ID 1
In parallel region - Thread ID 1
In parallel region - Thread ID 1
In parallel region - Thread ID 0
In parallel region - Thread ID 0
In parallel region - Thread ID 0
In parallel region - Thread ID 0
In parallel region - Thread ID 0
user system elapsed
0 0 0
? ???????????? F?bio Mathias Corr?a
Estat?stica e Experimenta??o Agropecu?ria/UFLA
--- Em ter, 20/10/09, Prof Brian Ripley <ripley at stats.ox.ac.uk> escreveu:
De: Prof Brian Ripley <ripley at stats.ox.ac.uk> Assunto: Re: [Rd] Changing options in R CMD SHLIB Para: "Fabio Mathias Corr?a" <fabio.ufla at yahoo.com.br> Cc: r-devel at r-project.org Data: Ter?a-feira, 20 de Outubro de 2009, 5:08 Please see the manual -- 'Writing R Extensions'.? If you want to use custom compiler flags, you use a Makevars or personal .Makevars file. Something like PKG_FCFLAGS=-fopenmp (you haven't told us your OS or version of R). On Mon, 19 Oct 2009, Fabio Mathias Corr?a wrote:
Dear, When trying to use directive OpenMP in my code, I
observed that the directive ones were being considered as commentaries.
Compiling with command R CMD SHLIB xxx.f95 - fopenmp
and calling the function in the R verified that threads was not being considered.
I was to observe the options of the compiler R CMD SHLIB --help Usage: R CMD SHLIB [options] files | linker options Build a shared library for dynamic loading from the
specified source or
object files (which are automagically made from their
sources) or
linker options.? If not given via '--output', the
name for the shared
library is determined from the first source or object
file.
Options: ? -h, --help??? ??? print short help message
and exit
? -v, --version??? ??? print version info and
exit
? -o, --output=LIB??? use LIB as (full) name for
the built library
? -c, --clean??? ??? remove files created
during compilation
? --preclean??? ??? remove files created during
a previous run
? -n, --dry-run??? ??? dry run, showing
commands that would be used
Windows only: ? -d, --debug??? ??? build a debug DLL How can I enable -fopenmp for use with R CMD SHLIB? ? ???????????? F?bio Mathias Corr?a Estat?stica e Experimenta??o Agropecu?ria/UFLA
-- Brian D. Ripley,? ? ? ? ? ? ? ? ? ripley at stats.ox.ac.uk Professor of Applied Statistics,? http://www.stats.ox.ac.uk/~ripley/ University of Oxford,? ? ? ? ? ???Tel:? +44 1865 272861 (self) 1 South Parks Road,? ? ? ? ? ? ? ? ? ???+44 1865 272866 (PA) Oxford OX1 3TG, UK? ? ? ? ? ? ? ? Fax:? +44 1865 272595
____________________________________________________________________________________ Veja quais s?o os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.yahoo.com