Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions deployments/gpu_pytorch_demo/demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2025 Intel Corporation. All Rights Reserved.
#
# 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.

import torch as t

if not t.xpu.is_available():
raise Exception("No xpu available")

arr = t.tensor([1.0, 2.0, 3.0, 4.0]).to("xpu")

arr *= 2

print(arr)

cmp = t.tensor([2.0, 4.0, 6.0, 8.0]).to("xpu")

if not t.equal(arr, cmp):
raise Exception("Not valid result:", arr)
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ spec:
restartPolicy: Never
containers:
- name: testcontainer
image: intel/intel-extension-for-tensorflow:latest
image: intel/intel-extension-for-pytorch:xpu
imagePullPolicy: IfNotPresent
securityContext:
allowPrivilegeEscalation: false
command: ["/bin/sh", "-c"]
args: ["python /code/training.py"]
args: ["python3 /code/demo.py"]
resources:
limits:
gpu.intel.com/i915: 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
configMapGenerator:
- name: training-code
files:
- training.py
- demo.py

resources:
- deployment.yaml

images:
- name: intel/intel-extension-for-tensorflow
newTag: 1.2.0-gpu
- name: intel/intel-extension-for-pytorch
newTag: 2.8.10-xpu
61 changes: 0 additions & 61 deletions deployments/gpu_tensorflow_test/training.py

This file was deleted.

14 changes: 7 additions & 7 deletions test/e2e/gpu/gpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const (
healthMgmtYaml = "deployments/gpu_plugin/overlays/health/kustomization.yaml"
nfdRulesYaml = "deployments/nfd/overlays/node-feature-rules/kustomization.yaml"
containerName = "testcontainer"
tfKustomizationYaml = "deployments/gpu_tensorflow_test/kustomization.yaml"
tfPodName = "training-pod"
ptKustomizationYaml = "deployments/gpu_pytorch_demo/kustomization.yaml"
ptPodName = "training-pod"
)

func init() {
Expand Down Expand Up @@ -195,12 +195,12 @@ func describe() {
})
})

ginkgo.It("run a small workload on the GPU [App:tensorflow]", func(ctx context.Context) {
ginkgo.It("run a small workload on the GPU [App:pytorch]", func(ctx context.Context) {
createPluginAndVerifyExistence(f, ctx, vanillaPath, "gpu.intel.com/i915")

kustomYaml, err := utils.LocateRepoFile(tfKustomizationYaml)
kustomYaml, err := utils.LocateRepoFile(ptKustomizationYaml)
if err != nil {
framework.Failf("unable to locate %q: %v", tfKustomizationYaml, err)
framework.Failf("unable to locate %q: %v", ptKustomizationYaml, err)
}

ginkgo.By("submitting demo deployment")
Expand All @@ -209,8 +209,8 @@ func describe() {

ginkgo.By("waiting the pod to finish")

err = e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, tfPodName, f.Namespace.Name, 300*time.Second)
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, tfPodName, containerName))
err = e2epod.WaitForPodSuccessInNamespaceTimeout(ctx, f.ClientSet, ptPodName, f.Namespace.Name, 300*time.Second)
gomega.Expect(err).To(gomega.BeNil(), utils.GetPodLogs(ctx, f, ptPodName, containerName))

framework.Logf("tensorflow execution succeeded!")
})
Expand Down