# Cannot make gpu-enabled chapel

**URL:** <https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046>\
**Category:** Users\
**Created:** [September 6, 2024, 5:39pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046 "2024-09-06T17:39:47Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 6, 2024, 5:39pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/1 "2024-09-06T17:39:47Z")

</div>

Hello. I am trying to make a gpu-enabled runtime. I am running linux mint 22; clang is 18.1.3; llvm is 18.1.3 (as far as I can tell). setchplenv.bash has 3 additional lines at the end:  
export CHPL\_LLVM=system  
export CHPL\_LOCALE\_MODEL=gpu  
export CHPL\_GPU=nvidia

adding or deleting  
export CHPL\_CUDA\_PATH=/usr/lib/cuda

does not seem to make a difference. Everything works fine almost to the end, when make fails with

In file included from :1:  
In file included from /usr/lib/llvm-18/lib/clang/18/include/\_\_clang\_cuda\_runtime\_wrapper.h:41:  
/usr/lib/llvm-18/lib/clang/18/include/cuda\_wrappers/cmath:27:15: fatal error: 'cmath' file not found  
27 | #include\_next   
| ^ ~~~~~~  
1 error generated when compiling for sm\_60.  
make[6]: \*\*\* [Makefile.share:38: ../../../../build/runtime/linux64/llvm/x86\_64/cpu-native/loc-gpu/gpu-nvidia/gpu\_mem-array\_on\_device/comm-none/tasks-qthreads/tmr-generic/unwind-none/mem-jemalloc/atomics-cstdlib/hwloc-bundled/re2-none/fs-none/lib\_pic-none/san-none/src/gpu/nvidia/gpu-nvidia-cub.o] Error 1  
make[5]: \*\*\* [../../make/Makefile.runtime.foot:29: nvidia.makedir] Error 2  
make[4]: \*\*\* [../make/Makefile.runtime.foot:29: gpu.makedir] Error 2  
make[3]: \*\*\* [make/Makefile.runtime.foot:29: src.makedir] Error 2  
make[2]: \*\*\* [Makefile:49: all.helpme] Error 2  
make[1]: \*\*\* [Makefile:107: runtime] Error 2  
make: \*\*\* [Makefile:70: comprt] Error 2

I wonder if anyone has any suggestion to have make succeed?

Regards

Nelson

---

<div class="post-metadata">

**Author:** ![e-kayrakli](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/e-kayrakli/32/134_2.png) [@e-kayrakli](https://chapel.discourse.group/u/e-kayrakli)\
**Post date:** [September 6, 2024, 5:53pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/2 "2024-09-06T17:53:30Z")

</div>

Hi Nelson,

Not an answer, but what do you get when you run `printchplenv --all --internal --anonymize`?

Do you know if your system LLVM has support for targeting NVIDIA GPUs? `printchplenv` should check for it and fail if that's not the case. And looking at the output it does have some sort of CUDA support..

Engin

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 6, 2024, 6:40pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/3 "2024-09-06T18:40:09Z")

</div>

Hi Engin! without setting /usr/lib/cuda, right after sourcing setchplenv.bash and _before_ saying make, I get

Error: Can't find libdevice. Please make sure your CHPL\_CUDA\_PATH is set such that CHPL\_CUDA\_PATH/nvmm/libdevice/libdevice\*.bc exists. To avoid this issue, you can have GPU code run on the CPU by setting 'CHPL\_GPU=cpu'. To turn this error into a warning set CHPLENV\_GPU\_REQ\_ERRS\_AS\_WARNINGS.

If I set CHPL\_CUDA\_PATH: /usr/lib/cuda, i get a long list:  
CHPL\_HOST\_PLATFORM: linux64  
CHPL\_HOST\_COMPILER: gnu  
CHPL\_HOST\_CC: gcc  
CHPL\_HOST\_CXX: g++  
CHPL\_HOST\_BUNDLED\_COMPILE\_ARGS: -DHAVE\_LLVM -I/home/nldias/Downloads/chapel-2.1.0/third-party/jemalloc/install/host/linux64-x86\_64-gnu/include  
CHPL\_HOST\_SYSTEM\_COMPILE\_ARGS: -fno-rtti -I/usr/lib/llvm-18/include -std=c++17 -fno-exceptions -funwind-tables -D\_GNU\_SOURCE -D\_\_STDC\_CONSTANT\_MACROS -D\_\_STDC\_FORMAT\_MACROS -D\_\_STDC\_LIMIT\_MACROS  
CHPL\_HOST\_BUNDLED\_LINK\_ARGS: -L/home/nldias/Downloads/chapel-2.1.0/third-party/jemalloc/install/host/linux64-x86\_64-gnu/lib -ljemalloc  
CHPL\_HOST\_SYSTEM\_LINK\_ARGS: -lclang-cpp -L/usr/lib/llvm-18/lib -Wl,-rpath,/usr/lib/llvm-18/lib -L/usr/lib/llvm-18/lib -lLLVM-18 -lm -lpthread  
CHPL\_HOST\_ARCH: x86\_64  
CHPL\_HOST\_CPU: none  
CHPL\_TARGET\_PLATFORM: linux64  
CHPL\_TARGET\_COMPILER: llvm  
CHPL\_TARGET\_CC: /usr/lib/llvm-18/bin/clang  
CHPL\_TARGET\_CXX: /usr/lib/llvm-18/bin/clang++  
CHPL\_TARGET\_COMPILER\_PRGENV: none  
CHPL\_TARGET\_BUNDLED\_COMPILE\_ARGS: -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/localeModels/gpu -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/localeModels -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/comm/none -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/comm -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/tasks/qthreads -I/home/nldias/Downloads/chapel-2.1.0/runtime/include -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/qio -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/atomics/cstdlib -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/mem/jemalloc -I/home/nldias/Downloads/chapel-2.1.0/third-party/utf8-decoder -DHAS\_GPU\_LOCALE -I/home/nldias/Downloads/chapel-2.1.0/runtime/include/gpu/nvidia -DCHPL\_JEMALLOC\_PREFIX=chpl\_je\_ -I/home/nldias/Downloads/chapel-2.1.0/third-party/gmp/install/linux64-x86\_64-native-llvm-none/include -I/home/nldias/Downloads/chapel-2.1.0/third-party/hwloc/install/linux64-x86\_64-native-llvm-none-gpu/include -I/home/nldias/Downloads/chapel-2.1.0/third-party/qthread/install/linux64-x86\_64-native-llvm-none-gpu-jemalloc-bundled/include -I/home/nldias/Downloads/chapel-2.1.0/third-party/jemalloc/install/target/linux64-x86\_64-native-llvm-none/include  
CHPL\_TARGET\_SYSTEM\_COMPILE\_ARGS: -I/usr/lib/cuda/include -D\_\_STRICT\_ANSI\_\_=1  
CHPL\_TARGET\_LD: /usr/lib/llvm-18/bin/clang++  
CHPL\_TARGET\_BUNDLED\_LINK\_ARGS: -L/home/nldias/Downloads/chapel-2.1.0/lib/linux64/llvm/x86\_64/cpu-native/loc-gpu/gpu-nvidia/gpu\_mem-array\_on\_device/comm-none/tasks-qthreads/tmr-generic/unwind-none/mem-jemalloc/atomics-cstdlib/hwloc-bundled/re2-none/fs-none/lib\_pic-none/san-none -lchpl -L/home/nldias/Downloads/chapel-2.1.0/third-party/gmp/install/linux64-x86\_64-native-llvm-none/lib -lgmp -Wl,-rpath,/home/nldias/Downloads/chapel-2.1.0/third-party/gmp/install/linux64-x86\_64-native-llvm-none/lib -L/home/nldias/Downloads/chapel-2.1.0/third-party/qthread/install/linux64-x86\_64-native-llvm-none-gpu-jemalloc-bundled/lib -Wl,-rpath,/home/nldias/Downloads/chapel-2.1.0/third-party/qthread/install/linux64-x86\_64-native-llvm-none-gpu-jemalloc-bundled/lib -lqthread -L/home/nldias/Downloads/chapel-2.1.0/third-party/jemalloc/install/target/linux64-x86\_64-native-llvm-none/lib -ljemalloc  
CHPL\_TARGET\_SYSTEM\_LINK\_ARGS: -L/usr/lib/cuda/lib64 -lcudart -lcuda -lm -lpthread  
CHPL\_TARGET\_ARCH: x86\_64  
CHPL\_TARGET\_CPU: native  
CHPL\_RUNTIME\_CPU: native  
CHPL\_TARGET\_CPU\_FLAG: arch  
CHPL\_TARGET\_BACKEND\_CPU: native  
CHPL\_LOCALE\_MODEL: gpu \*  
CHPL\_GPU: nvidia \*  
CHPL\_GPU\_ARCH: sm\_60  
CHPL\_GPU\_MEM\_STRATEGY: array\_on\_device  
CHPL\_CUDA\_PATH: /usr/lib/cuda \*  
CHPL\_CUDA\_LIBDEVICE\_PATH: /usr/lib/cuda/nvvm/libdevice/libdevice.10.bc  
CHPL\_COMM: none  
CHPL\_TASKS: qthreads  
CHPL\_LAUNCHER: none  
CHPL\_TIMERS: generic  
CHPL\_UNWIND: none  
CHPL\_HOST\_MEM: jemalloc  
CHPL\_HOST\_JEMALLOC: bundled  
CHPL\_MEM: jemalloc  
CHPL\_TARGET\_MEM: jemalloc  
CHPL\_TARGET\_JEMALLOC: bundled  
CHPL\_MAKE: gmake  
CHPL\_ATOMICS: cstdlib  
CHPL\_GMP: bundled  
CHPL\_GMP\_IS\_OVERRIDDEN: False  
CHPL\_HWLOC: bundled  
CHPL\_RE2: none  
CHPL\_RE2\_IS\_OVERRIDDEN: False  
CHPL\_LLVM: system \*  
CHPL\_LLVM\_SUPPORT: system  
CHPL\_LLVM\_CONFIG: llvm-config-18  
CHPL\_LLVM\_VERSION: 18  
CHPL\_LLVM\_CLANG\_C: /usr/lib/llvm-18/bin/clang  
CHPL\_LLVM\_CLANG\_CXX: /usr/lib/llvm-18/bin/clang++  
CHPL\_LLVM\_STATIC\_DYNAMIC: dynamic  
CHPL\_LLVM\_TARGET\_CPU: native  
CHPL\_AUX\_FILESYS: none  
CHPL\_LIB\_PIC: none  
CHPL\_SANITIZE: none  
CHPL\_SANITIZE\_EXE: none  
CHPL\_RUNTIME\_SUBDIR: linux64/llvm/x86\_64/cpu-native/loc-gpu/gpu-nvidia/gpu\_mem-array\_on\_device/comm-none/tasks-qthreads/tmr-generic/unwind-none/mem-jemalloc/atomics-cstdlib/hwloc-bundled/re2-none/fs-none/lib\_pic-none/san-none  
CHPL\_LAUNCHER\_SUBDIR: linux64/gnu/x86\_64/loc-gpu/comm-none/tasks-qthreads/launch-none/tmr-generic/unwind-none/mem-jemalloc/atomics-cstdlib/lib\_pic-none/san-none  
CHPL\_COMPILER\_SUBDIR: linux64/gnu/x86\_64/hostmem-jemalloc/llvm-system/18/san-none  
CHPL\_HOST\_BIN\_SUBDIR: linux64-x86\_64  
CHPL\_TARGET\_BIN\_SUBDIR: linux64-x86\_64-native  
CHPL\_SYS\_MODULES\_SUBDIR: linux64-x86\_64-llvm  
CHPL\_LLVM\_UNIQ\_CFG\_PATH: system  
CHPL\_GASNET\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none/substrate-none/seg-none  
CHPL\_GMP\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none  
CHPL\_HWLOC\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none-gpu  
CHPL\_HOST\_JEMALLOC\_UNIQ\_CFG\_PATH: host/linux64-x86\_64-gnu  
CHPL\_TARGET\_JEMALLOC\_UNIQ\_CFG\_PATH: target/linux64-x86\_64-native-llvm-none  
CHPL\_LIBFABRIC\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none  
CHPL\_LIBUNWIND\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none  
CHPL\_QTHREAD\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none-gpu-jemalloc-bundled  
CHPL\_RE2\_UNIQ\_CFG\_PATH: linux64-x86\_64-native-llvm-none  
CHPL\_PE\_CHPL\_PKGCONFIG\_LIBS:

---

<div class="post-metadata">

**Author:** ![e-kayrakli](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/e-kayrakli/32/134_2.png) [@e-kayrakli](https://chapel.discourse.group/u/e-kayrakli)\
**Post date:** [September 6, 2024, 9:28pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/4 "2024-09-06T21:28:40Z")

</div>

Your setup looks quite similar to mine (except that I have a manual CUDA install, but I don't see why that matters).

I don't see anything wrong in that config by reading through it. One thing that would be good to make sure is correct is `libclang-18-dev` That package is a prerequisite for Chapel and if it was missing it should have been caught by the scripts. But could something with that package have gone wrong? Could you see if you can reinstall it?

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 6, 2024, 9:55pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/5 "2024-09-06T21:55:22Z")

</div>

I think that clang18 is selecting g++14, but the system compiler is 14.  
Previously a workaround was installing libstd++12-dev for clang to work  
with gcc11 (!) but this no longer works. I am trying llvm=bundled now

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 6, 2024, 9:55pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/6 "2024-09-06T21:55:49Z")

</div>

I mean the system compiler is 23

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 6, 2024, 9:56pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/7 "2024-09-06T21:56:08Z")

</div>

Sorry 13

---

<div class="post-metadata">

**Author:** ![e-kayrakli](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/e-kayrakli/32/134_2.png) [@e-kayrakli](https://chapel.discourse.group/u/e-kayrakli)\
**Post date:** [September 6, 2024, 10:05pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/8 "2024-09-06T22:05:08Z")

</div>

Ah, that's a good observation and I think I am familiar with similar issues. Unfortunately, clang is hard-wired to pick the newest libc++ in a given path. Please keep us posted how it goes with the bundled LLVM.

Engin

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 8, 2024, 3:23pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/9 "2024-09-08T15:23:20Z")

</div>

Here is the upshot of trying to make chapel 2.1 + gpu support on linx mint 22:

There is an unsolvable incompatibility between Clang and gcc. The current gcc version is 13, and Clang is 18. However, many packages including emacs-gtk depend on libgcc-14-dev. If the latter is removed from the system, make succeeds with gpu support. However, as soon as libgcc-14-dev is re-introduced (by re-installing emacs, for example), the compiler ceases to work. The only choice seems to revert to linux mint 21.3. I tried to upgrade gcc to 14, but it didn't work. I hope this info can save a lot of hours trying to make gpu-enabled Chapel: at this point it seems better to use slightly older distributions.

Cheers Nelson

---

<div class="post-metadata">

**Author:** ![e-kayrakli](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/e-kayrakli/32/134_2.png) [@e-kayrakli](https://chapel.discourse.group/u/e-kayrakli)\
**Post date:** [September 9, 2024, 9:18pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/10 "2024-09-09T21:18:51Z")

</div>

Thanks for that summary Nelson. This has to do with several flags `clang` uses to determine which GCC installation to use to find the standard C/C++ headers.

@mppf has a PR up that will add a new environment variable to have better control over that that we believe can help you: [Add CHPL\_LLVM\_GCC\_INSTALL\_DIR as an alternative to CHPL\_LLVM\_GCC\_PREFIX by mppf · Pull Request #25913 · chapel-lang/chapel · GitHub](https://github.com/chapel-lang/chapel/pull/25913). With that PR, you should be able to set `CHPL_LLVM_GCC_INSTALL_DIR` to point to your gcc 13 installation to avoid the issue you were facing. We are getting close to the 2.2 release and want to add this feature to the new release. Would you be interested in giving the patch a try if you are using the upstream, by any chance? (I am seeing that the diff on that patch merges cleanly on 2.1.0 as well, but can't be sure if there are any logical conflicts)

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 10, 2024, 12:11pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/11 "2024-09-10T12:11:06Z")

</div>

Hi Engin: sure things. Please send over the patch with a few instructions.  
I will do my best 🙂

Cheers

Nelson

---

<div class="post-metadata">

**Author:** ![mppf](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mppf](https://chapel.discourse.group/u/mppf)\
**Post date:** [September 10, 2024, 1:43pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/12 "2024-09-10T13:43:19Z")

</div>

Hi Nelson -

It looks like you are using 2.1. If it were me, I would test the patch by trying it on a clone of Chapel (because it makes it easier to keep track of whether you have patched the sources / what version you have). If you wait a bit (until my PR is merged, later today), you can make a clone with `git clone https://github.com/chapel-lang/chapel` and then you can bring that up to date now or in the future with `git pull`.

### Patching

If you want to try to patch 2.1, you can try that now. Save the following to a file, say `patch.txt`:

```Chapel
diff --git a/util/chplenv/chpl_llvm.py b/util/chplenv/chpl_llvm.py
index c29da81c40..7f898b5adf 100755
--- a/util/chplenv/chpl_llvm.py
+++ b/util/chplenv/chpl_llvm.py
@@ -649,7 +649,7 @@ def llvm_enabled():
     return False
 
 @memoize
-def get_gcc_prefix():
+def get_gcc_prefix_dir():
     gcc_prefix = overrides.get('CHPL_LLVM_GCC_PREFIX', '')
 
     # allow CHPL_LLVM_GCC_PREFIX=none to disable inferring it
@@ -710,6 +710,12 @@ def get_gcc_prefix():
 
     return gcc_prefix
 
+@memoize
+def get_gcc_install_dir():
+ gcc_dir = overrides.get('CHPL_LLVM_GCC_INSTALL_DIR', '')
+
+ return gcc_dir
+
 
 # The bundled LLVM does not currently know to look in a particular Mac OS X SDK
 # so we provide a -isysroot arg to indicate which is used.
@@ -808,9 +814,13 @@ def get_system_llvm_built_sdkroot():
 def get_clang_basic_args():
     clang_args = []
 
- gcc_prefix = get_gcc_prefix()
- if gcc_prefix:
- clang_args.append('--gcc-toolchain=' + gcc_prefix)
+ gcc_install_dir = get_gcc_install_dir();
+ if gcc_install_dir:
+ clang_args.append('--gcc-install-dir=' + gcc_install_dir)
+ else:
+ gcc_prefix = get_gcc_prefix_dir()
+ if gcc_prefix:
+ clang_args.append('--gcc-toolchain=' + gcc_prefix)
 
     sysroot_args = get_sysroot_resource_dir_args()
     if sysroot_args:

```

Then, `cd` to your `chapel-2.1.0` directory and then run `patch -p1 < patch.txt`.

### Using the patch

To understand what to set `CHPL_LLVM_GCC_INSTALL_DIR` to, try a test compile:

- `echo 'int main() { return 0; }' > hello.cc`
- `clang++ -v hello.cc`

This will print out lines along these lines:

```
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
  Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14
  Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/14

```

The paths printed here are suitable for use with `CHPL_LLVM_GCC_INSTALL_DIR`. Since you want to use GCC 13 (since it is the system default), you should pick that one.

For me, it amounts to doing

```
export CHPL_LLVM_GCC_INSTALL_DIR=/usr/bin/../lib/gcc/x86_64-linux-gnu/13

```

You can check if all of this is working by running `printchplenv --all`. You should see `CHPL_TARGET_CC` / `CHPL_TARGET_CXX` / `CHPL_TARGET_LD` lines that include `--gcc-install-dir` options with the path you have selected.

For me:

```
./util/printchplenv --all

```

```Chapel
 machine info: Linux iris 6.8.0-44-generic #44-Ubuntu SMP PREEMPT_DYNAMIC Tue Aug 13 13:35:26 UTC 2024 x86_64
CHPL_HOME: /home/mppf/chapel-old-versions/chapel-2.1.0
script location: /home/mppf/chapel-old-versions/chapel-2.1.0/util/chplenv
CHPL_HOST_PLATFORM: linux64
CHPL_HOST_COMPILER: gnu
  CHPL_HOST_CC: gcc
  CHPL_HOST_CXX: g++
CHPL_HOST_ARCH: x86_64
CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: llvm
  CHPL_TARGET_CC: /usr/lib/llvm-18/bin/clang --gcc-install-dir=/usr/bin/../lib/gcc/x86_64-linux-gnu/13
  CHPL_TARGET_CXX: /usr/lib/llvm-18/bin/clang++ --gcc-install-dir=/usr/bin/../lib/gcc/x86_64-linux-gnu/13
  CHPL_TARGET_LD: /usr/lib/llvm-18/bin/clang++ --gcc-install-dir=/usr/bin/../lib/gcc/x86_64-linux-gnu/13
...

```

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 10, 2024, 2:06pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/13 "2024-09-10T14:06:58Z")

</div>

Hi Michael!

Many thanks for the info on patching. I will try it as soon as I can. One  
question. The last line of the patch  
is

if sysroot\_args:

is there not a clause to this last if?

cheers

Nelson

---

<div class="post-metadata">

**Author:** ![mppf](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mppf](https://chapel.discourse.group/u/mppf)\
**Post date:** [September 10, 2024, 2:13pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/14 "2024-09-10T14:13:03Z")

</div>

Hi Nelson -

> [@nelsonluisdias](#):
>
> is there not a clause to this last if?

Yes there is, in the source file. The way that patch files work is that any line beginning with `+` is a line to be added added; any line beginning with `-` is a line to be removed, and any other line is context for the patch program, so that it can figure out where to make the changes. So, the rest of the `if sysroot_args:` should be in the source code, but it isn't important for the patch program itself.

If you inspect the file after patching it, you should see well-formed source code that includes mentions of `--gcc-install-dir` and `CHPL_LLVM_GCC_INSTALL_DIR`. (And you shouldn't get errors from Python about bad code, either).

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 10, 2024, 2:18pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/15 "2024-09-10T14:18:01Z")

</div>

I see! Thanks.

---

<div class="post-metadata">

**Author:** ![nelsonluisdias](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/nelsonluisdias/32/691_2.png) [@nelsonluisdias](https://chapel.discourse.group/u/nelsonluisdias)\
**Post date:** [September 10, 2024, 2:31pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/16 "2024-09-10T14:31:10Z")

</div>

Hi Michael and Engin,

I am happy to report that now (after the patch) make finishes without  
problems, and that I can compile a sample program (one of mine)  
and that everything works fine.

Many thanks for the fast turnaround!

Best regards

Nelson

---

<div class="post-metadata">

**Author:** ![mppf](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@mppf](https://chapel.discourse.group/u/mppf)\
**Post date:** [September 10, 2024, 3:06pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/17 "2024-09-10T15:06:41Z")

</div>

Great news! Thanks for trying it. We should have this mechanism available in 2.2 (to be released later this month).

---

<div class="post-metadata">

**Author:** ![e-kayrakli](https://yyz2.discourse-cdn.com/free1/user_avatar/chapel.discourse.group/e-kayrakli/32/134_2.png) [@e-kayrakli](https://chapel.discourse.group/u/e-kayrakli)\
**Post date:** [September 10, 2024, 3:58pm UTC](https://chapel.discourse.group/t/cannot-make-gpu-enabled-chapel/37046/18 "2024-09-10T15:58:02Z")

</div>

Thanks for the report and checking the patch, Nelson! Thanks Michael for the quick fix!

Engin
