Skip to content

add cudaGetLastError() in mallocBest #4

@wei-tan

Description

@wei-tan

Such at the code can return the last error that has been produced by any of the runtime calls in the same host thread and resets it to cudaSuccess.
https://www.cs.cmu.edu/afs/cs/academic/class/15668-s11/www/cuda-doc/html/group__CUDART__ERROR_g0a933755a73d874d0d7051a3eb2aa533.html

If not, very subsequent cudaCheckLastError() will get a failure message.

`cudaError_t mallocBest ( void **devPtr, size_t size ) {

cudaError_t returnVal = cudaSuccess;

if (cudaMalloc(devPtr, size) != cudaSuccess) {

    cudaGetLastError();

}

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions