Skip to content

Commit 99bd997

Browse files
authored
Merge pull request BVLC#6499 from xerus/python_gpu
python: Set gpu device id before setting gpu mode
2 parents 128797e + 4353628 commit 99bd997

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/tutorial/interfaces.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ Use CPU:
129129

130130
Use GPU and specify its gpu_id:
131131

132-
caffe.set_mode_gpu();
133132
caffe.set_device(gpu_id);
133+
caffe.set_mode_gpu();
134134

135135
#### Create a network and access its layers and blobs
136136

python/train.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def show_time():
6363

6464

6565
def solve(proto, snapshot, gpus, timing, uid, rank):
66-
caffe.set_mode_gpu()
6766
caffe.set_device(gpus[rank])
67+
caffe.set_mode_gpu()
6868
caffe.set_solver_count(len(gpus))
6969
caffe.set_solver_rank(rank)
7070
caffe.set_multiprocess(True)

0 commit comments

Comments
 (0)