Problem with cuModuleLoadDataEx

Hello,

I’m using the driver API in C#. When compiling my CUDA code I use the following command line options:

-keep -o -arch sm_11 -v -ptx -o -O -use_fast_math -m32

and for 64 bit

-keep -o -arch sm_11 -v -ptx -o -O -use_fast_math -m64

Then I get my PTX file which I can load. Formerly I have used the same using the -cubin option and everything worked fine.

For a colleague I had to switch to ptx code and installed a tesla C2050.

Now I’m having trouble with a lot of things. First, I want to do the following

CUjit_option[] aOptions = new CUjit_option[]

                    {

                        CUjit_option.CU_JIT_TARGET

                    };

IntPtr[] aOptionValues = new IntPtr[]

                    {

                        new IntPtr((int)CUjit_target.CU_TARGET_COMPUTE_13)

                    };

if (aOptions.Length != aOptionValues.Length)

                    {

                        throw new ArgumentOutOfRangeException("");

                    }

CUDA.Assert(CUDADriverAPI.cuModuleLoadDataEx(

                                    ref InternalHandle,

                                    aGcHandle.AddrOfPinnedObject(),

                                    (uint)aOptions.Length,

                                    aOptions,

                                    aOptionValues

                                    ));

Here I get an error: CUDA_ERROR_INVALID_SOURCE. If I use compute capability 2.0 it works!

Then I’m having trouble using the cuLaunchKernel method, where it seems that the pointers are not transferred correctly using the “kernelParams” parameter but also here I get errors.

The error here happens when I want to transfer a device pointer (which is - I hope 64bit on 64bit machines and 32bit on 32bit machines).

Thanks for your help

Martin

Hello,

I’m using the driver API in C#. When compiling my CUDA code I use the following command line options:

-keep -o -arch sm_11 -v -ptx -o -O -use_fast_math -m32

and for 64 bit

-keep -o -arch sm_11 -v -ptx -o -O -use_fast_math -m64

Then I get my PTX file which I can load. Formerly I have used the same using the -cubin option and everything worked fine.

For a colleague I had to switch to ptx code and installed a tesla C2050.

Now I’m having trouble with a lot of things. First, I want to do the following

CUjit_option[] aOptions = new CUjit_option[]

                    {

                        CUjit_option.CU_JIT_TARGET

                    };

IntPtr[] aOptionValues = new IntPtr[]

                    {

                        new IntPtr((int)CUjit_target.CU_TARGET_COMPUTE_13)

                    };

if (aOptions.Length != aOptionValues.Length)

                    {

                        throw new ArgumentOutOfRangeException("");

                    }

CUDA.Assert(CUDADriverAPI.cuModuleLoadDataEx(

                                    ref InternalHandle,

                                    aGcHandle.AddrOfPinnedObject(),

                                    (uint)aOptions.Length,

                                    aOptions,

                                    aOptionValues

                                    ));

Here I get an error: CUDA_ERROR_INVALID_SOURCE. If I use compute capability 2.0 it works!

Then I’m having trouble using the cuLaunchKernel method, where it seems that the pointers are not transferred correctly using the “kernelParams” parameter but also here I get errors.

The error here happens when I want to transfer a device pointer (which is - I hope 64bit on 64bit machines and 32bit on 32bit machines).

Thanks for your help

Martin