20641, "stonea", "Use of outside variable (unexpectedly) gpuizes and fails later in codegen when 'CHPL_COMM=gasnet'", "2022-09-06T23:33:59Z"
The following errors out in an unexpected way when using CHP_COMM=gasnet
:
use GPU;
var globalVar = 42;
proc usesOutsideVar() { return globalVar; }
on here.gpus[0] {
foreach i in 0..10 {
assertOnGpu();
usesOutsideVar();
}
}
foo.chpl:1: In module 'foo':
foo.chpl:3: error: Could not find C variable globalVar_chpl - perhaps it is a complex macro?
+ ./foo -nl 1
This is somewhat confusing as I would have expected the loop to fail to gpuize since it calls a function that uses an outside (global) variable. This is what happens when CHPL_COMM=none
.
Even more fun this doesn't produce a non-zero error code (see: Erroring in gpu fork of compilation does not result in us returning a non-zero error code for chpl · Issue #20639 · chapel-lang/chapel · GitHub).