27128, "jabraham17", "[Bug]: GPU compilation breaks when a binary file named 'array' is in the current directory", "2025-04-18T22:26:23Z"
I am finding that GPU compilation completely breaks if a binary file named array
exists in the same directory that the chpl
compiler is invoked from.
The following sequence of commands demonstrates the issue
> ls
array
> pwd
/here
> chpl $CHPL_HOME/test/release/examples/gpu/hello-gpu.chpl
# ERROR OCCURS
> cd other-dir && pwd
/here/other-dir
> chpl $CHPL_HOME/test/release/examples/gpu/hello-gpu.chpl
# This works fine
The error seems to come from inside the cuda/cub headers, where there is a bare include for array
. Since the current include path includes the current directory (we exlicitly pass -I.
), it seems the compiler tries to pick up the array
thats there, instead of the standard C++ header array
.
I get the following error
In file included from //chapel/runtime/etc/rtmain.c:24:
In file included from //chapel/runtime/include/stdchpl.h:79:
In file included from //chapel/runtime/include/gpu/nvidia/chpl-gpu-gen-includes.h:26:
In file included from //chapel/runtime/include/gpu/nvidia/../chpl-gpu-gen-common.h:31:
In file included from //chapel/runtime/include/gpu/nvidia/chpl-gpu-dev-reduce.h:26:
In file included from /usr/local/cuda-11.8/include/cub/cub.cuh:43:
In file included from /usr/local/cuda-11.8/include/cub/block/block_load.cuh:40:
In file included from /usr/local/cuda-11.8/include/cub/block/../iterator/cache_modified_input_iterator.cuh:42:
In file included from /usr/local/cuda-11.8/include/cub/block/../iterator/../util_device.cuh:46:
./array:1:1: error: expected unqualified-id
1 | <U+007F>ELF<U+0002><U+0001><U+000
Removing the binary array
file causes the issue to go away.
I only tested with CUDA 11, so its possible this is only an issue with CUDA 11 and not 12, but I haven't tested that.
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: clang --gcc-install-dir=/usr/lib64/gcc/x86_64-suse-linux/7
CHPL_TARGET_CXX: clang++ --gcc-install-dir=/usr/lib64/gcc/x86_64-suse-linux/7
CHPL_TARGET_LD: clang++ --gcc-install-dir=/usr/lib64/gcc/x86_64-suse-linux/7
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native *
CHPL_LOCALE_MODEL: gpu *
CHPL_GPU: nvidia *
CHPL_GPU_SDK_VERSION: 11.8
CHPL_GPU_MEM_STRATEGY: array_on_device
CHPL_COMM: none *
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none *
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_HOST_MEM: jemalloc
CHPL_HOST_JEMALLOC: bundled
CHPL_TARGET_MEM: jemalloc
CHPL_TARGET_JEMALLOC: bundled
CHPL_ATOMICS: cstdlib
CHPL_GMP: bundled
CHPL_HWLOC: bundled
CHPL_HWLOC_PCI: enable
CHPL_RE2: bundled
CHPL_LLVM: system
CHPL_LLVM_SUPPORT: system
CHPL_LLVM_CONFIG: ..../llvm-config *
CHPL_LLVM_VERSION: 20
CHPL_AUX_FILESYS: none
CHPL_LIB_PIC: none
CHPL_SANITIZE: none
CHPL_SANITIZE_EXE: none