caffe icon indicating copy to clipboard operation
caffe copied to clipboard

How to set use one GPU

Open tjusxh opened this issue 11 years ago • 12 comments

When I training my data. I come across segment error.I doubt imagenet use two GPU default.So I want to set one GPU. How to do it?

tjusxh avatar Dec 19 '14 07:12 tjusxh

I think you should define solver.prototxt like this : solver_mode:GPU and device_id:1 good luck :)

ZhiyuTan88 avatar Dec 19 '14 07:12 ZhiyuTan88

@Stewarttzy Thanks,But It doesn't work. If I don't execute right. I1219 15:59:41.169323 36602 caffe.cpp:99] Use GPU with device ID 1 F1219 15:59:41.175240 36602 common.cpp:137] Check failed: error == cudaSuccess (10 vs. 0) invalid device ordinal *** Check failure stack trace: ***

tjusxh avatar Dec 19 '14 08:12 tjusxh

Check if your Cuda is working or not. You can check it by running device query inside the Cuda. If your cuda is running, there may be permissive problem. Hence, if you are in Linux platform use "Sudo"... Cheers!!

Prasanna1991 avatar Dec 19 '14 08:12 Prasanna1991

you can first check the GPU that can available by "nvidia-smi", then you will know the "available idx" , and set "device_id:available idx"

ZhiyuTan88 avatar Dec 19 '14 08:12 ZhiyuTan88

@Stewarttzy Thanks,According you said. I input the 'nvidia-smi'.The output as following.Which is The "available idx"? +------------------------------------------------------+
| NVIDIA-SMI 340.29 Driver Version: 340.29 |
|-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce GTX TIT... Off | 0000:05:00.0 N/A | N/A | | 26% 26C P8 N/A / N/A | 40MiB / 6143MiB | N/A Default | +-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+ | Compute processes: GPU Memory | | GPU PID Process name Usage | |=============================================================================| | 0 Not Supported | +-----------------------------------------------------------------------------+

tjusxh avatar Dec 19 '14 08:12 tjusxh

@Stewarttzy I know the id.Thanks very much. But I do the experiment. Segment error exists.When I use cpu. There is no the question.Could you help me? *** Aborted at 1418979043 (unix time) try "date -d @1418979043" if you are using GNU date *** PC: @ 0x7f119c5f3e74 (unknown) *** SIGSEGV (@0x0) received by PID 37741 (TID 0x7f11b44829c0) from PID 0; stack trace: *** @ 0x7f11b3017340 (unknown) @ 0x7f119c5f3e74 (unknown) @ 0x7f119c61819d (unknown) @ 0x7f119c5f50a9 (unknown) @ 0x7f119c605d0d (unknown) @ 0x7f119c5e8472 (unknown) @ 0x7f119c5639f5 (unknown) @ 0x7f119c563a86 (unknown) @ 0x7f119c53056a (unknown) @ 0x7f11b324b9d4 (unknown) @ 0x7f11b32306af (unknown) @ 0x7f11b3256a75 (unknown) @ 0x51aa69 caffe::caffe_gpu_set<>() @ 0x53d71c caffe::ConvolutionLayer<>::Backward_gpu() @ 0x4797ac caffe::Net<>::BackwardFromTo() @ 0x4a72d7 caffe::Solver<>::Solve() @ 0x4164b2 train() @ 0x4104c1 main @ 0x7f11ab428ec5 (unknown) @ 0x414ee7 (unknown) segment error.

tjusxh avatar Dec 19 '14 08:12 tjusxh

To overcome the following error F1219 15:59:41.175240 36602 common.cpp:137] Check failed: error == cudaSuccess (10 vs. 0) invalid device ordinal please set the following parameter in the python code. caffe.set_device(0)

santle avatar Jul 14 '16 10:07 santle

I have the proble when i run :python examples/ssd/ssd_pascal.py
I solve the problem by vim examples/ssd/ssd_pascal.py modify

332 gpus = "0"

westeast avatar Dec 07 '16 06:12 westeast

Check the file you are executing. There might be a value 'gpu = 0,1,2,3,4'. Change that to 'gpu = 0'.

This worked for me.

dm0288 avatar Jan 21 '17 06:01 dm0288

That solves the problem to me too

Bardo91 avatar May 23 '17 14:05 Bardo91

vim examples/ssd/ssd_pascal.py modify is really working for me

ibeilinGX avatar Aug 15 '17 03:08 ibeilinGX

If you are running make runtest, and encountered this problem,
you can change the GPU id in Makefile.config. Or you can try to run export CUDA_VISIBLE_DEVICES=0 before you run the make runtest.

zhixuanli avatar May 25 '18 07:05 zhixuanli