Dear Jakob,

On 10/10/2018 09:54, Jakob Schiøtz wrote:
Hi all,

I am making an easyconfig (WIP PR #6984), and to solve an issue I need to set 
an environment variable pointing to a library in a dependency.  The variably 
logically belongs in this module, not in the dependency, as it is a quirk of 
this software that requires it to be set.

I thus need to refer to paths in a dependency in a modextravars line in the 
.eb.  I want to set the variable GPAW_FFTWSO to the value 
$EBROOT_FFTW/lib/libfftw3f.so,$EBROOT_FFTW/lib/libfftw3.so

I assume that doing an "import os” and then using os.genenv() is not considered 
god style in an easyconfig.  Is there a better way?  Writing $EBROOT_FFTW in the 
string does not work, it is of course not expanded.


Reason:
The package GPAW with the iomkl and intel toolchains is linked with Intel MKL.  
But Intel MKL contains an incomplete implementation of the FFTW interface, and 
it is apparently incompatible with the real FFTW meaning that calling FFTW 
functions from both libraries in the same executable causes core dumps.  
Unfortunately, the optional dependency libvdwxc (which gives extra 
functionality to GPAW) links against the real FFTW (and cannot use MKL as a key 
function is missing).  Linking GPAW with FFTW before MKL almost works, but 
unfortunately the Python code does some unholy stuff and tries to find the FFTW 
library itself, picks up MKL and crases.  Setting GPAW_FFTWSO overrrules this.


Resolving the value of an environment variable to define another environment variable via modextravars currently isn't possible.

We have a mechanism to specify that an environment variable should be resolved at "module load" time, but it currently only works in a very specific situation (for $HOME in --subdir-user-modules).

But you can work around this, with either modtclfooter or modluafooter, depending on which syntax your module files are being generated in.

Something like this should work (totally untested, I'll leave that up to you):

modtclfooter = "setenv GPAW_FFTWSO $::env(EBROOTFFTW)/lib"

or

modluafooter = 'setenv("GPAW_FFTWSO", pathJoin(os.getenv("EBROOTFFTW"), "lib")'


regards,

Kenneth



Best regards

Jakob

--
Jakob Schiøtz, professor, Ph.D.
Department of Physics
Technical University of Denmark
DK-2800 Kongens Lyngby, Denmark
http://www.fysik.dtu.dk/~schiotz/



Reply via email to