Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example SimpleWaveODE cannot be compiled #147

Open
xuyumeng opened this issue Sep 10, 2019 · 1 comment
Open

Example SimpleWaveODE cannot be compiled #147

xuyumeng opened this issue Sep 10, 2019 · 1 comment

Comments

@xuyumeng
Copy link

I want to use Kranc to calculate some model contains ODE equation, and I tried the SimpleWaveODE.m. But it cannot pass the build process of Cactus. Below is the error message

Cactus/arrangements/KrancExamples/SimpleWaveODE/src/calc_rhs.cc: In function 'void SimpleWaveODE::calc_rhs_Body(const cGH*, int, int, const CCTK_REAL8*, const CCTK_REAL8*, const CCTK_REAL8*, const int*, const int*, int, CCTK_REAL8* const __restrict__*)':
Cactus/arrangements/KrancExamples/SimpleWaveODE/src/calc_rhs.cc:88:47: error: invalid types 'CCTK_REAL8* const __restrict__ {aka double* const __restrict__}[char*(const char*, int)]' for array subscript
   88 |   CCTK_REAL aL CCTK_ATTRIBUTE_UNUSED = a[index];
      |                                               ^
Cactus/arrangements/KrancExamples/SimpleWaveODE/src/calc_rhs.cc:89:47: error: invalid types 'CCTK_REAL8* const __restrict__ {aka double* const __restrict__}[char*(const char*, int)]' for array subscript
   89 |   CCTK_REAL bL CCTK_ATTRIBUTE_UNUSED = b[index];
      |                                               ^
make[3]: *** [calc_rhs.cc.o] Error 1
@rhaas80
Copy link
Collaborator

rhaas80 commented Sep 10, 2019

This looks to me like there is a function index with prototype

char * index(const char*, int)

in your code that somehow messes up Kranc's use of the name index for a local variable.

Looking at the calc_rhs.cc in Kranc's repo for the SimpleWaveODE example the code seems to be just wrong as it tries to use index in line 88 before it has been properly declared:

    86    /* Assign local copies of arrays functions */
    87
    88    CCTK_REAL aL CCTK_ATTRIBUTE_UNUSED = a[index];
    89    CCTK_REAL bL CCTK_ATTRIBUTE_UNUSED = b[index];
    90
    91    /* Calculate temporaries and arrays functions */
    92    CCTK_REAL arhsL CCTK_ATTRIBUTE_UNUSED = bL;
    93
    94    CCTK_REAL brhsL CCTK_ATTRIBUTE_UNUSED = -aL;

this seems to be bug in the generated code. Re-running SimpleWaveODE.m through Kranc

rm -rf SimpleWaveODE
make SimpleWaveODE

does not fix the issue. So this seems to be a bug in how Kranc generates code for ODEGroups type groups that would seem to try and allow ODEs for simple grid arrays rather than grid functions.

For the example you may just want to remove all mention of the variables a and b and eg replace them both by the value 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants