4

when I want to debug program with nsight this message show: "Value cannot be null. Parameter name: pSrcNativeVariant". when i rebuild project this error not shown. but i must perform this action repeatedly for debug program. previously this action Not required.

error message

this is my code:

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

#include <stdio.h>
#include <iostream>
using namespace std;


#define COLUMNS 3
#define ROWS 2

__global__ void add(int *a, int *b, int *c)
{
*a=345678;
int x = blockIdx.x;
int y = blockIdx.y;
int i = (COLUMNS*y) + x;
c[i] = a[i] + b[i];
}

int main()
{
int a[ROWS][COLUMNS], b[ROWS][COLUMNS], c[ROWS][COLUMNS];
int *dev_a, *dev_b, *dev_c;
int *x;
int r;
x=&r;
cudaMalloc((void **) &dev_a, ROWS*COLUMNS*sizeof(int));
cudaMalloc((void **) &dev_b, ROWS*COLUMNS*sizeof(int));
cudaMalloc((void **) &dev_c, ROWS*COLUMNS*sizeof(int));

for (int y = 0; y < ROWS; y++)    // Fill Arrays
    for (int x = 0; x < COLUMNS; x++)
    {
        a[y][x] = x;
        b[y][x] = y;
    }

    cudaMemcpy(dev_a, a, ROWS*COLUMNS*sizeof(int), 
        cudaMemcpyHostToDevice);
    cudaMemcpy(dev_b, b, ROWS*COLUMNS*sizeof(int), 
        cudaMemcpyHostToDevice);
    dim3 grid(COLUMNS,ROWS);

    add<<<grid,1>>>(dev_a, dev_b, dev_c);

    cudaMemcpy(c, dev_c, ROWS*COLUMNS*sizeof(int), 
        cudaMemcpyDeviceToHost);
    for (int y = 0; y < ROWS; y++)    // Output Arrays
    {
        for (int x = 0; x < COLUMNS; x++)
        {
            printf("[%d][%d]=%d ",y,x,c[y][x]);
        }
        printf("\n");
    }
    return 0;
}
mahdimb
  • 139
  • 1
  • 4
  • 11
  • post your code where pSrcNativeVariant included. – BizApps Apr 02 '13 at 06:05
  • Is `pSrcNativeVariant` give in as a reference and not as a pointer? Because references must have a value and cannot be null. – hubs Apr 02 '13 at 06:10
  • @BizApps: pSrcNativeVariant aren't in my code. i posted my code but this error shown with each cuda program. – mahdimb Apr 02 '13 at 06:27
  • It is related to .net What sort of project are you building? – Robert Crovella Apr 02 '13 at 21:14
  • when i select solution explorer window, nvidia nsight work correctly. but when i move mouse cursor to code window and select it nsight show this error. i upload a video of my problem in here: – mahdimb Apr 07 '13 at 18:28
  • http://www.herosh.com/download/11123201/cuda.flv.html – mahdimb Apr 07 '13 at 18:56
  • @Robert Crovella: i don't know your question meant. – mahdimb Apr 07 '13 at 19:08
  • I meant in visual studio, you can build various different kinds of projects (e.g. win32 console app, etc.) What kind of project do you have selected? If it is a type of project that includes .net, then that is where pSrcNativeVariant is coming from. In particular you may want to look at project differences between the release version and the debug version in terms of what is getting built or included, to see if the debug version includes any .net modules. – Robert Crovella Apr 07 '13 at 19:37
  • i uploud a video that show what is kind of my project and include files: http://www.herosh.com/download/11124295/cuda3.swf.html – mahdimb Apr 09 '13 at 07:32

2 Answers2

2

I encountered exactly the same problem. After trying many things, I found this problem could be simply solved by just running the visual studio in the administration mode once. Under the admin mode, run the nsight debugger, then the problem is solved. Admin mode is not required later. At least this works for me, good luck to you.

Added on May 12, 2014: This problem happened again today. This time I solved it by switching the platform from Win32 to X64 then switch back

Added on May 22, 2014: It happens again and everything I tried before did not work this time. Finally it is solved in this way:

I fixed this by deleting the visual studio solution user options file (.suo).

NuGet Package restore failed for project Miscellaneous Files: Value cannot be null or an empty string. Parameter name: root. 0 0

Community
  • 1
  • 1
0

It is a problem with the NuGet package. Solution:

  1. Update it if it is out-of-date(restart).
  2. Uninstall and reinstall(restart).
  3. Open the "Package Manager Console", which is under "Tools/NuGet Package Manager/Package Manager Console", type any command to make sure it works.

The problem should be solved.

Jiahui Guo
  • 135
  • 2
  • 10