Skip to content

Latest commit

 

History

History
141 lines (108 loc) · 6.96 KB

File metadata and controls

141 lines (108 loc) · 6.96 KB

Description

This module creates a script that defines a software build using Spack and performs any additional customization to a Spack installation.

There are two main variable inputs that can be used to define a Spack build: data_files and commands.

  • data_files: Any files specified will be transferred to the machine running outputted script. Data file content can be defined inline in the blueprint or can point to a source, an absolute local path of a file. This can be used to transfer environment definition files, config definition files, GPG keys, or software licenses. data_files are transferred before commands are run.
  • commands: A script that is run. This can be used to perform actions such as installation of compilers & packages, environment creation, adding a build cache, and modifying the spack configuration.

Example

The spack-execute module should use a spack-setup module. This will prepend the installation of Spack and its dependencies to the build. Then spack-execute can be used by a module that takes startup-script as an input.

  - id: spack-setup
    source: community/modules/scripts/spack-setup

  - id: spack-build
    source: community/modules/scripts/spack-execute
    use: [spack-setup]
    settings:
      commands: |
        spack install [email protected] target=x86_64

  - id: builder-vm
    source: modules/compute/vm-instance
    use: [network1, spack-build]

To see a full example of this module in use, see the hpc-slurm-gromacs.yaml example.

Using with startup-script module

The spack-runner output can be used by the startup-script module.

  - id: spack-setup
    source: community/modules/scripts/spack-setup

  - id: spack-build
    source: community/modules/scripts/spack-execute
    use: [spack-setup]
    settings:
      commands: |
        spack install [email protected] target=x86_64

  - id: startup-script
    source: modules/scripts/startup-script
    settings:
      runners:
      - $(spack-build.spack-runner)
      - type: shell
        destination: "my-script.sh"
        content: echo 'hello world'

  - id: workstation
    source: modules/compute/vm-instance
    use: [network1, startup-script]

License

Copyright 2023 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Requirements

Name Version
terraform >= 1.0.0
local >= 2.0.0

Providers

Name Version
local >= 2.0.0

Modules

Name Source Version
startup_script ../../../../modules/scripts/startup-script n/a

Resources

Name Type
local_file.debug_file_ansible_execute resource

Inputs

Name Description Type Default Required
commands String of commands to run within this module string null no
data_files A list of files to be transferred prior to running commands.
It must specify one of 'source' (absolute local file path) or 'content' (string).
It must specify a 'destination' with absolute path where file should be placed.
list(map(string)) [] no
deployment_name Name of deployment, used to name bucket containing spack scripts. string n/a yes
gcs_bucket_path The GCS path for storage bucket and the object, starting with gs://. string n/a yes
labels Key-value pairs of labels to be added to created resources. map(string) n/a yes
log_file Defines the logfile that script output will be written to string "/var/log/spack.log" no
project_id Project in which the HPC deployment will be created. string n/a yes
region Region to place bucket containing spack scripts. string n/a yes
spack_profile_script_path Path to the Spack profile.d script. Created by an instance of spack-setup.
Can be defined explicitly, or by chaining an instance of a spack-setup module
through a use setting.
string n/a yes
spack_runner Runner from previous spack-setup or spack-execute to be chained with scripts generated by this module.
object({
type = string
content = string
destination = string
})
n/a yes
system_user_name Name of the system user used to execute commands. Generally passed from the spack-setup module. string n/a yes

Outputs

Name Description
controller_startup_script Spack startup script, duplicate for SLURM controller.
gcs_bucket_path Bucket containing the startup scripts for spack, to be reused by spack-execute module.
spack_profile_script_path Path to the Spack profile.d script.
spack_runner Single runner that combines scripts from this module and any previously chained spack-execute or spack-setup modules.
startup_script Spack startup script.
system_user_name The system user used to execute commands.