Why does gpuDevice crash Matlab?

26 次查看(过去 30 天)
Hi,
I'm using gpuDevice(); in the begging of my code. Most of times, my Matlab crashes and I get the following logs:
MATLAB Log File: C:\Users\z585236\AppData\Local\Temp\matlab_crash_dump.16836-1
------------------------------------------------
MATLAB Log File
------------------------------------------------
--------------------------------------------------------------------------------
Invalid handle detected at 2023-03-30 13:34:39 +0200
--------------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : UTF-8
Deployed : false
Graphics Driver : Uninitialized hardware
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce RTX 3050 Ti Laptop GPU Version 31.0.15.2206 (2022-9-27)
Graphics card 2 : Intel Corporation ( 0x8086 ) Intel(R) Iris(R) Xe Graphics Version 30.0.101.1631 (2022-3-3)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 668897
MATLAB Root : C:\Program Files\MATLAB\R2022a
MATLAB Version : 9.12.0.2039608 (R2022a) Update 5
OpenGL : hardware
Operating System : Microsoft Windows 10 Enterprise
Process ID : 16836
Processor ID : x86 Family 6 Model 154 Stepping 3, GenuineIntel
Session Key : ddaa5ca4-1fb4-4213-951a-8b78b08811bd
Window System : Version 10.0 (Build 19044)
Fault Count: 1
Abnormal termination:
Invalid handle
Current Thread: '' id 9712
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000001
RCX = 0000000000000000 RDX = 0000000000000000
RSP = 000000c2ba1ff1b0 RBP = 0000000000000000
RSI = 0000000000000000 RDI = 0000000000000000
R8 = 0000000000000000 R9 = 0000000000000000
R10 = 0000000000000000 R11 = 0000000000000000
R12 = 0000000000000000 R13 = 000000c2c0334000
R14 = 0000022b1fbc5550 R15 = 0000000000000000
RIP = 00007ffa32032856 EFL = 00000206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00007ffa32032856 C:\WINDOWS\SYSTEM32\ntdll.dll+01058902 RtlRaiseStatus+00000054
[ 1] 0x00007ffa31feebb8 C:\WINDOWS\SYSTEM32\ntdll.dll+00781240 memset+00109112
[ 2] 0x00007ffa31f5fcb4 C:\WINDOWS\SYSTEM32\ntdll.dll+00195764 RtlEnterCriticalSection+00000532
[ 3] 0x00007ffa31f5fae2 C:\WINDOWS\SYSTEM32\ntdll.dll+00195298 RtlEnterCriticalSection+00000066
[ 4] 0x00007ff996a0b8cf C:\Program Files (x86)\NVIDIA Corporation\Nsight Visual Studio Edition 2022.3\Monitor\Common\Injection64\Nvda.Cuda.Injection.dll+00440527
[ 5] 0x00007ff996b39bc8 C:\Program Files (x86)\NVIDIA Corporation\Nsight Visual Studio Edition 2022.3\Monitor\Common\Injection64\Nvda.Cuda.Injection.dll+01678280 InitializeInjection+00818200
[ 6] 0x00007ffa31117614 C:\WINDOWS\System32\KERNEL32.dll+00095764 BaseThreadInitThunk+00000020
[ 7] 0x00007ffa31f826a1 C:\WINDOWS\SYSTEM32\ntdll.dll+00337569 RtlUserThreadStart+00000033
Could you please help me with solving this issue?
Moein.

采纳的回答

Moein
Moein 2023-4-28
I contacted matlab technical support department and they gave me the following reply, which seems that has solved the crashing issue:
the Nsight Visual Studio part of this is likely the culprit. Can you please check the following environment variables: CUDA_INJECTION32_PATH and CUDA_INJECTION64_PATH and disable them if they are currently set then retry?

更多回答(1 个)

Animesh
Animesh 2023-4-4
Hi,
gpuDevice() is a command in MATLAB that is used to initialize and select a GPU device for performing computations on a GPU. If your MATLAB crashes when you use gpuDevice(), it could be due to a number of reasons:
  1. Compatibility issues: gpuDevice() is not compatible with all versions of MATLAB or all GPUs. Make sure that you are using a version of MATLAB that supports gpuDevice() and that your GPU is supported by MATLAB.
  2. Memory allocation issues: GPUs have limited memory, and if you try to allocate more memory than what is available on the GPU, it can cause MATLAB to crash. Make sure that you are allocating the right amount of memory for your computations.
  3. Driver issues: Make sure that you have the latest GPU drivers installed on your system. Outdated drivers can cause compatibility issues with MATLAB and lead to crashes.
  4. Hardware issues: If your GPU is faulty or overheating, it can cause MATLAB to crash. Check your GPU's temperature and ensure that it is properly cooled.
To debug this issue, you can try the following:
  1. Run gpuDevice() with different MATLAB versions or on a different computer to see if the issue persists.
  2. Check the amount of memory you are allocating and try to reduce it.
  3. Check if there are any driver updates available for your GPU and install them.
  4. Monitor the temperature of your GPU and ensure that it is properly cooled.
  1 个评论
Moein
Moein 2023-4-12
1- I have a GPU on my office PC, and therefore, not crashing in other systems does not help me, unfortuntaly.
2- I'm using this command right in the begining of my code (clc, clear , close all; gpuDevice();). So, no memory has been allocated yet.
3- No update available.
4- no significant temperature rais was observed when i use my GPU.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Parallel and Cloud 的更多信息

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by