Skip to content

add cudaGetLastError() in mallocBest #4

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();

}

}`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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