apiVersion: "sparkoperator.hpe.com/v1beta2"
kind: SparkApplication
metadata:
  name: spark-gpu-py
  namespace: <username>
spec:
  sparkConf:
    # Enabling RAPIDs plugin
    spark.plugins: "com.nvidia.spark.SQLPlugin"
    spark.rapids.sql.enabled: "true"
    spark.rapids.force.caller.classloader: "false"
 
    # GPU allocation and discovery settings
    spark.task.resource.gpu.amount: "1"
    spark.executor.resource.gpu.amount: "1"
    spark.executor.resource.gpu.vendor: "nvidia.com"
    spark.executor.resource.gpu.discoveryScript: "/opt/mapr/spark/spark-3.5.5/examples/src/main/scripts/getGpusResources.sh"
    spark.rapids.shims-provider-override: "com.nvidia.spark.rapids.shims.spark355.SparkShimServiceProvider"
 
  type: Python
  sparkVersion: 3.5.5
  mode: cluster
  image: lr1-bd-harbor-registry.mip.storage.hpecorp.net/develop/hpe-spark/spark:v3.5.5.2.3
  imagePullPolicy: Always
  mainApplicationFile: "local:///mounts/shared-volume/shared/aie-tutorials/current-release/Data-Analytics/Spark-GPU/Python/SqlOnGpuExample.py"
  restartPolicy:
    type: Never
  imagePullSecrets:
    - imagepull
  driver:
    cores: 1
    coreLimit: "1000m"
    memory: "1024m"
    labels:
      version: 3.5.5
    volumeMounts:
      - name: shared-volume
        mountPath: /mounts/shared-volume
  executor:
    cores: 1
    coreLimit: "1000m"
    instances: 1
    memory: "2G"
    gpu:
      name: "nvidia.com/gpu"
      quantity: 1
    labels:
      version: 3.5.5
    volumeMounts:
      - name: shared-volume
        mountPath: /mounts/shared-volume
  volumes:
    - name: shared-volume
      persistentVolumeClaim:
        claimName: kubeflow-shared-pvc
