github.com/sentienttechnologies/studio-go-runner@v0.0.0-20201118202441-6d21f2ced8ee/internal/runner/cuda_nosupport.go (about)

     1  // +build !cgo NO_CUDA
     2  
     3  // Copyright 2018-2020 (c) Cognizant Digital Business, Evolutionary AI. All rights reserved. Issued under the Apache 2.0 License.
     4  
     5  package runner
     6  
     7  import (
     8  	"github.com/go-stack/stack"
     9  	"github.com/jjeffery/kv" // MIT License
    10  )
    11  
    12  // This file contains the CUDA functions implemented for the cases where
    13  // a platform cannot support the CUDA hardware, and or APIs
    14  
    15  var (
    16  	simDevs = cudaDevices{
    17  		Devices: []device{
    18  			//			device{
    19  			//				Name:    "simulated",
    20  			//				UUID:    "0",
    21  			//				MemTot:  16 * 1024 * 1024 * 1024,
    22  			//				MemFree: 16 * 1024 * 1024 * 1024,
    23  			//				MemUsed: 0,
    24  			//			},
    25  		},
    26  	}
    27  )
    28  
    29  func getCUDAInfo() (outDevs cudaDevices, err kv.Error) {
    30  
    31  	if len(simDevs.Devices) == 0 {
    32  		return simDevs, kv.NewError("CUDA not supported on this platform").With("stack", stack.Trace().TrimRuntime())
    33  	} else {
    34  		return simDevs, nil
    35  	}
    36  }
    37  
    38  func HasCUDA() bool {
    39  	return len(simDevs.Devices) > 0
    40  }