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 filecontent
can be defined inline in the blueprint or can point to asource
, 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 beforecommands
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.
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 gcc@10.3.0 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.
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 gcc@10.3.0 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]
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.
Name | Version |
---|---|
terraform | >= 1.0.0 |
local | >= 2.0.0 |
Name | Version |
---|---|
local | >= 2.0.0 |
Name | Source | Version |
---|---|---|
startup_script | ../../../../modules/scripts/startup-script | n/a |
Name | Type |
---|---|
local_file.debug_file_ansible_execute | resource |
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({ |
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 |
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. |