...
Code Block |
---|
int a = 0; int x = 0; // 1 finish { async IN(a) OUT(x) { // compute something x = someValue; // 2 } // here 'x' has an undetermined value could // be either the value x from 1 or x from 2 } // here 'x' contains the value computed in the async |
Referencing Internal HC Values Without ROSE Generated HC Code
It's possible with certain function/macro calls to reference the HC worker state even though you aren't in a valid HC program. I ran into this in some HCMPI code compiled with hcc when trying to call
Code Block |
---|
HCMPI_Comm_rank
HCMPI_Comm_size |
which reference the fields comm_rank and comm_size in the HC worker state. However, I got segfaults because no HC worker state existed as hcc had not generated any of the necessary code using ROSE. I solved this by adding a dummy finish scope in the program, indicating to the compiler that this was indeed HC code. hcc then correctly produced the auto-generated code for initializing the HC state.