CUDA Driver Version / Runtime Version 9.1 / 8.0 graphics output crashes, non graphic is ok

Hello

i have installed two gtx580 cards and cuda 8 on my linux pc. Kernel is 5.0.0.
i cant go to a newer cuda version because i need sm_2 for my cards.
nvidia driver is 390.116. (nouveau is blacklisted)

When i compile the cuda 8 examples with gcc-4.9.4 it compiles without errors (exept the warning that sm_2 wont be supported in the future) and all non-graphic samples are working ok with the exceptions of those programs that do graphical output. A window opens and quickly closes witout graphical output.

for example:

mma@arnie:/usr/local/cuda/samples/2_Graphics/bindlessTexture> ./bindlessTexture
CUDA bindlessTexture Starting…

CUDA error at bindlessTexture.cpp:242 code=30(cudaErrorUnknown) “cudaGraphicsGLRegisterBuffer(&cuda_pbo_resource, pbo, cudaGraphicsMapFlagsWriteDiscard)”

or

[CUDA Mandelbrot/Julia Set] - Starting…
Device 0: < GeForce GTX 580 >, Compute SM 2.0 detected
GPU Device 0: “GeForce GTX 580” with compute capability 2.0

Data initialization done.
Initializing GLUT…
OpenGL window created.
Creating GL texture…
Texture created.
Creating PBO…
CUDA error at Mandelbrot.cpp:978 code=46(cudaErrorDevicesUnavailable) “cudaGraphicsGLRegisterBuffer(&cuda_pbo_resource, gl_PBO, cudaGraphicsMapFlagsWriteDiscard)”

device query gives me:

/deviceQuery Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 2 CUDA Capable device(s)

Device 0: “GeForce GTX 580”
CUDA Driver Version / Runtime Version 9.1 / 8.0
CUDA Capability Major/Minor version number: 2.0
Total amount of global memory: 1474 MBytes (1545863168 bytes)
(16) Multiprocessors, ( 32) CUDA Cores/MP: 512 CUDA Cores
GPU Max Clock rate: 1544 MHz (1.54 GHz)
Memory Clock rate: 2004 Mhz
Memory Bus Width: 384-bit
L2 Cache Size: 786432 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 3 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

Device 1: “GeForce GTX 580”
CUDA Driver Version / Runtime Version 9.1 / 8.0
CUDA Capability Major/Minor version number: 2.0
Total amount of global memory: 1474 MBytes (1546125312 bytes)
(16) Multiprocessors, ( 32) CUDA Cores/MP: 512 CUDA Cores
GPU Max Clock rate: 1544 MHz (1.54 GHz)
Memory Clock rate: 2004 Mhz
Memory Bus Width: 384-bit
L2 Cache Size: 786432 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 32768
Warp size: 32
Maximum number of threads per multiprocessor: 1536
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: No
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 5 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

Peer access from GeForce GTX 580 (GPU0) → GeForce GTX 580 (GPU1) : Yes
Peer access from GeForce GTX 580 (GPU1) → GeForce GTX 580 (GPU0) : Yes

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 8.0, NumDevs = 2, Device0 = GeForce GTX 580, Device1 = GeForce GTX 580
Result = PASS

as told above programs without graphical output are working. so please can somebody give me an advice where the error is?. i would like to start with cuda programming without buying a new pc or nvidia card :-(

Thanks for helping

regards Michael

nvidia-bug-report.log.gz (573 KB)

I myself found the solution. I only had to recompile the kernel and link it with the nvidia stuff