Memory allocation in __half (FP16)

Why I am not able to allocate memory? I think it correct but I am seeing an error:


        int size_x=2048;
        __half  *dX=NULL;
        cudaMalloc(&dX, size_x*sizeof(__half));
        if (  dX == NULL ) {
                printf("Malloc error\n");
        }


The error is:

Malloc error

Also I ahve tryed this:

cudaMalloc((void**)&dX, size_x*sizeof(__half));

A same problem.

what happens if you use proper cuda error checking?

I have checket it with MAGMA, MAGMA_ERR_DEVICE_ALLOC

cannot allocate memory on GPU device (info = -113)

It seems that the problem is related to the previus line:

magmablas_dtranspose( nb, m-j, dAT(j,j), lddat, dAP(0,0), maxm, queues[1] );

Because the Malloc is working fine before magmablas_dtranspose. But the program befor extention adn allocating new memory was working fine.

Here is how dAP and dAT are alocatating.


        if (MAGMA_SUCCESS != magma_dmalloc( &dAP, nb*maxm )) {
             *info = MAGMA_ERR_DEVICE_ALLOC;
             goto cleanup;
        }

             if (MAGMA_SUCCESS != magma_dmalloc( &dAT, lddat*maxm )) {
                 *info = MAGMA_ERR_DEVICE_ALLOC;
                 goto cleanup;
}

The nature of CUDA is that if you perform an operation that corrupts the CUDA context, then every subsequent API call will fail. That is what you are running into, it seems/my guess. The error has nothing to do with the allocation request itself.

If you’re unwilling to follow my suggestion, I probably won’t be able to help. Good luck!