Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix module loads #5599

Merged
merged 5 commits into from
Oct 5, 2017
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions lib/spack/spack/build_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,6 @@ def set_compiler_environment_variables(pkg, env):

env.set('SPACK_COMPILER_SPEC', str(pkg.spec.compiler))

for mod in compiler.modules:
# Fixes issue https://github.com/LLNL/spack/issues/3153
if os.environ.get("CRAY_CPU_TARGET") == "mic-knl":
load_module("cce")
load_module(mod)

compiler.setup_custom_environment(pkg, env)

return env
Expand Down Expand Up @@ -312,9 +306,6 @@ def set_build_environment_variables(pkg, env, dirty):
if os.path.isdir(pcdir):
env.prepend_path('PKG_CONFIG_PATH', pcdir)

if pkg.architecture.target.module_name:
load_module(pkg.architecture.target.module_name)

return env


Expand Down Expand Up @@ -484,7 +475,7 @@ def setup_package(pkg, dirty):
set_compiler_environment_variables(pkg, spack_env)
set_build_environment_variables(pkg, spack_env, dirty)
pkg.architecture.platform.setup_platform_environment(pkg, spack_env)
load_external_modules(pkg)

# traverse in postorder so package can use vars from its dependencies
spec = pkg.spec
for dspec in pkg.spec.traverse(order='post', root=False, deptype='build'):
Expand All @@ -511,6 +502,19 @@ def setup_package(pkg, dirty):
validate(spack_env, tty.warn)
spack_env.apply_modifications()

# All module loads that otherwise would belong in previous functions
# have to occur after previous line. They are now here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should explicitly refer to the call to spack_env.apply_modifications and it may be work adding to the explanation like:

spack_env includes modifications like unsetting LD_LIBRARY path, which required modules may update. Modules are therefore loaded after the call to spack_env.apply_modifications.

for mod in pkg.compiler.modules:
# Fixes issue https://github.com/LLNL/spack/issues/3153
if os.environ.get("CRAY_CPU_TARGET") == "mic-knl":
load_module("cce")
load_module(mod)

if pkg.architecture.target.module_name:
load_module(pkg.architecture.target.module_name)

load_external_modules(pkg)


def fork(pkg, function, dirty):
"""Fork a child process to do part of a spack build.
Expand Down