Skip to content

Commit

Permalink
RHOAIENG-11046 - Create GPU test for AMD
Browse files Browse the repository at this point in the history
  • Loading branch information
jiripetrlik committed Sep 23, 2024
1 parent 9033e1c commit c263e3c
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions tests/odh/mnist_ray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,45 @@ import (
)

func TestMnistRayCpu(t *testing.T) {
mnistRay(t, 0)
mnistRay(t, 0, false)
}

func TestMnistRayGpu(t *testing.T) {
mnistRay(t, 1)
mnistRay(t, 1, false)
}

func TestMnistRayAMDGpu(t *testing.T) {
mnistRay(t, 1, true)
}

func TestMnistCustomRayImageCpu(t *testing.T) {
mnistRay(t, 0)
mnistRay(t, 0, false)
}

func TestMnistCustomRayImageGpu(t *testing.T) {
mnistRay(t, 1)
mnistRay(t, 1, true)
}

func mnistRay(t *testing.T, numGpus int) {
func mnistRay(t *testing.T, numGpus int, amd bool) {
test := With(t)

// Create a namespace
namespace := test.NewTestNamespace()

var gpuResource string
if amd {
gpuResource = "amd.com/gpu"
} else {
gpuResource = "nvidia.com/gpu"
}

// Get ray image
rayImage := GetRayImage()
var rayImage string
if amd {
rayImage = GetRayAMDGpuImage()
} else {
rayImage = GetRayImage()
}

// Create Kueue resources
resourceFlavor := CreateKueueResourceFlavor(test, v1beta1.ResourceFlavorSpec{})
Expand All @@ -64,7 +80,7 @@ func mnistRay(t *testing.T, numGpus int) {
NamespaceSelector: &metav1.LabelSelector{},
ResourceGroups: []v1beta1.ResourceGroup{
{
CoveredResources: []corev1.ResourceName{corev1.ResourceName("cpu"), corev1.ResourceName("memory"), corev1.ResourceName("nvidia.com/gpu")},
CoveredResources: []corev1.ResourceName{corev1.ResourceName("cpu"), corev1.ResourceName("memory"), corev1.ResourceName(gpuResource)},
Flavors: []v1beta1.FlavorQuotas{
{
Name: v1beta1.ResourceFlavorReference(resourceFlavor.Name),
Expand Down

0 comments on commit c263e3c

Please sign in to comment.