Skip to content

Commit

Permalink
move bootc builder to common
Browse files Browse the repository at this point in the history
Signed-off-by: greg pereira <[email protected]>
  • Loading branch information
Gregory-Pereira committed Jun 19, 2024
1 parent fcd7e7a commit 8b6f702
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/training_bootc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Build Image
id: build_image
run: make dtk ARCH=${{ matrix.arch }}
run: make driver-toolkit ARCH=${{ matrix.arch }}
working-directory: ${{ matrix.context }}

- name: Login to Container Registry
Expand Down
6 changes: 4 additions & 2 deletions training/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ vllm:
#
# Create bootc container images prepared for AI
#
.PHONY: amd nvidia intel vllm
.PHONY: driver-tookit amd nvidia intel vllm
driver-tookit:
make -C common/ -f Makefile.common driver-toolkit
amd:
make -C amd-bootc/ bootc bootc-models
intel:
make -C intel-bootc/ bootc bootc-models
nvidia:
make -C nvidia-bootc/ dtk bootc bootc-models
make -C nvidia-bootc/ driver-toolkit bootc bootc-models

#
# Make Bootc container images preinstalled with cloud-init
Expand Down
20 changes: 19 additions & 1 deletion training/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ TRAIN_WRAPPER = $(CURDIR)/../ilab-wrapper/ilab-training-launcher
OUTDIR = $(CURDIR)/../build
MODELS_CONTAINERFILE = $(OUTDIR)/Containerfile.models

DRIVER_TOOLKIT_IMAGE_NAME ?= driver-toolkit
DRIVER_TOOLKIT_IMAGE_TAG ?= latest
DRIVER_TOOLKIT_IMAGE = ${REGISTRY}/${REGISTRY_ORG}/${DRIVER_TOOLKIT_IMAGE_NAME}:${DRIVER_TOOLKIT_IMAGE_TAG}

ENABLE_RT ?=

SSH_PUBKEY ?= $(shell cat ${HOME}/.ssh/id_rsa.pub 2> /dev/null)

.PHONY: prepare-files
Expand Down Expand Up @@ -113,7 +119,19 @@ bootc-models: generate-model-cfile
--file ${MODELS_CONTAINERFILE} \
--security-opt label=disable \
--tag "${BOOTC_MODELS_IMAGE}" \
-v ${OUTDIR}:/run/.input:ro \
-v ${OUTDIR}:/run/.input:ro

.PHONY: driver-toolkit
driver-toolkit:
"${CONTAINER_TOOL}" build \
$(ARCH:%=--platform linux/%) \
$(BUILD_ARG_FILE:%=--build-arg-file=%) \
$(ENABLE_RT:%=--build-arg ENABLE_RC=%) \
$(FROM:%=--from=%) \
$(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \
$(SOURCE_DATE_EPOCH:%=--timestamp=%) \
--file ../common/bootc-image-builder/Containerfile \
--tag "${DRIVER_TOOLKIT_IMAGE}" \
${CONTAINER_TOOL_EXTRA_ARGS} .

.PHONY: clean
Expand Down
File renamed without changes.
20 changes: 1 addition & 19 deletions training/nvidia-bootc/Makefile
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
VENDOR ?= nvidia
IMAGE_NAME ?= $(VENDOR)-bootc
DTK_IMAGE_NAME ?= $(VENDOR)-builder
DTK_IMAGE_TAG ?= latest
DRIVER_TOOLKIT_IMAGE = ${REGISTRY}/${REGISTRY_ORG}/${DTK_IMAGE_NAME}:${DTK_IMAGE_TAG}

CUDA_VERSION ?=
OS_VERSION_MAJOR ?=
ENABLE_RT ?=
MODELS_CONTAINERFILE = $(OUTDIR)/Containerfile.models
include ../common/Makefile.common

default: bootc

.PHONY: dtk
dtk:
"${CONTAINER_TOOL}" build \
$(ARCH:%=--platform linux/%) \
$(BUILD_ARG_FILE:%=--build-arg-file=%) \
$(ENABLE_RT:%=--build-arg ENABLE_RC=%) \
$(FROM:%=--from=%) \
$(KERNEL_VERSION:%=--build-arg KERNEL_VERSION=%) \
$(SOURCE_DATE_EPOCH:%=--timestamp=%) \
--file Containerfile.builder \
--tag "${DRIVER_TOOLKIT_IMAGE}" \
${CONTAINER_TOOL_EXTRA_ARGS} .

.PHONY: bootc
bootc: dtk check-sshkey prepare-files growfs
bootc: driver-toolkit check-sshkey prepare-files growfs
"${CONTAINER_TOOL}" build \
$(ARCH:%=--platform linux/%) \
$(BUILD_ARG_FILE:%=--build-arg-file=%) \
Expand Down

0 comments on commit 8b6f702

Please sign in to comment.