.bashrc
is only read for interactive shells. Move your commands to set up the environment for CUDA to .profile
instead, which is also read for noninteractive shells (batch jobs/shell scripts).
You can read up about shell initialization files by running info bash
and going to Bash Features, then Bash Startup Files