[Chapel Merge] Improve environments scripts for better CUDA path

Branch: refs/heads/main
Revision: 098549f
Author: e-kayrakli
Link: Unavailable
Log Message:

Merge pull request #20377 from e-kayrakli/gpu-better-cuda-path

Improve environments scripts for better CUDA path handling

@hokiegeek2 reported some issues with compiling applications with the GPU locale
model, even though build was successful.

The issue was that which nvcc was returning non-normal path resulting in us
looking for libdevice in all the wrong places. We should be able to do better
when that happens. This PR:

  • normalizes the path returned by which nvcc
  • errors if we cannot find libdevice in the path we want at printchplenv
    (today, we just get an "" which we try to open and link at makeBinary time
    resulting in a segfault)
  • now that we have a stricter checking, GPU environment scripts try to do
    something only with the gpu locale model

[Reviewed by @stonea]

Test: