Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
151 views
in Technique[技术] by (71.8m points)

CUDA NSIGHT: Display driver stopped responding when nsight is launched

I have this simple routine for dynamic global memory allocation:

#include "cuda_runtime.h"
#include "device_launch_parameters.h"

#include <stdio.h>
 #include <stdlib.h>

__global__ void mallocTest()
{
    __shared__ int* data;

    int t=threadIdx.x;
    // The first thread in the block does the allocation and then
    // shares the pointer with all other threads through shared memory,
    // so that access can easily be coalesced.
    // 64 bytes per thread are allocated.
    if (t == 0) {
        size_t size = blockDim.x * 64;
        data = (int*)malloc(size);
    }
    __syncthreads();

    // Check for failure
    if (data == NULL)
        return;
    
    // Threads index into the memory, ensuring coalescence
    int* ptr = data;
    for (int i = 0; i < 64; ++i)
        ptr[i * blockDim.x + t] = t;
    printf("Thread %d got pointer: %p
", t, ptr);


    // Ensure all threads complete before freeing 
    __syncthreads();

    // Only one thread may free the memory!
    if (t  == 0)
        free(data);
}

int main()
{
    cudaDeviceSetLimit(cudaLimitMallocHeapSize, 128*1024*1024);
    mallocTest<<<1, 64>>>();
    cudaDeviceSynchronize();
    return 0;
}

It runs fine in both debug and release modes. But When I try to debug it after putting some breakpoints using NSIGHT, it fails. Basically the monitor switches off for few seconds then recover. Please see the following screenshot: enter image description here

My system info: Windows 7, MSVS2010, CUDA 8.0, GT640 CC 3.0

question from:https://stackoverflow.com/questions/65600197/cuda-nsight-display-driver-stopped-responding-when-nsight-is-launched

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...