caffe icon indicating copy to clipboard operation
caffe copied to clipboard

cuda problem when training the model

Open TingLee91 opened this issue 11 years ago • 41 comments

When I trained a model with googlenet, I always got a strange problem with cuda, the error is "F0505 14:15:54.209436 5318 math_functions.cu:28] Check failed: status == CUBLAS_STATUS_SUCCESS (13 vs. 0) CUBLAS_STATUS_EXECUTION_FAILED", it can also be "F1013 09:33:06.971670 4890 math_functions.cpp:91] Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encountered". I noticed that in the google groupe of caffe users, some people got the same problem but nobody in the groupe knows the reason or how to solve this. Anybody helps me? Tks!

TingLee91 avatar May 05 '15 12:05 TingLee91

Are you on a Maxwell GPU? We've been seeing this occasionally, cause is not yet known.

longjon avatar May 08 '15 01:05 longjon

@longjon I was hit by this issue recently on Amazon EC2 (g2.2xlarge).

$ lspci | grep NVIDIA                                                                                         
00:03.0 VGA compatible controller: NVIDIA Corporation GK104GL [GRID K520] (rev a1)

Only 1 of 2 instances have this problem. I fail to find a difference between them so far.

The troubling instance would sometimes fail with another error:

F0601 20:26:31.249778  1690 math_functions.cu:407] Check failed: status == 
CURAND_STATUS_SUCCESS (201 vs. 0)  CURAND_STATUS_LAUNCH_FAILURE
*** Check failure stack trace: ***

Also

F0601 20:30:14.161443  2897 math_functions.cu:81] Check failed: error == 
cudaSuccess (74 vs. 0)  misaligned address

For the record, I also tried to reset the GPU with:

$ sudo nvidia-smi -r -i 0
GPU 0000:00:03.0 was successfully reset.
All done.

krasin avatar Jun 01 '15 20:06 krasin

More stats: in total, I launched 7 instances (with max 5 running concurrently), and only observed the issue once. It proves that it's not the system image issue. It's more likely that GPU could get into a troubled state, which could not be reset with nvidia-smi or rebooting.

krasin avatar Jun 01 '15 22:06 krasin

I have this exact problem. The GPU is a GTX Titan.

dmaniry avatar Jul 28 '15 11:07 dmaniry

Same problem as @krasin on a g2.2xlarge instance. Followed the tutorial in the wiki here . Whether or not I get a illegal memory access error seems arbitrary. Sometimes it fails instantly, sometimes the net I'm training actually starts up for a couple of seconds...

jayelm avatar Dec 01 '15 19:12 jayelm

I also have this problem, did anyone solve this ?
cuda 7.0 ,GPU is GTX 980 thx!

HeddaZhu avatar Jan 24 '16 08:01 HeddaZhu

I just encountered this issue, in my case this seems due to the use of rectangular kernels into conv layers. Reshaping the kernels into square ones resolved the issue. Note that I also used rectangular kernels for the pooling layers and those work properly

mtamburrano avatar Feb 15 '16 11:02 mtamburrano

I have the similar problem: F0309 11:30:48.307298 892 syncedmem.hpp:19] Check failed: error == cudaSuccess (77 vs. 0) an illegal memory access was encountered *** Check failure stack trace: *** Aborted (core dumped)

When I run demo.py with gpu_id = 0, it is OK. But when I set gpu_id = 1 or 2 or 3(I have 4 gpu), the problem arises.

catsdogone avatar Mar 09 '16 03:03 catsdogone

@catsdogone your solution works for me. Thx

wangdelp avatar Apr 25 '16 17:04 wangdelp

@wangdelp While I find the problem is that I have deleted the line of " cfg.GPU_ID = args.gpu_id" in demo.py because of some fortuitous reasons. I corrected my errors and everything is OK now.

catsdogone avatar May 01 '16 16:05 catsdogone

Just had this problem with my pretty large net on TitanX. Was doing 128 batch. Works fine with batch 64. But it still continues to happen from time to time. Unstable. My autotrainer which should run nonstop gets crashed along the way because of this. Smaller batches seem to help, though.

ibmua avatar May 21 '16 19:05 ibmua

I got this error when running [make runtest] Can confirm this same error on CUDA 7.5 / 367 drivers on Ubuntu 16.04 with a GTX 980 and GTX 1080.

[ RUN ] GPUStochasticPoolingLayerTest/0.TestGradient F0606 15:22:28.586875 3962 math_functions.cu:381] Check failed: status == CURAND_STATUS_SUCCESS (201 vs. 0) CURAND_STATUS_LAUNCH_FAILURE *** Check failure stack trace: *** @ 0x7f90b864e5cd google::LogMessage::Fail() @ 0x7f90b8650433 google::LogMessage::SendToLog() @ 0x7f90b864e15b google::LogMessage::Flush() @ 0x7f90b8650e1e google::LogMessageFatal::~LogMessageFatal() @ 0x7f90b6264a16 caffe::caffe_gpu_rng_uniform<>() @ 0x7f90b629d0bb caffe::PoolingLayer<>::Forward_gpu() @ 0x477a6d caffe::Layer<>::Forward() @ 0x4ed8f4 caffe::GradientChecker<>::CheckGradientSingle() @ 0x782fae caffe::GPUStochasticPoolingLayerTest_TestGradient_Test<>::TestBody() @ 0x90d923 testing::internal::HandleExceptionsInMethodIfSupported<>() @ 0x906f3a testing::Test::Run() @ 0x907088 testing::TestInfo::Run() @ 0x907165 testing::TestCase::Run() @ 0x90843f testing::internal::UnitTestImpl::RunAllTests() @ 0x908763 testing::UnitTest::Run() @ 0x46d04d main @ 0x7f90b5422830 __libc_start_main @ 0x474a39 _start @ (nil) (unknown) Makefile:525: recipe for target 'runtest' failed make: *** [runtest] Aborted (core dumped)

jaredstarkey avatar Jun 06 '16 20:06 jaredstarkey

Removed the GTX980. Here's another trace.

[----------] 3 tests from GPUStochasticPoolingLayerTest/1, where TypeParam = double [ RUN ] GPUStochasticPoolingLayerTest/1.TestStochastic F0606 15:53:56.730144 26116 math_functions.cu:394] Check failed: status == CURAND_STATUS_SUCCESS (201 vs. 0) CURAND_STATUS_LAUNCH_FAILURE *** Check failure stack trace: *** @ 0x7f91781bb5cd google::LogMessage::Fail() @ 0x7f91781bd433 google::LogMessage::SendToLog() @ 0x7f91781bb15b google::LogMessage::Flush() @ 0x7f91781bde1e google::LogMessageFatal::~LogMessageFatal() @ 0x7f9175dd1bc4 caffe::caffe_gpu_rng_uniform<>() @ 0x7f9175e08c8b caffe::PoolingLayer<>::Forward_gpu() @ 0x47779d caffe::Layer<>::Forward() @ 0x781a87 caffe::GPUStochasticPoolingLayerTest_TestStochastic_Test<>::TestBody() @ 0x90d923 testing::internal::HandleExceptionsInMethodIfSupported<>() @ 0x906f3a testing::Test::Run() @ 0x907088 testing::TestInfo::Run() @ 0x907165 testing::TestCase::Run() @ 0x90843f testing::internal::UnitTestImpl::RunAllTests() @ 0x908763 testing::UnitTest::Run() @ 0x46d04d main @ 0x7f9174f8f830 __libc_start_main @ 0x474a39 _start @ (nil) (unknown) Makefile:525: recipe for target 'runtest' failed

jaredstarkey avatar Jun 06 '16 20:06 jaredstarkey

@jaredstarkey if using cuda-8, the problem seems missing from my side.

Darwin2011 avatar Jun 17 '16 06:06 Darwin2011

@jaredstarkey Have you found a solution to the error? I'm getting exactly the same error, also Ubuntu 16.04, CUDA 7.5 but with a GTX1070

jiong3 avatar Sep 04 '16 10:09 jiong3

We ended up building a different system and tried again. Using the install guide, we were able to install no problem and pass the tests. My honest suspicion is that we screwed up the prereqs installation and just needed to clean up our dependencies. We did resolve the issue, but since we were focused on many other things, I can't say what resolved our caffe issues.

jaredstarkey avatar Sep 06 '16 14:09 jaredstarkey

I'm having the same error, with Ubuntu 16.04, CUDA 7.5 and GTX1070.

sbrugman avatar Sep 12 '16 12:09 sbrugman

Download cuda 8.0 it should fix it

Wizardofoddz avatar Sep 15 '16 23:09 Wizardofoddz

I'm having the same error, with Ubuntu 16.04, GTX1070 when running make runtest. I downloaded the the CUDA 8 file and installed it from the nvidia website but when I do nvcc -VI get:

Cuda compilation tools, release 7.5, V7.5.17

Is 7.5 used by default or something and if so how do you change it? - thanks in advance

stig11 avatar Sep 19 '16 16:09 stig11

@stig11 I'd check ~/.bashrc . It looks like you might have a PATH & LD_LIBRARY_PATH to your old CUDA installation of 7.5 (which you might want to uninstall, actually). Make sure you have paths to current installation and don't have to the old one and that you've opened a new terminal after you changed .bashrc

ibmua avatar Sep 19 '16 17:09 ibmua