I'll proceed as if that was implemented on top of cuda, I have no idea if that is actually the case, but for the sake of argument.
That code does not initialize the library, instead the handle is stored as a global variable that is lazily initialized when using thrust methods. This makes it easier to use but has some drawbacks too. It can not use more than one card at once. It means every call will check if library is initialized safer but slower. Resources are not freed as soon as possible. A good trade off in the majority of cases.
A device vector is created and assigned a value in one call. Size is automatically tracked. Nice.
Errors are not handled. All code looks cleaner if you don't handle errors.
That code does not initialize the library, instead the handle is stored as a global variable that is lazily initialized when using thrust methods. This makes it easier to use but has some drawbacks too. It can not use more than one card at once. It means every call will check if library is initialized safer but slower. Resources are not freed as soon as possible. A good trade off in the majority of cases.
A device vector is created and assigned a value in one call. Size is automatically tracked. Nice.
Errors are not handled. All code looks cleaner if you don't handle errors.