12345678910111213141516171819202122 |
- //go:build linux || windows
- package gpu
- import (
- "log/slog"
- "strings"
- )
- func cudaGetVisibleDevicesEnv(gpuInfo []GpuInfo) (string, string) {
- ids := []string{}
- for _, info := range gpuInfo {
- if info.Library != "cuda" {
- // TODO shouldn't happen if things are wired correctly...
- slog.Debug("cudaGetVisibleDevicesEnv skipping over non-cuda device", "library", info.Library)
- continue
- }
- ids = append(ids, info.ID)
- }
- return "CUDA_VISIBLE_DEVICES", strings.Join(ids, ",")
- }
|