Skip to content

Error creating Cray toolchain modulefiles with Lua syntax  #3626

@lucamar

Description

@lucamar

I report here as a placeholder for further discussion the issue with the swap function mentioned in #3575.
The error is raised at the sanity check when the Lua syntax is used to create the Cray toolchain modulefiles:

== 2021-02-18 10:41:00,170 build_log.py:169 ERROR EasyBuild crashed with an error (at easybuild/base/exceptions.py:124 in __init__): Module command '/usr/share/lmod/lmod/libexec/lmod python load cpeGNU/21.02' failed with exit code 1; stderr: Lmod has detected the following error: Unable to load module because of error when evaluating modulefile:
     /tmp/eb-l61bgz4f/tmpk9aiog8r/all/Core/cpeGNU/21.02.lua: [string "help([==[..."]:29: attempt to call a nil value (global
'swap')
     Please check the modulefile and especially if there is a the line number specified in the above message 
While processing the following module(s):
    Module fullname  Module Filename
    ---------------  ---------------
    cpeGNU/21.02     /tmp/eb-l61bgz4f/tmpk9aiog8r/all/Core/cpeGNU/21.02.lua

; stdout: _mlstatus = False
 (at easybuild/tools/modules.py:814 in run_module)

The framework scripts involved are easyblocks/generic/craytoolchain.py and tools/module_generator.py. The workaround is to list Cray external modules using module unlod/load commands in modluafooter instead of dependencies, to avoid the use of the function swap in the Lua modulefile created by EasyBuild for the Cray toolchains.
In the example below I make use of the custom easyblock cpeToolchain adapted from craytoolchain.py:

# Compiler toolchain for Cray EX Programming Environment GNU compiler (cpe-gnu)
easyblock = 'cpeToolchain'

name = 'cpeGNU'
version = "21.02"

homepage = 'https://pubs.cray.com'
description = """Toolchain using Cray compiler wrapper with cpe-gnu module (CPE release: %s).\n""" % version

toolchain = SYSTEM

dependencies = [
   ('cpe-gnu', EXTERNAL_MODULE)
]

modluafooter = '''
if not ( isloaded("cray-dsmml/0.1.3") ) then
    load("cray-dsmml/0.1.3")
end
if not ( isloaded("cray-libsci/20.12.1.2") ) then
    load("cray-libsci/20.12.1.2")
end
if not ( isloaded("cray-mpich/8.1.2") ) then
    load("cray-mpich/8.1.2")
end
if not ( isloaded("craype/2.7.5") ) then
    load("craype/2.7.5")
end
if not ( isloaded("craype-x86-rome") ) then
    load("craype-x86-rome")
end
if not ( isloaded("craype-network-ofi") ) then
    load("craype-network-ofi")
end
if not ( isloaded("gcc/10.2.0") ) then
    load("gcc/10.2.0")
end
if not ( isloaded("libfabric/1.11.0.0.233") ) then
    load("libfabric/1.11.0.0.233")
end
if not ( isloaded("perftools-base/21.02.0") ) then
    load("perftools-base/21.02.0")
end
if not ( isloaded("xpmem/2.2.35-7.0.1.0_1.9__gd50fabf.shasta") ) then
    load("xpmem/2.2.35-7.0.1.0_1.9__gd50fabf.shasta")
end
prepend_path("MODULEPATH",root:gsub("software","modules/all/Toolchain"))
'''
moduleclass = 'toolchain'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug reportcrayIssues and PRs related to integration with Cray PE

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions