Skip to content

Makevars.in - changing compiler

7 messages · George Ostrouchov, Davor Cubranic, Dirk Eddelbuettel

#
Is it possible to set a package compiler via Makevars.in? I need to 
substitute mpicc (an Open MPI wrapper compiler). My attempts just 
setting CC=mpicc in Makevars.in have failed.

Is Makevars just "included before the default `Makefile'" as it states 
in the "Writing R Extensions" manual or is there more to it?

Thanks,
George
#
On 7 December 2010 at 23:44, George Ostrouchov wrote:
| Is it possible to set a package compiler via Makevars.in? I need to 
| substitute mpicc (an Open MPI wrapper compiler). My attempts just 
| setting CC=mpicc in Makevars.in have failed.

For an R package? 

| Is Makevars just "included before the default `Makefile'" as it states 
| in the "Writing R Extensions" manual or is there more to it?

Here is what the current Rmpi has in src/Makefile.in:

  # -*- Makefile -*-  vim : ft = make

  PKG_CPPFLAGS = @DEFS@ @PKG_CPPFLAGS@
  PKG_CFLAGS   = $(ARCHCFLAGS)
  PKG_LIBS     = @PKG_LIBS@ $(ARCHLIB)

As you can see, it only sets arguments to the compiler, not the compiler
itself.

Rmpi is a pretty good package to study as Hao as been diligently working at
it for many years, and has it working for a great number of system and
compiler choices.  

Did that help? If not please rephrase the question.

Cheers, Dirk
#
Hi Dirk,

Here is some more detail that I should have included earlier. I am 
extending the ncdf4 package to include parallel I/O (already available 
in NetCDF4) so it needs Open MPI includes and libs. Just swapping the 
compiler to mpicc will take care of things. ncdf4 uses autoconf and the 
Makevars.in mechanism. Can the package compiler be specified this way?

Thanks,
George
On 12/7/10 11:52 PM, Dirk Eddelbuettel wrote:

  
    
#
After some more searching, I think the answer is no. But it probably 
also makes more sense to align the compiler with R and Rmpi rather than 
with NetCDF4 anyway. My initial thought was to use MPI information 
provided by nc-config of NetCDF4, and this was only mpicc.

So I will work through the PKG_* variables of Makevars to provide the 
MPI includes and libs like Hao does in Rmpi.

Cheers,
George
On 12/8/10 9:17 AM, George Ostrouchov wrote:

  
    
1 day later
#
You *can* modify the package compiler -- for example gputools switches 
to using nvcc CUDA compiler. But I'm pretty sure you'll need to use a 
custom Makefile.

Davor
On December 8, 2010 06:17:41 am George Ostrouchov wrote:
#
On 10 December 2010 at 09:35, Davor Cubranic wrote:
| You *can* modify the package compiler -- for example gputools switches 
| to using nvcc CUDA compiler. But I'm pretty sure you'll need to use a 
| custom Makefile.

Yes ... but as we're talking R here, consider the know downsides. 

With Makefiles you no longer get multiarch builds which have been the default
on the Mac for some time and are now the default on Windows (arguably via
Makefile.win).

If you can do with Makefile, do without a Makefile.   I'd use one for a local
package -- ie if George wanted something to work just at the lab.  For
redistribution, CRAN, ... it's better without one.   

Dirk
#
I agree completely, Dirk. I would definitely consider it only in special 
circumstances, like a custom optimization for a local install. But if it 
really needs to be done, it's possible... With some trade-offs. If you 
know what you're doing. :-)

Davor
On December 10, 2010 09:53:55 am Dirk Eddelbuettel wrote: