Skip to content

Commit

Permalink
packer-rocm/io/style: adjust (shorten) var prefixing
Browse files Browse the repository at this point in the history
  • Loading branch information
joshlay2amd committed Oct 28, 2024
1 parent dd57392 commit 6c3295b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
10 changes: 5 additions & 5 deletions packer-rocm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ansible-galaxy collection install -r ADA/packer-rocm/requirements.yml
ansible-playbook ADA/packer-rocm/playbooks/build.yml \
-i inventories/localhost.yml \
-e amdgpu_install_usecases=rocm \
-e rocm_builder_cpus=8 \
-e builder_cpus=8 \
-e qemu_binary="qemu-kvm" \
-K
```
Expand Down Expand Up @@ -60,10 +60,10 @@ Remove `-K` if your account does _not_ require a passphrase for `sudo`. This is
| `amdgpu_install_rocm_branch` | Optional development branch for `rocm` software with `amdgpu-install-internal`<br/>**Default:** _Skipped_ |
| `rocm_kernel` | The kernel package with an optional release specifier.<br/>**Default:** `linux-image-generic-hwe-22.04` |
| `rocm_extras` | Packages installed before `amdgpu-install` _'usecases'_, comma-separated string with optional releases.<br/>**Default:** _linux-headers-generic-hwe-22.04,linux-image-extra-virtual-hwe-22.04_ |
| `rocm_filename` | The name of the output file/artifact _(tarball)_<br/>**Default:** `ubuntu-rocm.tar.gz` |
| `rocm_builder_cpus` | Number of virtual CPUs given to the builder VM.<br/>**Default:** _4_ |
| `rocm_builder_disk` | Space given to the builder; releases compound quickly.<br/>**Default:** _60G_ |
| `rocm_builder_memory` | Megabytes of memory given to the builder. Reduction may cause out-of-memory conditions.<br/>**Default:** _4096_ |
| `builder_cpus` | Number of virtual CPUs given to the builder virtual machine.<br/>**Default:** _4_ |
| `builder_disk` | Size of the `raw` disk image behind the virtual machine.<br/>**Default:** _60G_ |
| `builder_memory` | Megabytes of memory given to the virtual machine. Reduction may cause out-of-memory conditions.<br/>**Default:** _4096_ |
| `filename` | The name of the output file/artifact _(tarball)_<br/>**Default:** `ubuntu-rocm.tar.gz` |
| `niccli_wanted` | If [niccli](https://techdocs.broadcom.com/us/en/storage-and-ethernet-connectivity/ethernet-nic-controllers/bcm957xxx/adapters/Configuration-adapter/nic-cli-configuration-utility.html) is included in the image.<br/>**Default:** `True` |
| `niccli_url` | The URL for the _Broadcom_ `niccli` installation archive.<br/>**Default:** `https://docs.broadcom.com/docs-and-downloads/ethernet-network-adapters/NXE/Thor2/GCA2/bcm5760x_231.2.63.0a.zip` |
| `niccli_sum` | _Optional_. Checksum to validate `niccli_url` downloads. Example: `sha256:abcd1234`<br/>**Default:** _Undefined_ |
Expand Down
2 changes: 1 addition & 1 deletion packer-rocm/playbooks/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@
chdir: "{{ (workdir, packer_dist) | path_join }}"
creates: "{{ _creates }}" # avoid replacing the file; require deletion
vars:
_creates: "{{ (workdir, packer_dist, (rocm_filename | default(packer_dist + '-rocm.tar.gz'))) | path_join }}"
_creates: "{{ (workdir, packer_dist, (filename | default(packer_dist + '-rocm.tar.gz'))) | path_join }}"
environment:
PACKER_LOG: '1' # wanted as str
2 changes: 0 additions & 2 deletions packer-rocm/repositories/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@
Any `.repo` or `.list` files placed here will be automatically copied into the _Packer_ builder VM.

Use `-e rocm_extras=pkg1,pkg2,...` to request any packages they -- or the distribution -- provide.

When replacing the `amdgpu` or `rocm` repositories, `-e rocm_repos=false` may skip those for generally-available releases.
4 changes: 1 addition & 3 deletions packer-rocm/ubuntu/packages/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# packages

Files placed here will be copied into the _Packer_ builder VM. The _intended_ use includes `.deb` or `.rpm` files.

Packages appropriate for the image will be installed by an [Ansible playbook](../playbooks/package-globber.yml), used by _Packer_ as a [provisioner](https://developer.hashicorp.com/packer/docs/provisioners/).
Files placed here will be archived and copied into builder VM by _Packer_, processed by [curtin](https://curtin.readthedocs.io/en/latest/topics/overview.html) hooks. The _intended_ usecase involves `.deb` files.
8 changes: 4 additions & 4 deletions packer-rocm/ubuntu/ubuntu-rocm.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ source "qemu" "rocm" {
}
cd_label = "cidata"
# system resources
cpus = var.rocm_builder_cpus
disk_size = "${var.rocm_builder_disk}" # Packer seems to have trouble with strings that begin with numbers; explicitly cast
memory = var.rocm_builder_memory
cpus = var.builder_cpus
disk_size = "${var.builder_disk}" # Packer seems to have trouble with strings that begin with numbers; explicitly cast
memory = var.builder_memory
# image/build prefs
qemu_binary = var.qemu_binary
# accelerator = "none" # Packer will try 'kvm', falling back to 'tcg' if necessary
Expand Down Expand Up @@ -158,7 +158,7 @@ build {
post-processor "shell-local" {
inline = [
"SOURCE=${source.name}",
"OUTPUT=${var.rocm_filename}",
"OUTPUT=${var.filename}",
"IMG_FMT=raw",
"ROOT_PARTITION=2",
# expedite compression: use an exported function to test for 'pigz' and remap 'gzip' to it, if found
Expand Down
8 changes: 4 additions & 4 deletions packer-rocm/ubuntu/ubuntu-rocm.variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ variable "ubuntu_release" {
default = "22.04.5"
}

variable "rocm_filename" {
variable "filename" {
type = string
default = "ubuntu-rocm.tar.gz"
description = "The name of the output file/artifact (tarball)"
Expand All @@ -69,19 +69,19 @@ variable "rocm_extras" {
description = "Comma-separated string of extra packages to install [before 'amdgpu-dkms' and ROCm releases]. For headers, extra-modules, and any other packages. May include release specifiers, '=1.2.3' or globbed."
}

variable "rocm_builder_cpus" {
variable "builder_cpus" {
type = number
default = 4
description = "Number of CPU threads given to the builder Virtual Machine. More may help compilation speed"
}

variable "rocm_builder_memory" {
variable "builder_memory" {
type = number
default = 4096
description = "RAM given to the builder VM, measured in MB. Out-of-memory conditions were found with 2G during DKMS builds"
}

variable "rocm_builder_disk" {
variable "builder_disk" {
type = string
default = "70G"
description = "amdgpu and ROCm releases demand considerable space. Layout in 'user-data-rocm' will claim all of this"
Expand Down
3 changes: 1 addition & 2 deletions packer-rocm/ubuntu/user-data-rocm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ autoinstall:
packages:
# support potential use of the ansible-local provisioner
- "ansible"
# pull venv+secondary Python executables
# suggested non-amdgpu/ROCm packages (for those, see 'amdgpu_install_pre' in the Ansible role)
- "python3.10-venv"
- "python3.11-venv"
# other suggested non-amdgpu/ROCm packages (for those, see rocm_reqs.common in that playbook)
- "ffmpeg"
- "foot-terminfo"
- "kitty-terminfo"
Expand Down

0 comments on commit 6c3295b

Please sign in to comment.