-
Notifications
You must be signed in to change notification settings - Fork 117
[feat] Add a new build system backend for building test code with Spack #1871
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1871 +/- ##
==========================================
+ Coverage 87.61% 87.65% +0.04%
==========================================
Files 49 49
Lines 8136 8504 +368
==========================================
+ Hits 7128 7454 +326
- Misses 1008 1050 +42
Continue to review full report at Codecov.
|
victorusu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rsarm, it works great for me, except when I am using with Lmod with hierarchical naming scheme... I think we should have a dedicated solution for that.
victorusu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rsarm, I forgot to add the issue that I have experienced with this build system. Please take a look at the comment about source_cache and misc_cache.
|
Hello @rsarm, Thank you for updating! Cheers! There are no PEP8 issues in this Pull Request!Do see the ReFrame Coding Style Guide Comment last updated at 2021-05-25 15:14:31 UTC |
|
Example checks: import reframe as rfm
import reframe.utility.sanity as sn
class SpackMixin(rfm.RegressionTest):
@rfm.run_before('run')
def prepare_run(self):
self.prerun_cmds = [
f'spack env activate -d {self.build_system.environment}'
]
self.prerun_cmds.append([
f'spack load {mod}'
for mod in self.build_system.generated_modules
])
@rfm.simple_test
class SpackEnvCheck(SpackMixin):
def __init__(self):
self.descr = 'Spack buildsystem example.'
self.valid_systems = ['*'] # ['daint:gpu', 'dom:gpu']
self.valid_prog_environs = ['*'] # ['builtin']
self.sourcesdir += '/spack'
self.build_system = 'Spack'
self.executable = 'iconv'
self.executable_opts = ['--version']
self.build_system.environment = 'spack_env'
self.sanity_patterns = sn.assert_found(
r'iconv \(GNU libiconv 1\.16\)', self.stdout
)with the environment spack:
specs:
- zlib@1.2.3
- libiconv@1.16
concretization: together
config:
install_tree: spack/opt/spack
module_roots:
tcl: spack/share/spack/modules
lmod: spack/share/spack/lmodthat goes in This test runs fine. The following test using 'scopes' gives the error as if spack was not properly setup (at least with the local scheduler): import reframe as rfm
import reframe.utility.sanity as sn
class SpackMixin(rfm.RegressionTest):
@rfm.run_before('run')
def prepare_run(self):
self.prerun_cmds = [
f'spack -C {self.build_system.scope_dir} load {mod}'
for mod in self.build_system.generated_modules
]
# self.executable = 'spack'
# self.executable_opts = [f'-C {self.build_system.scope_dir} find']
@rfm.simple_test
class UlimitCheck(SpackMixin):
def __init__(self):
self.descr = 'Checking the output of ulimit -s in node.'
self.valid_systems = ['*'] # ['daint:gpu', 'dom:gpu']
self.valid_prog_environs = ['*'] # ['builtin']
self.sourcesdir += '/ulimit'
self.build_system = 'Spack'
self.build_system.packages = ['libiconv@1.16',
'zlib@1.2.3',
'openmpi@4.0.5']
self.build_system.upstreams = ['/home/sarafael/spack/opt/spack']
self.executable = 'iconv'
self.executable_opts = ['--version']
self.sanity_patterns = sn.assert_found(
r'iconv \(GNU libiconv 1\.16\)', self.stdout
)It creates the script which gives the error: |
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, looks good to me. We need to expand the documentation, as well as write a minimal unit test the check the emitted commands as we for the EB. Finally, did we resolve the issue about spack load?
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What we are still missing is a way to automatically activate the environment and load the modules when the test runs. One way I see this happening is by expanding the BuildSystem basic interface with a function that would return commands to be emitted before running the test. And we could also add a boolean field to the Spack backend to enable or disable the automatic generation of these commands.
And, finally, we also miss the documentation.
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the PR and I have a comment:
I am using the fish shell, so in my case I have to source Spack's setup-env.sh in each of the scripts (build and run). Although, sourcing it in prebuild_cmds it will work for the build phase, it won't do so if I add it to prerun_cmds for the run phase, because the spack env activate is issued before these commands. Could we automatically generate the sourcing of the setup-env.sh script? Could we get the prefix of the spack installation for example?
- Emit `spack load` instructions in run phase by default.
- An option to disable the generation of `spack load`s before running. - An option to specify additional options to be passed to `spack install`.
vkarak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm now. I have done some improvements and added a couple of improvements.
victorusu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
@jenkins-cscs retry daint |
Closes #1466