[Chapel Merge] Adjust Makefiles + chplenv + compiler to use prope

Branch: refs/heads/main
Revision: 3f10855
Author: e-kayrakli
Log Message:

Merge pull request #18329 from e-kayrakli/gpu-makefiles

Adjust Makefiles + chplenv + compiler to use proper flags for CUDA

This PR aims to avoid passing bunch of flags at compile line for GPU
compilations. The part that this avoids is:

-L<path to CUDA library> -lcuda --ccflags --cuda-gpu-arch=sm_60

Specifically:

  • Adds --gpu-arch compiler flag that defaults to sm_60. This is the value we
    pass to --cuda-gpu-arch when we invoke clang for gpu codegen.
    • We also use this value to generate the compute_ flag.
  • Adds util/chplenv/chpl_gpu.py to compute the CUDA library path.
    • This script checks CHPL_CUDA_PATH first, if it doesn't exist, it uses
      which nvcc to compute the path to CUDA installation.
  • Adds runtime/etc/Makefile.locale-gpu and -include this from
    runtime/etc/Makefile.include. This file sets GEN_LFLAGS to contain the
    CUDA library path (computed by chpl_gpu.py) and -lcuda
  • Adjusts the runtime Makefiles to use the CHPL_[MAKE]_CUDA_PATH while
    building the runtime.

While there:

  • Adds --warn-unstable warning for GPU support.
  • Fixes a bug with using --savec automatically, where the new behavior is to
    use the process id if the user doesn't provide -o.
  • Enables --no-checks implicitly and outputs a warning about it.
  • Adds new tests, adjusts existing COMPOPTS files.
  • Removes require -lcudart from the LocaleModel code.

[Reviewed by @mppf and @gbtitus]

Test:

  • [x] gpu/native

  • [x] make + make check on different systems/configs

  • [x] standard

    Modified Files:
    A runtime/etc/Makefile.locModel-gpu
    A test/gpu/native/jacobi/flags-no-checks.good
    A test/gpu/native/jacobi/flags-warn-unstable.good
    A test/gpu/native/jacobi/flags.chpl
    A test/gpu/native/jacobi/flags.compopts
    A util/chplenv/chpl_gpu.py
    R test/gpu/native/gpuAddNums/gpuAddNums.compopts
    R test/gpu/native/gpuAddNums/gpuAddNums_primitive.compopts
    R test/gpu/native/jacobi/jacobi.compopts
    R test/gpu/native/memory/COMPOPTS
    R test/gpu/native/threadBlockAndGridPrimitives.compopts
    M compiler/include/driver.h
    M compiler/llvm/clangUtil.cpp
    M compiler/main/driver.cpp
    M modules/internal/localeModels/gpu/LocaleModel.chpl
    M runtime/etc/Makefile.include
    M runtime/make/Makefile.runtime.include
    M test/gpu/native/gpuAddNums/gpuAddNums.good
    M test/gpu/native/gpuAddNums/gpuAddNums_primitive.good
    M test/gpu/native/jacobi/jacobi.good
    M test/gpu/native/llvmIntrinsicAttributes/llvmIntrinsicAttributes.compopts
    M test/gpu/native/memory/basic.good
    M test/gpu/native/streamPrototype/COMPOPTS
    M test/gpu/native/streamPrototype/stream.compopts
    M test/gpu/native/threadBlockAndGridPrimitives.good
    M util/chpl-completion.bash
    M util/chplenv/chplenv.py
    M util/chplenv/printchplenv.py

    Compare: Comparing 6eb858a29adb...3f1085581a5d · chapel-lang/chapel · GitHub