Re: [Rd] Question about writing portable packages

2013-06-08 Thread Gray

Kevin Ushey: (12:10AM on Fri, Jun 07)

I think the key word here is _other_ packages. It's entirely okay to call
your package's own compiled code through the .Call interface (and the code
you write may link to other packages; the obvious example being Rcpp code
you write); however, it is not portable to use .Call to call compiled code
from another package directly. This is because package authors are not
required to maintain a consistent .Call interface to their compiled code;
rather, they just have to make sure the direct user-facing R exported
functions retain a stable interface over different versions (or, if
changed, are done so with prior warning etc.)


Also remember that, as long as you obey all of the licenses, you can
simply copy the source code that needs to be compiled into your own
package.  You'll obviously need to track development of the other
package (which you'll need to do anyway) but then you can be sure that
the calls you want to use work.

--
Gray Calhoun, Assistant Professor of Economics at Iowa State 
http://gray.clhn.co (web)


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Compile error gfortran-4.6

2013-06-08 Thread Fabio Mathias Corrêa
Dears,

I am writing a code in Fortran using OpenMP directives.

When compiling the code in gfortran 4.4 does not occur any problem.

When compiling the code in gfortran 4.6, an error message appears.

In other compilers the error does not occur.


A small example.


## Code in Fortran

       subroutine hello()
       implicit none
       integer :: nthreads, tid
       integer :: omp_get_num_threads, omp_get_thread_num
       integer :: omp_get_max_threads, omp_set_num_threads

       print *, 'Máximo de threads', omp_get_max_threads()

       !$omp parallel 
       tid = omp_get_thread_num()
       print *, 'Hello World from thread = ', tid
       print *, 'Number of threads =', omp_get_thread_num()
       !$omp end parallel
       end subroutine hello


### Compiling and testing

system(R CMD COMPILE hello.f90 FCFLAGS=-fopenmp)
system(R CMD SHLIB hello.o)

dyn.load(hello.so)

.Fortran(hello)

### Error message

/home/fmcron/Documentos/Fortran/OpenMP/exemplos/hello.so: undefined symbol: 
_gfortran_transfer_character_write



Thanks

 
        Fábio Mathias Corrêa


   Universidade Estadual de Santa Cruz
Departamento de Ciências Exatas e da Terra - DCET


Campus Soane Nazaré de Andrade, km 16 Rodovia Ilhéus-Itabuna
CEP 45662-900. Ilhéus-Bahia


Tel.: 73-3680-5076
[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Compile error with gfortran-4.6

2013-06-08 Thread Fabio Mathias Corrêa
Dears,

I am writing a code in Fortran using OpenMP directives.

When compiling the code in gfortran 4.4 does not occur any problem.

When compiling the code in gfortran 4.6, an error message appears.

In other compilers the error does not occur.


A small example.


## Code in Fortran

       subroutine hello()
       implicit none
       integer :: nthreads, tid
       integer :: omp_get_num_threads, omp_get_thread_num
       integer :: omp_get_max_threads, omp_set_num_threads

       print *, 'Máximo de threads', omp_get_max_threads()

       !$omp parallel 
       tid = omp_get_thread_num()
       print *, 'Hello World from thread = ', tid
       print *, 'Number of threads =', omp_get_thread_num()
       !$omp end parallel
       end subroutine hello


### Compiling and testing

system(R CMD COMPILE hello.f90 FCFLAGS=-fopenmp)
system(R CMD SHLIB hello.o)

dyn.load(hello.so)

.Fortran(hello)

### Error message

/home/fmcron/Documentos/Fortran/OpenMP/exemplos/hello.so: undefined symbol: 
_gfortran_transfer_character_write



Thanks

 
        Fábio Mathias Corrêa


   Universidade Estadual de Santa Cruz
Departamento de Ciências Exatas e da Terra - DCET


Campus Soane Nazaré de Andrade, km 16 Rodovia Ilhéus-Itabuna
CEP 45662-900. Ilhéus-Bahia
[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Compile error with gfortran-4.6

2013-06-08 Thread Prof Brian Ripley
This is not gfortran-help, but note that you are not doing this 
correctly.  See 'Writing R Extensions' §1.2.1.  The linking step needs a 
flag too.


Beyond that, you failed to tell us your OS, and in fact there are no 
such versions of gfortran (4.6.0 != 4.6).  The posting guide does ask 
you to be accurate in your version numbers (and not to send HTML).


On 08/06/2013 14:43, Fabio Mathias Corrêa wrote:

Dears,

I am writing a code in Fortran using OpenMP directives.

When compiling the code in gfortran 4.4 does not occur any problem.

When compiling the code in gfortran 4.6, an error message appears.

In other compilers the error does not occur.


A small example.


## Code in Fortran


You declare this to be Fortran 90.


subroutine hello()
implicit none
integer :: nthreads, tid
integer :: omp_get_num_threads, omp_get_thread_num
integer :: omp_get_max_threads, omp_set_num_threads

print *, 'Máximo de threads', omp_get_max_threads()

!$omp parallel
tid = omp_get_thread_num()
print *, 'Hello World from thread = ', tid
print *, 'Number of threads =', omp_get_thread_num()
!$omp end parallel
end subroutine hello


### Compiling and testing

system(R CMD COMPILE hello.f90 FCFLAGS=-fopenmp)
system(R CMD SHLIB hello.o)

dyn.load(hello.so)

.Fortran(hello)

### Error message

/home/fmcron/Documentos/Fortran/OpenMP/exemplos/hello.so: undefined symbol: 
_gfortran_transfer_character_write



Thanks


 Fábio Mathias Corrêa


Universidade Estadual de Santa Cruz
Departamento de Ciências Exatas e da Terra - DCET


Campus Soane Nazaré de Andrade, km 16 Rodovia Ilhéus-Itabuna
CEP 45662-900. Ilhéus-Bahia
[[alternative HTML version deleted]]



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel




--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Problem with gfortran-4.6

2013-06-08 Thread Fabio Mathias Corrêa
Dears,

I am writing a code in Fortran using OpenMP directives.

When compiling the code in gfortran 4.4 does not occur any problem.

When compiling the code in gfortran 4.6, an error message appears.

In other compilers the error does not occur.


A small example.


## Code in Fortran

       subroutine hello()
       implicit none
       integer :: nthreads, tid
       integer :: omp_get_num_threads, omp_get_thread_num
       integer :: omp_get_max_threads, omp_set_num_threads

       print *, 'Máximo de threads', omp_get_max_threads()

       !$omp parallel 
       tid = omp_get_thread_num()
       print *, 'Hello World from thread = ', tid
       print *, 'Number of threads =', omp_get_thread_num()
       !$omp end parallel
       end subroutine hello


### Compiling and testing

system(R CMD COMPILE hello.f90 FCFLAGS=-fopenmp)
system(R CMD SHLIB hello.o)

dyn.load(hello.so)

.Fortran(hello)

### Error message

/home/fmcron/Documentos/Fortran/OpenMP/exemplos/hello.so: undefined symbol: 
_gfortran_transfer_character_write



Thanks



        Fábio Mathias Corrêa


   Universidade Estadual de Santa Cruz
Departamento de Ciências Exatas e da Terra - DCET


Campus Soane Nazaré de Andrade, km 16 Rodovia Ilhéus-Itabuna
CEP 45662-900. Ilhéus-Bahia


Tel.: 73-3680-5076 

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] R CMD INSTALL and file permission settings

2013-06-08 Thread Dirk Eddelbuettel

Summary:   

  The directory /usr/local/lib/R/site-library can be used for site-wide
  multi-user installations of R.  

  This is even the default on Debian and Ubuntu (following a suggestion by
  Kurt and Fritz a decade ago over beers -- what could be better).  However,
  R enforces wrong permissions on directories and files there (removing
  group-write) which effectively defeats this purpose, and breaks multiuser
  installation:  if Tom, Dick and Harry are members of group 'r-users', each
  one can install in the directory, but neither can _upgrade_ a package
  installed by one of the others.  

  I would like to correct this.


Details:   

  For a while now, R CMD INSTALL dispatches installation work to the R
  function tools:::.install_packages() from the file tools/install.R. The
  function does a lot of hardcoded 'chmod' with constant arguments:

  edd@max:~/svn/r-devel/src/library/tools/R$ grep Sys.chmod install.R 
  if (!WINDOWS) Sys.chmod(file.path(dest, files), 755)
  Sys.chmod(file.path(instdir, f), 644)
  Sys.chmod(Sys.glob(file.path(instdir, data, *)), 644)
  Sys.chmod(Sys.glob(file.path(instdir, demo, *)), 644)
  Sys.chmod(Sys.glob(file.path(instdir, exec, *)), 
755)
  Sys.chmod(i2_files[execs], 755)
  edd@max:~/svn/r-devel/src/library/tools/R$ 

  Moreover, it also calls a C function for cleanup cleanup:

  edd@max:~/svn/r-devel/src/library/tools/R$ grep .Call(dir install.R 
  .Call(dirchmod, instdir)
  .Call(dirchmod, ss)
  .Call(dirchmod, ss)
  ## tree, since the later .Call(dirchmod) call will
  edd@max:~/svn/r-devel/src/library/tools/R$

  which also uses unconditional 644 / 755

  mode_t mask = S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR, /* 0644 */
  dirmask = mask | S_IXUSR | S_IXGRP | S_IXOTH; /* 0755 */


Proposal:

  Add a new option() [with a to-be-determined name] which, if enabled, turns
  on group-write modes for files and directories, ie 664 and 775.  

  One way would be to set two character vars at the beginning of
  _install_packages and to pass a flag to the dirchmod call as so that
  'S_IWGRP' (the 00020 write by group permission) can be set.

  I would be happy to write such a patch (including documentation updates) if
  someone from R Core can signal willigness to look at it.


Thanks,  Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] R CMD INSTALL and file permission settings

2013-06-08 Thread Andreas Leha
Hi all,

Dirk Eddelbuettel e...@debian.org writes:

 Summary:   

   The directory /usr/local/lib/R/site-library can be used for site-wide
   multi-user installations of R.  

   This is even the default on Debian and Ubuntu (following a suggestion by
   Kurt and Fritz a decade ago over beers -- what could be better).  However,
   R enforces wrong permissions on directories and files there (removing
   group-write) which effectively defeats this purpose, and breaks multiuser
   installation:  if Tom, Dick and Harry are members of group 'r-users', each
   one can install in the directory, but neither can _upgrade_ a package
   installed by one of the others.  

   I would like to correct this.


This is just a message from a user who would greatly appreciate such a
change.  We have written a script based on inotify to correct that group
writing permissions which we would gladly dismiss again.

Best,
Andreas

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel