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

PaStiX and mingw #1

Open
3rav opened this issue Jul 31, 2020 · 10 comments
Open

PaStiX and mingw #1

3rav opened this issue Jul 31, 2020 · 10 comments

Comments

@3rav
Copy link
Contributor

3rav commented Jul 31, 2020

Hi,

May I ask for a version without unnecessary libraries (CUDA, parsec, ...). The minimum version necessary to work with CalculiX 2.17 (only pastix)?

hwloc-2.2.0 and mingw - OK
scotch 6.0.9 and mingw - OK

parsec and mingw - error: https://bitbucket.org/icldistcomp/parsec/issues/270/parsec-and-mingw64

Reagards
Rafal

@Kabbone
Copy link
Contributor

Kabbone commented Jul 31, 2020

Hi @3rav ,
I will try to make a version without the need of cuda (at least a compile time option).
You don't necessarily need parsec, it should work using StarPU or Static scheduling (didn't try this route for quite some time), but the performance will probably suffer.

@3rav
Copy link
Contributor Author

3rav commented Jul 31, 2020

Great,

Right now, I just want to compile PaStiX properly in the mingw environment (and CalculiX with PaStiX).

@3rav
Copy link
Contributor Author

3rav commented Aug 6, 2020

Hi,

When compiling, the parsec in mingw has an error of around 65% but I have generated libparsec-base.a
It is enough to compile PaStiX with parsec?

@Kabbone
Copy link
Contributor

Kabbone commented Aug 7, 2020

Hi,
no, it's unfortunately not enough, you need libparsec.so/.a

@Kabbone
Copy link
Contributor

Kabbone commented Aug 16, 2020

Hi 3rav,
I removed cuda and made parsec optionally on my branch.
You have an build option in the make_pastix.sh script for turning both on and off. But to not use Parsec, you also need to edit the pastix.c file in CalculiX:
iparm[IPARM_SCHEDULER] must be set to "PastixSchedStatic" for all cases. The performance will definitely be worse than Parsec, but I didn't benchmark the benefit compared to SPOOLES.

Be carefull, my branch is a dev branch, you should check the results carefully!

EDIT: I forgot to mention, GPU is not possible on this branch

@3rav
Copy link
Contributor Author

3rav commented Aug 17, 2020

Hi Kabbone,

Currently this version of PaStiX has a few problems on mingw64:

  1. Despite compiling scotch with the -DINTSIZE64 flag PaStiX crashes witch error (I compiling scotch with CalculiX script):
-- Performing Test SCOTCH_Num_4
-- Performing Test SCOTCH_Num_4 - Success
-- Performing Test SCOTCH_Num_8
-- Performing Test SCOTCH_Num_8 - Failed
-- Scotch inlude dirs: C:/msys64/usr/local/include
CMake Error at CMakeLists.txt:435 (message):
  PASTIX_INT64 is enabled and provided Scotch is not compiled with int64
  support.


-- Configuring incomplete, errors occurred!

For test I simply turn off scotch

  1. Error in PaStiX:
[ 27%] Linking C executable spm_matvec_tests.exe
In file included from C:/msys64/usr/local/PaStiX4CalculiX-cudaless/build/kernels/core_cgemmsp.c:21:
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/kernels/kernels_trace.h: In function 'kernel_trace_start_lvl2':
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/kernels/kernels_trace.h:157:96: error: 'index' undeclared (first use in this function)
  157 | static inline void kernel_trace_start_lvl2     ( pastix_ktype2_t ktype )  { (void)ktype; (void)index; }
      |                                                                                                ^~~~~
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/kernels/kernels_trace.h:157:96: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [kernels/CMakeFiles/pastix_kernels.dir/build.make:1039: kernels/CMakeFiles/pastix_kernels.dir/core_cgemmsp.c.obj] Błąd 1
make[1]: *** [CMakeFiles/Makefile2:1525: kernels/CMakeFiles/pastix_kernels.dir/all] Błąd 2
make[1]: *** Oczekiwanie na niezakończone zadania....
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libspm.a(laplacian.c.obj):laplacian.c:(.text+0xaf): undefined reference to `strndup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libspm.a(laplacian.c.obj):laplacian.c:(.text+0x36d): undefined reference to `strndup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libspm.a(laplacian.c.obj):laplacian.c:(.text+0x68d): undefined reference to `strndup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/usr/lib/libm.a(t-d000248.o):fake:(.text+0x2): undefined reference to `__imp_cabs'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/usr/lib/libm.a(t-d000249.o):fake:(.text+0x2): undefined reference to `__imp_cabsf'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [spm/tests/CMakeFiles/spm_matvec_tests.dir/build.make:114: spm/tests/spm_matvec_tests.exe] Błąd 1
make[1]: *** [CMakeFiles/Makefile2:1358: spm/tests/CMakeFiles/spm_matvec_tests.dir/all] Błąd 2
make: *** [Makefile:161: all] Błąd 2
[  1%] Built target refinement_headers_tgt
[  1%] Built target bcsc_headers_tgt
[  2%] Built target sopalin_headers
[  3%] Built target spm_headers_tgt
[ 20%] Built target spm
[ 20%] Building C object kernels/CMakeFiles/pastix_kernels.dir/core_cgemmsp.c.obj
In file included from C:/msys64/usr/local/PaStiX4CalculiX-cudaless/build/kernels/core_cgemmsp.c:18:
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/common/common.h: In function 'pastix_setenv':
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/common/common.h:90:12: warning: implicit declaration of function 'setenv'; did you mean 'getenv'? [-Wimplicit-function-declaration]
   90 |     return setenv( var, value, overwrite );
      |            ^~~~~~
      |            getenv
In file included from C:/msys64/usr/local/PaStiX4CalculiX-cudaless/build/kernels/core_cgemmsp.c:21:
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/kernels/kernels_trace.h: In function 'kernel_trace_start_lvl2':
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/kernels/kernels_trace.h:157:96: error: 'index' undeclared (first use in this function)
  157 | static inline void kernel_trace_start_lvl2     ( pastix_ktype2_t ktype )  { (void)ktype; (void)index; }
      |                                                                                                ^~~~~
C:/msys64/usr/local/PaStiX4CalculiX-cudaless/kernels/kernels_trace.h:157:96: note: each undeclared identifier is reported only once for each function it appears in

If I manually comments line 157, compilation stops on error 3.
//static inline void kernel_trace_start_lvl2 ( pastix_ktype2_t ktype ) { (void)ktype; (void)index; }

  1. Next error:
[ 82%] Linking CXX static library libpastix.a
[ 82%] Built target pastix
[ 85%] Built target spm_test
[ 85%] Linking C executable spm_matvec_tests.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libspm.a(laplacian.c.obj):laplacian.c:(.text+0xaf): undefined reference to `strndup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libspm.a(laplacian.c.obj):laplacian.c:(.text+0x36d): undefined reference to `strndup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libspm.a(laplacian.c.obj):laplacian.c:(.text+0x68d): undefined reference to `strndup'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/usr/lib/libm.a(t-d000248.o):fake:(.text+0x2): undefined reference to `__imp_cabs'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/usr/lib/libm.a(t-d000249.o):fake:(.text+0x2): undefined reference to `__imp_cabsf'
collect2.exe: error: ld returned 1 exit status

Best regards

@3rav
Copy link
Contributor Author

3rav commented Aug 17, 2020

Hi,

I skipped the 2nd and 3rd error by replacing the code from the newer (official) version:

ad.1
I don't know why but it just doesn't check the indicated folder containing scotch.

ad. 2

6.0.1 (kernels_trace.h):

static inline void kernel_trace_start_lvl0     ( pastix_ktype0_t ktype )  { (void)ktype; }
static inline void kernel_trace_stop_lvl0      ( double flops )           { (void)flops; }
static inline void kernel_trace_start_lvl2     ( pastix_ktype2_t ktype )  { (void)ktype; (void)index; }
static inline void kernel_trace_stop_lvl2      ( double flops )           { (void)flops; }
static inline void kernel_trace_stop_lvl2_rank ( double flops, int rank ) { (void)flops; (void)rank; }

6.1.0 (kernels_trace.h):

static inline void kernel_trace_start_lvl0     ( pastix_ktype0_t ktype )  { (void)ktype; }
static inline void kernel_trace_stop_lvl0      ( double flops )           { (void)flops; }
static inline void kernel_trace_start_lvl2     ( pastix_ktype2_t ktype )  { (void)ktype; }
static inline void kernel_trace_stop_lvl2      ( double flops )           { (void)flops; }
static inline void kernel_trace_stop_lvl2_rank ( double flops, int rank ) { (void)flops; (void)rank; }

ad. 3

6.0.1 (spm/src/drivers/laplacian.c):

        char flt;
        char *tmpf = strndup( filename, 256 );

6.1.0 (spm/src/drivers/laplacian.c):

        size_t nfilename = strlen( filename );
        char  flt, *tmpf;
        tmpf = calloc( spm_imax( nfilename, 256 ), sizeof(char) );

But now I have this errors:

[ 86%] Building C object example/CMakeFiles/reentrant.dir/reentrant.c.obj
[ 86%] Linking CXX executable reentrant.exe
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(simu.c.obj):simu.c:(.text+0x3fb): undefined reference to `bzero'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(api.c.obj):api.c:(.text+0x10f): undefined reference to `mkdtemp'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(api.c.obj):api.c:(.text+0x1d0): undefined reference to `mkdtemp'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(models.c.obj):models.c:(.text+0xea4): undefined reference to `getline'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(models.c.obj):models.c:(.text+0xf02): undefined reference to `getline'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(order_find_supernodes.c.obj):order_find_supernodes.c:(.text+0xdf): undefined reference to `bzero'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(order_find_supernodes.c.obj):order_find_supernodes.c:(.text+0x25a): undefined reference to `bzero'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(order_find_supernodes.c.obj):order_find_supernodes.c:(.text+0x39d): undefined reference to `bzero'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(order_find_supernodes.c.obj):order_find_supernodes.c:(.text+0x3fb): undefined reference to `bzero'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(order_find_supernodes.c.obj):order_find_supernodes.c:(.text+0x406): undefined reference to `bzero'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(order_find_supernodes.c.obj):order_find_supernodes.c:(.text+0x494): more undefined references to `bzero' follow
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(integer.c.obj):integer.c:(.text+0x2e9): undefined reference to `random'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(integer.c.obj):integer.c:(.text+0x34a): undefined reference to `srandom'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(integer.c.obj):integer.c:(.text+0x392): undefined reference to `srandom'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../libpastix.a(integer.c.obj):integer.c:(.text+0x3b3): undefined reference to `srandom'
collect2.exe: error: ld returned 1 exit status

@3rav
Copy link
Contributor Author

3rav commented Aug 19, 2020

Hi,

Once I managed to compile PastiX (cudaless) to the end with a few fixes (only python2, not 3!):

  1. simu.c (bzero -> memset)
  2. api.c (mkdtemp -> mkstemp)
  3. integer.c (random -> rand, srandom -> srand)
  4. models.c (getline -> add:
#ifdef _WIN32

ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
    //resto do código aqui
}
#endif)
  1. order_find_supernodes.c (bzero -> memset)

patch PaStiX.zip

and patch for Starpu 1.3: https://gitlab.inria.fr/solverstack/pastix/-/commit/b66f26d693554966700c3641b4167a1621c29edb
patch_starpu1.3.PaStiX.zip

For test I add this patch (replace orginaj files) in to Linux Ubuntu version and its worsks (ccx also).

After these changes I was able to compile Pastix, then I tried to recompile pastix (test whether compilation can be repeated), unfortunately I get an error (if I turn off scotch then this error not occurse, compilation passes 100% without error):

PaStiX_error

undefined reference to:
 `__imp_cabs'
 `__imp_cabsf'
 `__imp_csqrt'
 `__imp_csqrtf'

@3rav 3rav mentioned this issue Sep 18, 2020
@mfaverge
Copy link

mfaverge commented Jan 5, 2021

Hello,

Just to comment quickly on these issues. I just added a patch on the official version to fix 1 and 5 (bzero beeing obsolete I removed it as you suggested). It will be integrated in 6.1.1.

2 and 4. There is a protection against these missing functions in the last master for several month now, so it should not be required.

For 3, rand and srand are obsolete in favour of random and srandom so I would not do this change.

I'm curious about the last error, can you give me more details about it and how to reproduce it please ?

Finally, just by curiosity, why not having pastix as a submodule and providing a cmake cache file to configure it for calculix ? It's not enough for your requirements ?

@3rav
Copy link
Contributor Author

3rav commented Feb 12, 2021

Please see: msys2/MINGW-packages#6952

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

3 participants