From 43536289bd770f7bd29ce407361d78601b9ff2f0 Mon Sep 17 00:00:00 2001 From: Pavel Grunt Date: Tue, 14 Aug 2018 15:22:08 +0200 Subject: [PATCH] python: Set gpu device id before setting gpu mode Otherwise caffe allocates some memory on GPU#0 --- docs/tutorial/interfaces.md | 2 +- python/train.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/interfaces.md b/docs/tutorial/interfaces.md index b5a4f1ad069..2578af5d4de 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 5897f5dcb90..14a38b8cef1 100644 --- a/python/train.py +++ b/python/train.py @@ -63,8 +63,8 @@ def show_time(): 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)