cudaSetDevice should be called prior all other Cuda API calls,
because before cudaSetDevice all activity happens with regards to the context
of the default device (0). For example, if memory is allocated,
it is allocated on the default device, and won't be available
after cudaSetDevice(i) call (if i != 0).
cudaSetDevice should be called prior all other Cuda API calls, because before cudaSetDevice all activity happens with regards to the context of the default device (0). For example, if memory is allocated, it is allocated on the default device, and won't be available after cudaSetDevice(i) call (if i != 0).