That depends on your platform and how you execute Julia.
On Linux you just do CUDA_VISIBLE_DEVICES=1 julia in your shell.
CUDA_VISIBLE_DEVICES=1 julia