summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Grunt <pavel.grunt@innovatrics.com>2018-08-14 15:22:08 +0200
committerWook Song <wook16.song@samsung.com>2020-01-23 22:53:35 +0900
commitda526ea3ec39889d1069567d39f383b570a1e25a (patch)
tree8dc249816d490e0c9e827eb0947784211e3f7221
parent34bcf358c299efae4f1d9415d525b28a45c29dda (diff)
downloadcaffe-da526ea3ec39889d1069567d39f383b570a1e25a.tar.gz
caffe-da526ea3ec39889d1069567d39f383b570a1e25a.tar.bz2
caffe-da526ea3ec39889d1069567d39f383b570a1e25a.zip
python: Set gpu device id before setting gpu mode
Otherwise caffe allocates some memory on GPU#0
-rw-r--r--docs/tutorial/interfaces.md2
-rw-r--r--python/train.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/docs/tutorial/interfaces.md b/docs/tutorial/interfaces.md
index b5a4f1ad..2578af5d 100644
--- a/docs/tutorial/interfaces.md
+++ b/docs/tutorial/interfaces.md
@@ -129,8 +129,8 @@ Use CPU:
Use GPU and specify its gpu_id:
- caffe.set_mode_gpu();
caffe.set_device(gpu_id);
+ caffe.set_mode_gpu();
#### Create a network and access its layers and blobs
diff --git a/python/train.py b/python/train.py
index 5897f5dc..14a38b8c 100644
--- a/python/train.py
+++ b/python/train.py
@@ -63,8 +63,8 @@ def time(solver, nccl):
def solve(proto, snapshot, gpus, timing, uid, rank):
- caffe.set_mode_gpu()
caffe.set_device(gpus[rank])
+ caffe.set_mode_gpu()
caffe.set_solver_count(len(gpus))
caffe.set_solver_rank(rank)
caffe.set_multiprocess(True)