kunzmi / ImageStackAlignator

Implementation of Google's Handheld Multi-Frame Super-Resolution algorithm (from Pixel 3 and Pixel 4 camera)
GNU General Public License v3.0
392 stars 65 forks source link

Exception unhandled with ManagedCuda #2

Closed mm93v closed 4 years ago

mm93v commented 4 years ago

Hi,

I build the three projects successfully and generate each ptx file in the correct location but it shows exception thrown as follows when I execute it

System.NullReferenceException: 'Object reference not set to an instance of an object.'

at ImageStackAlignatorController.cs, line 1004 CUmodule modDebayer = _ctx.LoadModulePTX("DeBayerKernels.ptx");

and output:

Exception thrown: 'ManagedCuda.CudaException' in ManagedCuda.dll
'PEFStudioDX.exe' (CLR v4.0.30319: PEFStudioDX.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Remote Debugger\x64\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. 
Exception thrown: 'System.NullReferenceException' in PEFStudioDX.exe
An unhandled exception of type 'System.NullReferenceException' occurred in PEFStudioDX.exe
Object reference not set to an instance of an object. 

is it seems load ptx file failed?

(I'm developing in visual studio 2019 and CUDA toolkit 10.1 with .NET framework 4.7.2)

kunzmi commented 4 years ago

It sounds like that the CudaContext (_ctx) is null. The context is created during startup inside the DirectX-Control that's supposed to show the images. Apparently this creation fails and WPF catches the exception. You should see some message on the console in VisualStudio, though. Can it be that you have two video cards? One for the screen, one for Cuda?

mm93v commented 4 years ago

You are right! I have two graphics cards, Intel Graphics 630 for display and RTX 2080 MaxQ for CUDA. How do I specify 2080 as the main card while executing the project?

Thank you in advance.

mm93v commented 4 years ago

Hi, I switch to GPU mode in my boot configuration and it works.

Thank you!

JianWang-CMU commented 4 years ago

I have the same problem. How do I "switch to GPU mode in the boot configuration"? Thanks!

mm93v commented 4 years ago

Hi, if you are using the Nvidia graphic card, you can follow the steps below.

  1. On your desktop right-click and select "NVIDIA Control Panel"
  2. click "Manage 3D settings"
  3. On "global settings" select your graphic card
JianWang-CMU commented 4 years ago

Thanks! It works now!