CuArrays: error calling CuArray() (ERROR_INVALID_DEVICE)

Thanks for your immediate reply @maleadt! Calling CUDAnative.device!(0) gives the same error:

julia> using CUDAnative, CUDAdrv, CuArrays

julia> CUDAnative.device!(0)
ERROR: CUDA error: invalid device ordinal (code #101, ERROR_INVALID_DEVICE)
Stacktrace:
 [1] macro expansion at /users/omlins/.julia/packages/CUDAdrv/LC5XS/src/base.jl:147 [inlined]
 [2] CuContext(::CuDevice, ::CUDAdrv.CUctx_flags) at /users/omlins/.julia/packages/CUDAdrv/LC5XS/src/context.jl:112
 [3] Type at /users/omlins/.julia/packages/CUDAdrv/LC5XS/src/context.jl:111 [inlined]
 [4] device!(::CuDevice) at /users/omlins/.julia/packages/CUDAnative/AGfq2/src/init.jl:68
 [5] device!(::Int64) at /users/omlins/.julia/packages/CUDAnative/AGfq2/src/init.jl:75
 [6] top-level scope at none:0

However, for some reason, calling CUDAdrv.CuDevice(0) solves the problem for the call to CuArrays.CuArray() (but not for the call to CUDAnative.device!()):

julia> using CUDAnative, CUDAdrv, CuArrays

julia> CUDAdrv.CuDevice(0)
CuDevice(0): Tesla P100-PCIE-16GB

julia> CUDAnative.device!(0)
ERROR: CUDA error: invalid device ordinal (code #101, ERROR_INVALID_DEVICE)
Stacktrace:
 [1] macro expansion at /users/omlins/.julia/packages/CUDAdrv/LC5XS/src/base.jl:147 [inlined]
 [2] CuContext(::CuDevice, ::CUDAdrv.CUctx_flags) at /users/omlins/.julia/packages/CUDAdrv/LC5XS/src/context.jl:112
 [3] Type at /users/omlins/.julia/packages/CUDAdrv/LC5XS/src/context.jl:111 [inlined]
 [4] device!(::CuDevice) at /users/omlins/.julia/packages/CUDAnative/AGfq2/src/init.jl:68
 [5] device!(::Int64) at /users/omlins/.julia/packages/CUDAnative/AGfq2/src/init.jl:75
 [6] top-level scope at none:0

julia> B = ones(10_000) ./ 2;

julia> cuB = CuArrays.CuArray(B);

julia>