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

CalculiX + precice with PaStiX solver (pastix.c and pastix.h) #57

Closed
3rav opened this issue Apr 7, 2021 · 5 comments
Closed

CalculiX + precice with PaStiX solver (pastix.c and pastix.h) #57

3rav opened this issue Apr 7, 2021 · 5 comments
Assignees

Comments

@3rav
Copy link

3rav commented Apr 7, 2021

Attempting to compile CalculiX + precice adapter with PaStiX solver ends with an error:

C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:18:35: error: unknown type name 'ITG'
   18 |          double *sigma,double *b, ITG *icol, ITG *irow,
      |                                   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:18:46: error: unknown type name 'ITG'
   18 |          double *sigma,double *b, ITG *icol, ITG *irow,
      |                                              ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:19:3: error: unknown type name 'ITG'
   19 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,ITG *jq,
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:19:13: error: unknown type name 'ITG'
   19 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,ITG *jq,
      |             ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:19:22: error: unknown type name 'ITG'
   19 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,ITG *jq,
      |                      ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:19:40: error: unknown type name 'ITG'
   19 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,ITG *jq,
      |                                        ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:19:57: error: unknown type name 'ITG'
   19 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,ITG *jq,
      |                                                         ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:20:3: error: unknown type name 'ITG'
   20 |   ITG *nzs3,ITG *nrhs);
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:20:13: error: unknown type name 'ITG'
   20 |   ITG *nzs3,ITG *nrhs);
      |             ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:23:31: error: unknown type name 'ITG'
   23 |                 double *sigma,ITG *icol, ITG *irow,
      |                               ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:23:42: error: unknown type name 'ITG'
   23 |                 double *sigma,ITG *icol, ITG *irow,
      |                                          ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:24:3: error: unknown type name 'ITG'
   24 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:24:13: error: unknown type name 'ITG'
   24 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |             ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:24:22: error: unknown type name 'ITG'
   24 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |                      ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:24:40: error: unknown type name 'ITG'
   24 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |                                        ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:25:3: error: unknown type name 'ITG'
   25 |   ITG *jq,ITG *nzs3);
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:25:11: error: unknown type name 'ITG'
   25 |   ITG *jq,ITG *nzs3);
      |           ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:28:31: error: unknown type name 'ITG'
   28 |                 double *sigma,ITG *icol, ITG *irow,
      |                               ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:28:42: error: unknown type name 'ITG'
   28 |                 double *sigma,ITG *icol, ITG *irow,
      |                                          ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:29:3: error: unknown type name 'ITG'
   29 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:29:13: error: unknown type name 'ITG'
   29 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |             ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:29:22: error: unknown type name 'ITG'
   29 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |                      ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:29:40: error: unknown type name 'ITG'
   29 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |                                        ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:30:3: error: unknown type name 'ITG'
   30 |   ITG *jq,ITG *nzs3);
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:30:11: error: unknown type name 'ITG'
   30 |   ITG *jq,ITG *nzs3);
      |           ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:35:31: error: unknown type name 'ITG'
   35 |                 double *sigma,ITG *icol, ITG *irow,
      |                               ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:35:42: error: unknown type name 'ITG'
   35 |                 double *sigma,ITG *icol, ITG *irow,
      |                                          ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:36:3: error: unknown type name 'ITG'
   36 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:36:13: error: unknown type name 'ITG'
   36 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |             ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:36:22: error: unknown type name 'ITG'
   36 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |                      ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:36:40: error: unknown type name 'ITG'
   36 |   ITG *neq, ITG *nzs,ITG *symmetryflag,ITG *inputformat,
      |                                        ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:37:3: error: unknown type name 'ITG'
   37 |   ITG *jq,ITG *nzs3);
      |   ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:37:11: error: unknown type name 'ITG'
   37 |   ITG *jq,ITG *nzs3);
      |           ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:39:1: error: unknown type name 'ITG'
   39 | ITG pastix_solve(double *b,ITG *neq,ITG *symmetryflag,ITG *nrhs);
      | ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:39:28: error: unknown type name 'ITG'
   39 | ITG pastix_solve(double *b,ITG *neq,ITG *symmetryflag,ITG *nrhs);
      |                            ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:39:37: error: unknown type name 'ITG'
   39 | ITG pastix_solve(double *b,ITG *neq,ITG *symmetryflag,ITG *nrhs);
      |                                     ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:39:55: error: unknown type name 'ITG'
   39 | ITG pastix_solve(double *b,ITG *neq,ITG *symmetryflag,ITG *nrhs);
      |                                                       ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:41:21: error: unknown type name 'ITG'
   41 | void pastix_cleanup(ITG *neq,ITG *symmetryflag);
      |                     ^~~
C:/msys64/usr/local/CalculiX/ccx_2.17_precice2/src/pastix.h:41:30: error: unknown type name 'ITG'
   41 | void pastix_cleanup(ITG *neq,ITG *symmetryflag);
      |                              ^~~
pastix.c:63:23: error: 'IPARM_SIZE' undeclared here (not in a function)
   63 | spm_int_t iparm_basic[IPARM_SIZE];
      |                       ^~~~~~~~~~
pastix.c:65:20: error: 'DPARM_SIZE' undeclared here (not in a function)
   65 | double dparm_basic[DPARM_SIZE];
      |                    ^~~~~~~~~~
pastix.c:69:1: error: unknown type name 'pastix_data_t'
   69 | pastix_data_t* pastix_data = NULL;
      | ^~~~~~~~~~~~~
pastix.c:135:5: error: unknown type name 'pastix_data_t'
  135 |     pastix_data_t* pastix_data;
      |     ^~~~~~~~~~~~~
pastix.c: In function 'pastix_init':
pastix.c:161:6: warning: implicit declaration of function 'pastixResetSteps' [-Wimplicit-function-declaration]
  161 |      pastixResetSteps(pastix_data);
      |      ^~~~~~~~~~~~~~~~
pastix.c:195:2: warning: implicit declaration of function 'pastixInitParam' [-Wimplicit-function-declaration]
  195 |  pastixInitParam( iparm, dparm );
      |  ^~~~~~~~~~~~~~~
pastix.c:198:11: error: 'IPARM_ORDERING' undeclared (first use in this function)
  198 |     iparm[IPARM_ORDERING]      = PastixOrderScotch;
      |           ^~~~~~~~~~~~~~
pastix.c:198:11: note: each undeclared identifier is reported only once for each function it appears in
pastix.c:198:34: error: 'PastixOrderScotch' undeclared (first use in this function)
  198 |     iparm[IPARM_ORDERING]      = PastixOrderScotch;
      |                                  ^~~~~~~~~~~~~~~~~
pastix.c:200:12: error: 'IPARM_SCHEDULER' undeclared (first use in this function)
  200 |      iparm[IPARM_SCHEDULER]    = PastixSchedStatic;
      |            ^~~~~~~~~~~~~~~
pastix.c:200:34: error: 'PastixSchedStatic' undeclared (first use in this function)
  200 |      iparm[IPARM_SCHEDULER]    = PastixSchedStatic;
      |                                  ^~~~~~~~~~~~~~~~~
pastix.c:203:34: error: 'PastixSchedParsec' undeclared (first use in this function)
  203 |      iparm[IPARM_SCHEDULER]    = PastixSchedParsec;
      |                                  ^~~~~~~~~~~~~~~~~
pastix.c:205:8: error: 'IPARM_THREAD_NBR' undeclared (first use in this function)
  205 |  iparm[IPARM_THREAD_NBR]    = nthread_mkl;
      |        ^~~~~~~~~~~~~~~~
pastix.c:206:8: error: 'IPARM_GPU_NBR' undeclared (first use in this function)
  206 |  iparm[IPARM_GPU_NBR]       = (int) gpu;
      |        ^~~~~~~~~~~~~
pastix.c:207:8: error: 'IPARM_FLOAT' undeclared (first use in this function)
  207 |  iparm[IPARM_FLOAT]      = globDoublePrecision ? 3 : 2;
      |        ^~~~~~~~~~~
pastix.c:208:8: error: 'IPARM_MIN_BLOCKSIZE' undeclared (first use in this function)
  208 |  iparm[IPARM_MIN_BLOCKSIZE]    = 1024;
      |        ^~~~~~~~~~~~~~~~~~~
pastix.c:209:8: error: 'IPARM_MAX_BLOCKSIZE' undeclared (first use in this function)
  209 |  iparm[IPARM_MAX_BLOCKSIZE]    = 2048;
      |        ^~~~~~~~~~~~~~~~~~~
pastix.c:210:8: error: 'IPARM_FACTORIZATION' undeclared (first use in this function)
  210 |  iparm[IPARM_FACTORIZATION]    = PastixFactLU;
      |        ^~~~~~~~~~~~~~~~~~~
pastix.c:210:34: error: 'PastixFactLU' undeclared (first use in this function)
  210 |  iparm[IPARM_FACTORIZATION]    = PastixFactLU;
      |                                  ^~~~~~~~~~~~
pastix.c:211:8: error: 'IPARM_TASKS2D_WIDTH' undeclared (first use in this function)
  211 |  iparm[IPARM_TASKS2D_WIDTH]    = globDoublePrecision ? 256 : 128;
      |        ^~~~~~~~~~~~~~~~~~~
pastix.c:213:8: error: 'IPARM_REUSE_LU' undeclared (first use in this function)
  213 |  iparm[IPARM_REUSE_LU]     = firstIter ? 0 : 1;
      |        ^~~~~~~~~~~~~~
pastix.c:216:11: error: 'IPARM_GPU_MEMORY_PERCENTAGE' undeclared (first use in this function)
  216 |     iparm[IPARM_GPU_MEMORY_PERCENTAGE]  = 95;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
pastix.c:217:11: error: 'IPARM_GPU_MEMORY_BLOCK_SIZE' undeclared (first use in this function)
  217 |     iparm[IPARM_GPU_MEMORY_BLOCK_SIZE]  = 64 * 1024;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
pastix.c:220:11: error: 'DPARM_EPSILON_REFINEMENT' undeclared (first use in this function)
  220 |     dparm[DPARM_EPSILON_REFINEMENT]  = 1e-12;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~
pastix.c:221:11: error: 'IPARM_ITERMAX' undeclared (first use in this function)
  221 |     iparm[IPARM_ITERMAX]             = 50;
      |           ^~~~~~~~~~~~~
pastix.c:222:11: error: 'IPARM_GMRES_IM' undeclared (first use in this function)
  222 |     iparm[IPARM_GMRES_IM]             = 50;
      |           ^~~~~~~~~~~~~~
pastix.c:249:2: warning: implicit declaration of function 'pastixInit'; did you mean 'pastix_init'? [-Wimplicit-function-declaration]
  249 |  pastixInit( &pastix_data, MPI_COMM_WORLD, iparm, dparm );
      |  ^~~~~~~~~~
      |  pastix_init
pastix.c:249:28: error: 'MPI_COMM_WORLD' undeclared (first use in this function)
  249 |  pastixInit( &pastix_data, MPI_COMM_WORLD, iparm, dparm );
      |                            ^~~~~~~~~~~~~~
pastix.c:256:2: warning: implicit declaration of function 'pastix_task_analyze'; did you mean 'pastix_analyze'? [-Wimplicit-function-declaration]
  256 |  pastix_task_analyze( pastix_data, spm );

while the same version just not using PaStiX (removed from makefile -DPASTIX) compiles without any problem.

@IshaanDesai
Copy link
Member

Hi @3rav, thanks for this issue! I think currently nobody in the preCICE team has experience with running CalculiX together with PaStiX and hence it would be difficult to investigate this problem. We welcome contributions from the community and domain experts in helping resolve such issues. If you investigated further and found something then it will be of great help if you could write here in the issue or even better, open a pull request in this repository.

@boris-martin
Copy link
Collaborator

boris-martin commented Sep 23, 2021

I'm currently facing the same issue, but I managed to compile CalculiX without adapter but with PaStiX. As that part of the code is not changed by the adapter, what I suspect is some kind of problem in the Makefile.
More specifically :
In Pastix.c, there's an inclusion of <pastix.h>, then of "CalculiX.h", then of "pastix.h". ITG is defined in "CalculiX.h" but "pastix.h" doesn't include CalculiX.h, so the code can only compile if CalculiX.h is included after "pastix.h".
My best guess is that for some reasons in the way includes are configured in your Makefile (and in mine), there's a confusion between <pastix.h> (the PaStiX library) and "pastix.h" (CalculiX code) which generates the errror.
I'm still working on it :)

@boris-martin
Copy link
Collaborator

I'm currently facing the same issue, but I managed to compile CalculiX without adapter but with PaStiX. As that part of the code is not changed by the adapter, what I suspect is some kind of problem in the Makefile.
More specifically :
In Pastix.c, there's an inclusion of <pastix.h>, then of "CalculiX.h", then of "pastix.h". ITG is defined in "CalculiX.h" but "pastix.h" doesn't include CalculiX.h, so the code can only compile if CalculiX.h is included after "pastix.h".
My best guess is that for some reasons in the way includes are configured in your Makefile (and in mine), there's a confusion between <pastix.h> (the PaStiX library) and "pastix.h" (CalculiX code) which generates the errror.
I'm still working on it :)

I don't think it can be fixed through the Makefile, so my fix was renaming CalculiX's pastix file and updating the relevant includes

I ran this script :

#! /bin/bash

echo "Renaming includes of \"pastix.h\" to \"pastix_ccx.h\" to avoid conflict."
sed -i 's/#include "pastix.h"/ #include "pastix_ccx.h"/g' /usr/local/CalculiX/ccx_2.17/src/*.c
echo "Renaming CalculiX file pastix.h to pastix_ccx.h"
mv /usr/local/CalculiX/ccx_2.17/src/pastix.h /usr/local/CalculiX/ccx_2.17/src/pastix_ccx.h

@IshaanDesai
Copy link
Member

@boris-martin does the adapter work with the PaStiX solver after your fix is implemented? Can we close this issue?

@boris-martin
Copy link
Collaborator

Yes, I'm still looking for a more elegant fix but the adapter is successfully built once this fix and the fix of #70 are done.

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

No branches or pull requests

3 participants