cudaMallocArray returns null pointer...

Here’s my test code:

#include <stdio.h>

#include <cuda.h>

#include <cutil.h>

int main(int argc, char **argv)

{

    CUT_DEVICE_INIT(argc,argv);

   cudaChannelFormatDesc d1_desc = cudaCreateChannelDesc<float>(); 

   cudaArray *d1=0;

    CUDA_SAFE_CALL(cudaMallocArray(&d1, &d1_desc, 512, 512)); 

   if (d1==NULL)

        printf("NULL POINTER!!!");

   CUDA_SAFE_CALL(cudaFreeArray(d1)); 

   CUT_EXIT(argc, argv);

}

The problem is cudaMallocArray isn’t setting d1 to anything, it comes back out as a null pointer…

I check the SDK samples, and all FAILED, if it use cudaMallocArray…

OS: winxp sp2

GPU: 9600 GT

forceware: 175.16

Cuda: 2.0 beta

I installed CUDA 1.1 (Toolkit and SDK), and everything works fine.

I think this is a bug in the beta.

well, your code definitely does not fail with cuda 1.1, OpenSuSE 10.2 (32 and 64bit), 8600GT or 8800GTX. Sorry, I don’t have cuda2 installed at this time. Try downgrading, if it still fails for you, then the error must be somewhere in your setup.

Drivers: 169.09 on the 64bit box with the 8800gtx in it, and 177.10 on a 32bit box with the 8600GT.

Edit: Seems we had the same idea :)

I have the same problem with Beta 2.0. I guess the solution is to uninstall and reinstall 1.1.

Run the deviceQuery SDK sample. It will likely report that no device is detected.

The usual cause of this is that cuda library was not installed with the driver or you have the wrong driver for the CUDA version you are using. For CUDA 1.1, re-install the latest driver available at www.nvidia.com. For CUDA 2.0, you must install the driver specifically for the beta.

If you are on linux and installing the drivers through your OS’s package manager, it may not be installing the cuda library. Search the forums for some previous solutions to this problem for particular linux distributions.