[Chapel Merge] Add checks to gpuSort for calls from wrong locale

Branch: refs/heads/main
Revision: 81b77ab12380c77e26aa44b82e5b7a1041a4d97d
Author: ShreyasKhandekar
Link: Add checks to gpuSort for calls from wrong locale by ShreyasKhandekar · Pull Request #25192 · chapel-lang/chapel · GitHub
Log Message:
Add checks to gpuSort for calls from wrong locale (#25192)

Resolves #24806

A user had requested better error messages when gpuSort is called on
an array which lives outside of the GPU.
This adds checks to make sure that gpuSort is only called on an array
from the GPU on which it lives. This error triggers even if gpuSort is
called from the wrong GPU (ex gpu1 when the array is on gpu0)

Once we have distributed arrays for GPUs, we will want to come back and
revisit this check.

Adds tests as well

[Reviewed by @vasslitvinov , thanks! ]

Compare: Comparing 57c5b877a2bd435ffd19f3f0f85047e6f1218153...4746830b6f8f47554c60b60bccb36ad8bdedceae · chapel-lang/chapel · GitHub

Diff:
M modules/standard/GPU.chpl
A test/gpu/native/studies/sort/nonGpuError.chpl
A test/gpu/native/studies/sort/nonGpuError.good
A test/gpu/native/studies/sort/nonGpuError2.chpl
A test/gpu/native/studies/sort/nonGpuError2.good
A test/gpu/native/studies/sort/nonGpuError2.prediff
A test/gpu/native/studies/sort/wrongGpuError.chpl
A test/gpu/native/studies/sort/wrongGpuError.good
A test/gpu/native/studies/sort/wrongGpuError.prediff
https://github.com/chapel-lang/chapel/pull/25192.diff