CUDA.NET Launch Error

Hi NVIDIA Forum,

iam using CUDA.NET.

I have a Problem with the code. But i dont know why it doesnt work. On my Notebook it works fine, but on the desktop it crashes when i call the launch function.

I my notebook i have a geforce gt330m und in the desktop there is a gtx480.

It would be greatful if someone can help me.

Here is my code:

Program.cs

using System;

using System.Collections.Generic;

using System.Text;

using GASS.CUDA;

using GASS.CUDA.Types;

using System.IO;

namespace bitonic

{

	class Program

	{

		static void Main(string[] args)

		{

			const int NUM = 256;

			// Init CUDA, select 1st device.

			CUDA cuda = new CUDA(0, true);

			// create values

			int[] values = new int[NUM];

			for (int i = 0; i < NUM; i++)

			{

				values[i] = i;

			}

			// allocate memory and copy to device

			CUdeviceptr dvalues = cuda.CopyHostToDevice<int>(values);

			// load module

			cuda.LoadModule(Path.Combine(Environment.CurrentDirectory, "test.cubin"));

			CUfunction func = cuda.GetModuleFunction("square");

			cuda.SetParameter(func, 0, (uint)dvalues.Pointer);

			cuda.SetParameterSize(func, (uint)IntPtr.Size);

			//square<<<1, NUM, sizeof(int) * NUM>>>(dvalues);

			cuda.SetFunctionBlockShape(func, NUM, 1, 1);

			cuda.SetFunctionSharedSize(func, sizeof(int) * NUM);

			cuda.Launch(func, 1, 1);

			//Test doesnt work too

			//cuda.Launch(func);

			cuda.CopyDeviceToHost<int>(dvalues, values);

			cuda.Free(dvalues);

			for (int i = 0; i < NUM; i++)

			{

				Console.WriteLine(values[i]);

			}

			Console.Read();

		}

	}

}

test.cu

extern "C" __global__ void square(int * values)

{

	int NUM = 256;

	int tid = threadIdx.x;

	if(tid < NUM)

	{

		values[tid] = values[tid] * values[tid];

	}

}

The error comes when i call "cuda.Launch(func, 1, 1); with the Exception GASS.CUDA.CUResult.ErrorLaunchOutOfResources.

I run my compiler with this postbuildcomand “C:\Program Files (x86)\NVIDIA GPU Computing Toolkit\CUDA\v3.1\bin\nvcc.exe” test.cu -arch=sm_20 --cubin -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin”.

Thanks for your help in advance

greetz

markus

Hi NVIDIA Forum,

iam using CUDA.NET.

I have a Problem with the code. But i dont know why it doesnt work. On my Notebook it works fine, but on the desktop it crashes when i call the launch function.

I my notebook i have a geforce gt330m und in the desktop there is a gtx480.

It would be greatful if someone can help me.

Here is my code:

Program.cs

using System;

using System.Collections.Generic;

using System.Text;

using GASS.CUDA;

using GASS.CUDA.Types;

using System.IO;

namespace bitonic

{

	class Program

	{

		static void Main(string[] args)

		{

			const int NUM = 256;

			// Init CUDA, select 1st device.

			CUDA cuda = new CUDA(0, true);

			// create values

			int[] values = new int[NUM];

			for (int i = 0; i < NUM; i++)

			{

				values[i] = i;

			}

			// allocate memory and copy to device

			CUdeviceptr dvalues = cuda.CopyHostToDevice<int>(values);

			// load module

			cuda.LoadModule(Path.Combine(Environment.CurrentDirectory, "test.cubin"));

			CUfunction func = cuda.GetModuleFunction("square");

			cuda.SetParameter(func, 0, (uint)dvalues.Pointer);

			cuda.SetParameterSize(func, (uint)IntPtr.Size);

			//square<<<1, NUM, sizeof(int) * NUM>>>(dvalues);

			cuda.SetFunctionBlockShape(func, NUM, 1, 1);

			cuda.SetFunctionSharedSize(func, sizeof(int) * NUM);

			cuda.Launch(func, 1, 1);

			//Test doesnt work too

			//cuda.Launch(func);

			cuda.CopyDeviceToHost<int>(dvalues, values);

			cuda.Free(dvalues);

			for (int i = 0; i < NUM; i++)

			{

				Console.WriteLine(values[i]);

			}

			Console.Read();

		}

	}

}

test.cu

extern "C" __global__ void square(int * values)

{

	int NUM = 256;

	int tid = threadIdx.x;

	if(tid < NUM)

	{

		values[tid] = values[tid] * values[tid];

	}

}

The error comes when i call "cuda.Launch(func, 1, 1); with the Exception GASS.CUDA.CUResult.ErrorLaunchOutOfResources.

I run my compiler with this postbuildcomand “C:\Program Files (x86)\NVIDIA GPU Computing Toolkit\CUDA\v3.1\bin\nvcc.exe” test.cu -arch=sm_20 --cubin -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin”.

Thanks for your help in advance

greetz

markus