Skip to content

Commit

Permalink
Merge pull request #9 from iflytek/feature/filter_devices
Browse files Browse the repository at this point in the history
Feature/filter devices
  • Loading branch information
niclausse authored Oct 24, 2024
2 parents 92fecf0 + 8837a68 commit 8d8df18
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 1 addition & 2 deletions request/textLine.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ func (r *Request) TextmultiUpStream(cli *xsfcli.Client, swg *sync.WaitGroup, ses
sendDatalist := strings.Split(string(r.C.UpStreams[0].DataList[0]), "\n")
println(len(sendDatalist))
for dataId := 1; dataId <= len(sendDatalist); dataId++ {
println("hhahaha", sendDatalist[dataId-1])

println(sendDatalist[dataId-1])
sendData := sendDatalist[dataId-1]
sTime := time.Now()

Expand Down
22 changes: 22 additions & 0 deletions util/nvidiaLog.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import (
"github.com/NVIDIA/gpu-monitoring-tools/bindings/go/nvml"
"io/ioutil"
"log"
"os"
"os/exec"
"strconv"
"strings"
)

type NvidiaSmiLog struct {
Expand Down Expand Up @@ -398,7 +401,26 @@ func NVMLGpuProcesses() ([]ProcessInfoS, error) {
if err != nil {
return nil, err
}

filterDeviceIds := make(map[uint]bool)
filteredDevices := os.Getenv("FILTER_DEVICES")
if filteredDevices != "" {
for _, s := range strings.Split(filteredDevices, ",") {
i, err := strconv.ParseInt(s, 10, 64)
if err != nil {
log.Printf("ERROR: failed to parse filtered_devices, %s", err.Error())
continue
}

filterDeviceIds[uint(i)] = true
}
}

for i := uint(0); i < count; i++ {
if filterDeviceIds[i] {
continue
}

device, err := nvml.NewDevice(i)
if err != nil {
log.Panicf("Error getting device %d: %v\n", i, err)
Expand Down

0 comments on commit 8d8df18

Please sign in to comment.