My eGPU is detected using nvidia-smi but not running

The first GPU is integrated to the laptop is working fine and I can run simulation on it but the second one is showing GPU memory usage 4MiB all the time.
How can I switch between the two ?
I have tried

export CUDA_VISIBLE_DEVICES=1

But it seems not working.

Screenshot from 2023-03-10 13-59-16

Please post the output of the deviceQuery sample.

It says:

./deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

You installed an incompatible cuda-toolkit. With your current driver, you can only use cuda-toolkit 11.7 maximum.
What kind of simulations/applications are you trying to run?

It is tricky to find the right combination between cuda and driver versions when you have to use “open” nvidia drivers and fewer versions of cuda compatible with ubuntu 22.04. So if I have to use 11.7 max then it is the only version I can use!

I’m running simulations using gazebo and opencv code with cuda support.