Skip to content

Commit

Permalink
log once (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarithm committed Aug 17, 2021
1 parent ba07d88 commit 5ba1266
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion srcs/go/kungfu/job/job.go
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"os"
"strconv"
"sync"
"time"

"github.com/lsds/KungFu/srcs/go/kungfu/base"
Expand All @@ -28,6 +29,8 @@ type Job struct {
AllowNVLink bool
}

var warnCudaOption = new(sync.Once)

func (j Job) NewProc(peer plan.PeerID, gpuID int, initClusterVersion int, cluster plan.Cluster) proc.Proc {
envs := proc.Envs{
env.JobStartTimestamp: strconv.FormatInt(j.StartTime.Unix(), 10),
Expand All @@ -47,7 +50,9 @@ func (j Job) NewProc(peer plan.PeerID, gpuID int, initClusterVersion int, cluste
cudaIdx := strconv.Itoa(getCudaIndex(gpuID))
envs[`KUNGFU_`+cudaVisibleDevicesKey] = cudaIdx
if j.AllowNVLink {
log.Warnf("Please set `config.gpu_options.visible_device_list = str(local_rank)`")
warnCudaOption.Do(func() {
log.Warnf("Please set `config.gpu_options.visible_device_list = str(local_rank)`")
})
} else {
envs[cudaVisibleDevicesKey] = cudaIdx
}
Expand Down

0 comments on commit 5ba1266

Please sign in to comment.