Help! Exception? I have no idea why it throws an Exception

So here’s the code:

I have no clue on why does it throw an Exception? I use the EmuDebug mode. Anyone? Thanks!

You have not allocated memory for “device_result”. Thats the reason. Since this is in emu mode, you could just use malloc()

Do a cudaThreadSynchronize() towards the end so that the main thread waits for things to complete…