Hi Loris,

On 03/12/2019 16:04, Loris Bennett wrote:
Hi Alan,

Thanks for the hint.  However, this didn't work either, so in the end I
wimped out and just installed the R packages directly into the user's
home directory.   Since she is the only one to need the package, that's
fine for now.

Still it would be interesting to know whether your approach should have
worked, but didn't due to a bug, or whether the functionality does not
yet exist.

We had a similar question on the list recently, I think you need to use the --configure-args option for the installation command (R CMD INSTALL),
see https://lists.ugent.be/wws/arc/easybuild/2019-11/msg00014.html .


regards,

Kenneth


Cheers,

Loris

Alan O'Cais <[email protected]> writes:

I think in your case it would be enough to use
preinstallopts = 'export  PKG_CXXFLAGS="$CXXFLAGS -DSTAN_THREADS" &&'
(be warned though, I don't use R, this is just an mildly educated guess based 
on that issue you mentioned).

On Wed, 27 Nov 2019 at 14:17, Loris Bennett <[email protected]> wrote:

  Alan O'Cais <[email protected]> writes:

  > I took a quick look at  
https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-Makevars and it 
looks like you need to use  PKG_CXXFLAGS

  Yes, I just found a reference to PKG_CXXFLAGS here:

    https://github.com/easybuilders/easybuild-easyconfigs/issues/8930

  where the following construction is given:

    toolchainopts = {'cstd': 'c99'}
    preinstallopts = 'export PKG_CFLAGS="$CFLAGS" && '

  How would this look in my case?  Does the macro STAN_THREADS need to be
  set as a toolchain option?  If so, what is the correct dictionary key?

  Cheers,

  Loris

  > On Wed, 27 Nov 2019 at 13:41, Åke Sandgren <[email protected]> 
wrote:
  >
  >  Ahhh R package.... no I think that's a lot harder.
  >  Not sure how R packages are built so can't currently help there.
  >
  >  Anyway, you should use this way of changing things like buildopts
  >
  >  self.cfg.update('buildopts', "BIGNUMA=1 ")
  >
  >  And in pre_configure_hook you should only change opts related to
  >  configure step. build step opts should be done in pre_build_hook
  >
  >  On 11/27/19 1:29 PM, Loris Bennett wrote:
  >  > Åke Sandgren <[email protected]> writes:
  >  >
  >  >> What does your hooks look like?
  >  >
  >  >   def pre_configure_hook(self, *args, **kwargs):
  >  >
  >  >       """Pre-configure hook"""
  >  >
  >  >       # Build RStan with threading
  >  >       ##################################################
  >  >       if self.name == 'RStan':
  >  >           self.cfg['buildopts'] = self.cfg['buildopts'] \
  >  >               + 'CXX14FLAGS="$CXX14FLAGS -DSTAN_THREADS"'
  >  >           self.log.info("[pre-build hook] Added -DSTAN_THREADS to CXX14FLAGS 
to buildopts")
  >  >           return
  >  >
  >  >   def pre_extensions_hook(self, *args, **kwargs):
  >  >
  >  >       """Pre-extensions hook"""
  >  >
  >  >       # Build RStan with threading
  >  >       ##################################################
  >  >       if self.name == 'RStan':
  >  >           self.cfg['buildopts'] = self.cfg['buildopts'] \
  >  >               + 'CXX14FLAGS="$CXX14FLAGS -DSTAN_THREADS"'
  >  >           self.log.info("[pre-extensions hook] Added -DSTAN_THREADS to 
CXX14FLAGS to buildopts")
  >  >           return
  >  >
  >  > I have also tried this with CXXFLAGS.
  >  >
  >  > In my own copy of the EC I have tried various things:
  >  >
  >  >   #preconfigopts = "-DSTAN_THREADS"
  >  >   #buildopts = "-DSTAN_THREADS"
  >  >   #preconfigopts = 'CXXFLAGS="$CXXFLAGS -DSTAN_THREADS" '
  >  >   #buildopts = 'CXXFLAGS="$CXXFLAGS -DSTAN_THREADS" '
  >  >   buildopts = ' -DSTAN_THREADS CC="$CC" FC="$F77"'
  >  >
  >  > My impression is that none of these things affect the way the R packages
  >  > are build.
  >  >
  >  > Cheers,
  >  >
  >  > Loris
  >  >
  >  >> And in what hook are you trying to do this? (Which i'll see when you
  >  >> show me the hook ...)
  >  >>
  >  >> On 11/27/19 10:19 AM, Loris Bennett wrote:
  >  >>> Hi Åke,
  >  >>>
  >  >>> Åke Sandgren <[email protected]> writes:
  >  >>>
  >  >>>> You might need to add it to the configopts (preconfigopts). Not sure
  >  >>>> which steps that easyconfig/block is going through.
  >  >>>
  >  >>> I have tried tweaking the EC directly with
  >  >>>
  >  >>>   preconfigopts = 'CXXFLAGS="$CXXFLAGS -DSTAN_THREADS" '
  >  >>>
  >  >>> but this doesn't help.  In the log I see
  >  >>>
  >  >>>   == 2019-11-27 10:01:00,566 easyconfig.py:583 INFO setting easyconfig
  >  >>>   parameter preconfigopts: value CXXFLAGS="$CXXFLAGS -DSTAN_THREADS"
  >  >>>   (type: <type 'str'>)
  >  >>>
  >  >>> but subsequently
  >  >>>
  >  >>>   == 2019-11-27 10:01:01,750 environment.py:97 INFO Environment 
variable
  >  >>>   CXXFLAGS set to -O2 -ftree-vectorize -march=native -fno-math-errno
  >  >>>   (previously undefined)
  >  >>>
  >  >>> A heavy-handed approach would seem to be redefining the default value 
of
  >  >>> CXXFLAGS global.  Is that possible?
  >  >>>
  >  >>> Otherwise it looks like I'll have to patch the Makefiles in the 
sources.
  >  >>>
  >  >>> Cheers,
  >  >>>
  >  >>> Loris
  >  >>>
  >  >>>> On 11/21/19 10:05 AM, Loris Bennett wrote:
  >  >>>>> Loris Bennett <[email protected]> writes:
  >  >>>>>
  >  >>>>>> Hi,
  >  >>>>>>
  >  >>>>>> I am trying to install
  >  >>>>>>
  >  >>>>>>   RStan-2.18.2-foss-2018b-R-3.5.1.eb
  >  >>>>>>
  >  >>>>>> with the additional compiler flag:
  >  >>>>>>
  >  >>>>>>   -DSTAN_THREADS
  >  >>>>>>
  >  >>>>>> I want to us a hook and tried
  >  >>>>>>
  >  >>>>>>   def pre_configure_hook(self, *args, **kwargs):
  >  >>>>>>
  >  >>>>>>       """Pre-build hook"""
  >  >>>>>>
  >  >>>>>>       # Build RStan with threading
  >  >>>>>>       ##################################################
  >  >>>>>>       if self.name == 'RStan':
  >  >>>>>>           self.cfg['buildopts'] = self.cfg['buildopts'] \
  >  >>>>>>               + 'CXXFLAGS="$CXXFLAGS -DSTAN_THREADS"'
  >  >>>>>>           self.log.info("[pre-build hook] Added -DSTAN_THREADS to 
CXXFLAGS to buildopts")
  >  >>>>>>           return
  >  >>>>>>
  >  >>>>>> In the log file I can see that  the hooks is called, but the flag
  >  >>>>>> doesn't seem to be used.
  >  >>>>>>
  >  >>>>>> What am I doing wrong?
  >  >>>>>
  >  >>>>> I have also tried adding
  >  >>>>>
  >  >>>>>   buildopts = "-DSTAN_THREADS"
  >  >>>>>
  >  >>>>> to my own copy of the easyconfig. This does appear in
  >  >>>>> the log file has having been set:
  >  >>>>>
  >  >>>>>   == 2019-11-21 09:20:23,543 easyconfig.py:583 INFO setting 
easyconfig
  >  >>>>>   parameter buildopts: value -DSTAN_THREADS (type: <type 'str'>)
  >  >>>>>
  >  >>>>> but it is not passed to the compiler.  The compile lines do contain
  >  >>>>> other macros, but these are obviously coming from elsewhere:
  >  >>>>>
  >  >>>>>  g++ -std=gnu++14
  >  >>>>>  
-I"/trinity/shared/easybuild/software/R/3.5.1-foss-2018b/lib64/R/include"
  >  >>>>>  -DNDEBUG -I"../inst/include"
  >  >>>>>  
-I"`"/trinity/shared/easybuild/software/R/3.5.1-foss-2018b/lib64/R/bin/Rscript"
  >  >>>>>  --vanilla -e "cat(system.file('include', 'src', package =
  >  >>>>>  'StanHeaders'))"`" -DBOOST_DISABLE_ASSERTS
  >  >>>>>  -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION ...
  >  >>>>>
  >  >>>>> Any ideas how I could insert "-DSTAN_THREADS"?  Or can this kind of
  >  >>>>> thing only be done by patching the Makefile?
  >  >>>>>
  >  >>>>> Cheers,
  >  >>>>>
  >  >>>>> Loris
  >  >>>>>
  >  >>>>> --
  >  >>>>> Dr. Loris Bennett (Mr.)
  >  >>>>> ZEDAT, Freie Universität Berlin         Email 
[email protected]
  >  >>>>>
  >
  >  --
  >  Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
  >  Internet: [email protected]   Phone: +46 90 7866134 Fax: +46 90-580 14
  >  Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se
  --
  Dr. Loris Bennett (Mr.)
  ZEDAT, Freie Universität Berlin         Email [email protected]

Reply via email to