Skip to content

[R-pkg-devel] Bug? Makevars ignores FC=mpif90

4 messages · Ignacio Martinez, Peter Dalgaard

#
Hi,

I'm learning to develop R packages that use Fortran (and MPI). I recently
asked a question on stack-overflow and I was told to contact this list with
a followup question.

When I add to src/Makevars the follwoing line

FC=mpif90

Rstudio ignores it when I click `Build and Reload`.  But, if I create a
Makevars file in a .R/ directory in my$HOME directory with that line,
Rstudio uses mpif90.

Is the fact that R is ignoring the src/Makevars a bug? If not, am I doing
something wrong?

Thanks,

Ignacio


PS: I hope this is the right place to ask this question.
#
Ask differently: Does it say anywhere that the build process should use src/Makevars? 

Also notice that an important part of the package concept is that packages can be distributed. The recipient's Fortran compiler is not necessarily "mpif90". So, generally speaking, build configuration belongs in the build environment, not in the package.

-pd

  
    
#
Thanks peter.

1. Does it say anywhere that the build process should use src/Makevars?
I'm not sure, where should it say that? I'm using the default options in
Rstudio to create a package

2. Also notice that an important part of the package concept is that
packages can be distributed.
The package that i want to build uses MPI. Is that a problem? My
understanding is that in order to use MPI i have to set FC to mpif90. Is
that wrong?

3. build configuration belongs in the build environment
I'm not sure if I follow. What is the correct way of telling Rstudio that
the package i'm building uses MPI?

Thanks again!

PS: This is the link
<http://stackoverflow.com/questions/31924487/tell-rstudio-to-use-mpif90-instead-of-gfortran>to
my question in stack-overflow
On Mon, Aug 10, 2015 at 1:41 PM peter dalgaard <pdalgd at gmail.com> wrote:

            

  
  
#
It actually is discussed in Writing R Extensions. (I was half-expecting it not to be there.)  But you should read it very carefully, in particular the sections about which variables you want to set in it, and which ones you do not.

In very concrete terms, notice that src/Makevars is read _before_ $RHOME/etc/Makeconf. The latter sets FC, so overwrites whatever it was set to in src/Makevars.
It's wrong (or at least not right) to set it in the package sources, because someone else might have to set FC differently.
Wouldn't know. You already know how to do it by settings in a personal Makevars file. It is not obvious that there is a general way of specifying that one needs to use a special kind of compiler.

-pd