Opened 5 years ago

Last modified 4 years ago

#17635 closed enhancement

Update Givaro, FFLAS-FFPACK and LinBox — at Version 36

Reported by: jpflori Owned by:
Priority: major Milestone: sage-7.4
Component: packages: standard Keywords: linbox, givaro, fflas-ffpack, sd75
Cc: fbissey, cpernet Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/cpernet/givaro_fflasffpack_linbox (Commits) Commit: 4cd2289c8711642d448883ee6d843524ed5da5d5
Dependencies: Stopgaps:

Change History (36)

comment:1 Changed 5 years ago by jpflori

Requires to update:

  • fflas-ffpack to 2.0.0, see #17636
  • linbox, no release yet

comment:2 follow-up: Changed 5 years ago by fbissey

  • Cc fbissey added

So we have to wait for linbox? Do we have an idea of when it will happen?

comment:3 in reply to: ↑ 2 ; follow-up: Changed 5 years ago by jpflori

Replying to fbissey:

So we have to wait for linbox? Do we have an idea of when it will happen?

Yes we have to wait for a new Linbox, expected about the end of february, Clément Pernet wrote me, together with updated Givaro and fflas-ffpack.

By the way, I started this for #17630 which might interest you as well, I'll push code there tomorrow.

comment:4 in reply to: ↑ 3 Changed 5 years ago by jdemeyer

  • Description modified (diff)
  • Milestone changed from sage-6.5 to sage-6.7
  • Summary changed from Update Givaro to 3.8.0 to Update Givaro, FFLAS-FFPACK and LinBox

Replying to jpflori:

Replying to fbissey:

So we have to wait for linbox? Do we have an idea of when it will happen?

Yes we have to wait for a new Linbox, expected about the end of february, Clément Pernet wrote me, together with updated Givaro and fflas-ffpack.

It's June already...

Since givaro, LinBox and FFLAS-FFPACK all depend on each other, we should make one ticket.

Last edited 5 years ago by jdemeyer (previous) (diff)

comment:5 Changed 5 years ago by jdemeyer

  • Description modified (diff)
  • Milestone changed from sage-6.7 to sage-6.8

comment:6 follow-up: Changed 5 years ago by cpernet

  • Cc cpernet added

Sorry for the delay in releasing the fflas-ffpack/Givaro/LinBox environment. We're working on it now, and I'll keep you posted about the status. It should happen before the end of the year and hopefully much earlier.

I also meant to propose to replace ATLAS by OpenBLAS in sage. Looking at your clean-up work of the BLAS in #17630, I understand that we should proceed in the following order:

  1. release linbox
  2. upgrade linbox fflas-ffpack Givaro in Sage (this ticket #17635)
  3. clean-up the BLAS usage #17630
  4. replace ATLAS by OpenBLAS (ticket to be created)

I'll be happy to help in these tasks.

Last edited 5 years ago by cpernet (previous) (diff)

comment:7 Changed 5 years ago by jdemeyer

Let me remind you also about #15535, which pops up regularly. I don't know if it's a bug in Linbox or in the way that Sage uses Linbox, but it would be good to have a Linbox developer look at it.

comment:8 in reply to: ↑ 6 Changed 5 years ago by fbissey

Replying to cpernet:

Sorry for the delay in releasing the fflas-ffpack/Givaro/LinBox environment. We're working on it now, and I'll keep you posted about the status. It should happen before the end of the year and hopefully much earlier.

I also meant to propose to replace ATLAS by OpenBLAS in sage. Looking at your clean-up work of the BLAS in #17630, I understand that we should proceed in the following order:

  1. release linbox
  2. upgrade linbox fflas-ffpack Givaro in Sage (this ticket #17635)
  3. clean-up the BLAS usage #17630
  4. replace ATLAS by OpenBLAS (ticket to be created)

I'll be happy to help in these tasks.

I'll admit to have been a bit demotivated on the blas cleaning front. The tickets needs re-organizing and have good descriptions so we know what is supposed to go in them. Getting ATLAS to produce .pc file and using them is probably a priority task. Once that's done someone could create an optional openblas spkg or something.

comment:9 follow-ups: Changed 5 years ago by cpernet

  • Dependencies set to 18323

I'm working on it, and will release a new version of the 3 libs for the occasion, so as to ensure a smoother integration upstream. This will very likely be givaro-4.0.1 fflas-ffpack-2.2.0 linbox-1.4.1

These libraries now require c++11 support and this tickets therefore depends on #18323.

Inspired by what's propose in there, I suggest to add lines of the form

+# distutils: extra_compile_args = -std=c++11

to libs/linbox/linbox.pxd lib/linbox/fflas.pxd lib/linbox/echelonform.pxd but I understand that this is subject to a debate on sage-devel https://groups.google.com/forum/#!topic/sage-devel/aGwotQA9to8

If this option happens to be accepted, we would then need to add more cflags in the list: namely those produced by fflas-ffpack configure related to the target architecture: -mavx -msse4.1 and others like -fabi-version=6 -fopenmp.

I could not figure a way to append the string returned by bin/fflas-ffpack-config --cflags to these pxd files. Any hint?

Last edited 5 years ago by cpernet (previous) (diff)

comment:10 Changed 5 years ago by cpernet

  • Dependencies changed from 18323 to #18323

comment:11 in reply to: ↑ 9 Changed 5 years ago by fbissey

Replying to cpernet:

I could not figure a way to append the string returned by bin/fflas-ffpack-config --cflags to these pxd files. Any hint?

Add a definition in module_list.py, you define a LINBOX_FLAGS. It would be easier if you had a .pc file as we have a python interface to pkgconfig that we can use easily. Here you have to do your own parsing from python. Anyway you can then use LINBOX_FLAGS in the .pxd file.

comment:12 in reply to: ↑ 9 ; follow-up: Changed 5 years ago by jdemeyer

Replying to cpernet:

-mavx -msse4.1

I understand that the libraries themselves want these, but why the Cython files?

and others like -fabi-version=6

This looks like it should be used always for all C++ files then. Mixing ABI's doesn't look like a good idea.

-fopenmp

Same question as before, is this really needed for the Cython interface?

comment:13 in reply to: ↑ 12 Changed 5 years ago by cpernet

Replying to jdemeyer:

Replying to cpernet:

-mavx -msse4.1

I understand that the libraries themselves want these, but why the Cython files?

fflas-ffpack and linbox are essentially source libraries, so when you include the headers, you include the whole code. This is by design, due to the ubiquity of template programming in these libraries.

Now the old linbox-sage interface compiles some specializations and offer them through a C api. These extra flags would not be required if we would stick to using this interface.

But, since then, Cython started to offer the capability to hook C++ code directly and more functionnalities have been added in sage where fflas-ffpack code is called directly, like in libs/linbox/fflas.pxd where the C++ routine FFLAS::fgemm is called.

and others like -fabi-version=6

This looks like it should be used always for all C++ files then. Mixing ABI's doesn't look like a good idea.

Sure. Maybe one should change the ABI higher up then.

-fopenmp

Same question as before, is this really needed for the Cython interface?

Same answer as above.

comment:14 Changed 5 years ago by jdemeyer

  • Dependencies changed from #18323 to #19298

comment:15 Changed 5 years ago by cpernet

  • Branch set to u/cpernet/givaro_fflasffpack_linbox

comment:16 follow-up: Changed 5 years ago by cpernet

  • Commit set to dd81c26b4ece4e206e5c3eb8c42e5a22337bc458

I added my working branch to the ticket. I could not find if and where I should store the tarballs of the new spkg?

As of today (sept 28 2015); they correspond to the upstream version of the 3 libs: givaro, fflas-ffpack and linbox.

I added .pc files for givaro and fflas-ffpack (coming soon for linbox), and defined the extra_compile_flages in modules_list.py as suggested by fbissey.

This is still work in progress:

  • LinBox sparse solver make the test-suite fail: I'm investigating the problem, which I could not reproduce in LinBox for the moment.
  • the extra_compile_flags should be inferred from the .pc files (harcoded for the moment). I did not find how to use pkg-config through python to do it.

New commits:

dd81c26Update givaro to v4.0.1 fflas-ffpack to v2.2.0 and linbox to v1.4.1rc0.

comment:17 in reply to: ↑ 16 Changed 5 years ago by jdemeyer

Replying to cpernet:

I could not find if and where I should store the tarballs of the new spkg?

Just add a link to the upstream tarballs on this ticket. If any renaming is needed, you should rename the tarball and add a link to the renamed tarball.

comment:18 Changed 4 years ago by cpernet

  • Description modified (diff)

comment:19 Changed 4 years ago by git

  • Commit changed from dd81c26b4ece4e206e5c3eb8c42e5a22337bc458 to c97f54702ff9273a6fd17954aa3578198300124c

Branch pushed to git repo; I updated commit sha1. New commits:

c97f547update fflas-givaro-linbox spkg version and minor chnages to configuration files

comment:20 Changed 4 years ago by jdemeyer

Instead of adding flags to individual extensions, they should be added to the .pxd or .pyx files.

comment:21 follow-up: Changed 4 years ago by cpernet

Ok, now I get confused: fbissey suggested to define all compilation flags in module_list.py. I saw there that most spkg related extension had their flags set in this file: e.g. flint, fplll, Lfunction, m4ri, m4rie... Hence I moved all flags that I originally wrote in the linbox.pxd fflas-ffpack.pxd givaro.pxd files to module_list.py which has the advantage of defining everything at the same place.

Jeroen or François are you suggesting that the proper way to proceed is to

  • define the flags givaro_extra_compile_args, fflas_ffpack_extra_compile_args, linbox_extra_compile_args in module_list.py
  • use them in the pxd files with something like
    +# distutils: extra_compile_args = ${givaro_extra_compile_args}
    

? Will do, if that's the way to go.

Also, I did not find how to invoque the python interface to pkgconfig, mentionned by françois.

comment:22 Changed 4 years ago by fbissey

Sorry I have been of the net for most of the week. For how to use pkgconfig you can follow the way I use it for blas in sage-on-gentoo at https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/sage-6.8-blas-r1.patch. Note that you probably don't need to parse the library_dir, I do it for blas in unusual location, which is expected for intel MKL or the AMD equivalent.

comment:23 in reply to: ↑ 21 Changed 4 years ago by jdemeyer

Replying to cpernet:

I moved all flags that I originally wrote in the linbox.pxd fflas-ffpack.pxd givaro.pxd files to module_list.py

Please don't!

which has the advantage of defining everything at the same place.

...but the disadvantage of requiring to add the flags to every single extension, which is much less scalable.

Jeroen or François are you suggesting that the proper way to proceed is to

  • define the flags givaro_extra_compile_args, fflas_ffpack_extra_compile_args, linbox_extra_compile_args in module_list.py
  • use them in the pxd files with something like
    +# distutils: extra_compile_args = ${givaro_extra_compile_args}
    

Essentially yes. You can grep for GSL_LIBRARIES to see how it's supposed to be done.

comment:24 Changed 4 years ago by git

  • Commit changed from c97f54702ff9273a6fd17954aa3578198300124c to fb16751ee2a275d55bef8824ee606fdd98f817f8

Branch pushed to git repo; I updated commit sha1. New commits:

fb16751Pass the library specific cflags in the pxd files instead of extensions in module_list.py

comment:25 follow-up: Changed 4 years ago by jdemeyer

This is still not quite what I meant.

For example, why does src/sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd need GIVARO_CFLAGS? Looking at that file, there is nothing related to givaro.

I assume you added GIVARO_CFLAGS because it still somehow indirectly includes Givaro code. But then you should add GIVARO_CFLAGS in the place where the Givaro headers are actually included and Cython's dependency tracking should pick it up.

See again the GSL_LIBRARIES example: I don't add GSL_LIBRARIES to every module which somehow indirectly uses GSL, only where the library functions are actually declared.

comment:26 Changed 4 years ago by git

  • Commit changed from fb16751ee2a275d55bef8824ee606fdd98f817f8 to c25de3330e09067dff47ecd8330df5ba7a00746e

Branch pushed to git repo; I updated commit sha1. New commits:

c25de33Remove all unecessary extra_compile_args for GIVARO and FFLASFFPACK.

comment:27 Changed 4 years ago by git

  • Commit changed from c25de3330e09067dff47ecd8330df5ba7a00746e to 73cc6b328406860fad586dea893625bac3f7f1fa

Branch pushed to git repo; I updated commit sha1. New commits:

73cc6b3Finds GIVARO and FFLASFFPACK CFLAGS in the .pc pkgconfig file.

comment:28 in reply to: ↑ 25 Changed 4 years ago by cpernet

Replying to jdemeyer:

I assume you added GIVARO_CFLAGS because it still somehow indirectly includes Givaro code. But then you should add GIVARO_CFLAGS in the place where the Givaro headers are actually included and Cython's dependency tracking should pick it up.

Yes. It was necessary to add these flags to extensions when everything was gathered in module_list.py, but no longer now that it is in each pxd files. I now see the point! Sorry for messing this up, it's fixed. I also made the CFLAGS variables set by the pkgconfig .pc files, as suggested by François.

One pb remains: there is no gmp.pc for the moment, and the givaro.pc lists gmp as a dependency. Similarly fflas-ffpack.pc should list blas as dependency, but we still don't have a blas.pc file (see #17075). I suggest to remove these dependencies for the moment, and I'll add them once we have the proper .pc files. If you confirm, I'll produce new tar.gz for givaro and fflas-ffpack accordingly.

comment:29 Changed 4 years ago by git

  • Commit changed from 73cc6b328406860fad586dea893625bac3f7f1fa to 7fd9523fad7dd778ee1d42c803b06f103ccdd709

Branch pushed to git repo; I updated commit sha1. New commits:

7fd9523Add link flags for fflas-ffpack.

comment:30 Changed 4 years ago by jdemeyer

Are there any significant API changes in the new linbox? I would like to add a linbox interface for sparse matrices over ZZ. I could do that using the current linbox-1.3.2 but I'd like to know that it will still work after upgrading linbox.

comment:31 Changed 4 years ago by jdemeyer

  • Branch changed from u/cpernet/givaro_fflasffpack_linbox to u/jdemeyer/givaro_fflasffpack_linbox

comment:32 Changed 4 years ago by jdemeyer

  • Commit changed from 7fd9523fad7dd778ee1d42c803b06f103ccdd709 to c4473522fac04f2726d7406b9fbf2fdcd0796f8b
  • Dependencies #19298 deleted
  • Milestone changed from sage-6.8 to sage-7.1

Merged latest beta.


New commits:

c447352Merge tag '7.1.beta3' into t/17635/givaro_fflasffpack_linbox

comment:33 Changed 4 years ago by git

  • Commit changed from c4473522fac04f2726d7406b9fbf2fdcd0796f8b to f31752c6865b53eeef48d4fc7a46280823a7494e

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

f31752cMerge tag '7.1.beta3' into t/17635/givaro_fflasffpack_linbox

comment:34 Changed 4 years ago by jdemeyer

fflas_ffpack doesn't build:

libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../fflas-ffpack/utils/ -I../../fflas-ffpack/fflas/ -I../../fflas-ffpack/ffpack -I../../fflas-ffpack/field -I/usr/local/src/sage-git/local/include -I/usr/local/src/sage-git/local//include -D__FFLASFFPACK_HAVE_CBLAS -msse4.1 -mavx -fabi-version=6 -fopenmp -O2 -Wall -DNDEBUG -UFFLASFFPACK_DEBUG -g -O2 -fPIC -std=gnu++11 -c fflas_L1_inst.C  -fPIC -DPIC -o .libs/fflas_L1_inst.o
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../../fflas-ffpack/utils/ -I../../fflas-ffpack/fflas/ -I../../fflas-ffpack/ffpack -I../../fflas-ffpack/field -I/usr/local/src/sage-git/local/include -I/usr/local/src/sage-git/local//include -D__FFLASFFPACK_HAVE_CBLAS -msse4.1 -mavx -fabi-version=6 -fopenmp -O2 -Wall -DNDEBUG -UFFLASFFPACK_DEBUG -g -O2 -fPIC -std=gnu++11 -c fflas_L3_inst.C  -fPIC -DPIC -o .libs/fflas_L3_inst.o
In file included from ../../fflas-ffpack/fflas/fflas_sparse/csr.h:89:0,
                 from ../../fflas-ffpack/fflas/fflas_sparse.h:126,
                 from ../../fflas-ffpack/fflas/fflas.h:164,
                 from fflas_L1_inst.C:34:
../../fflas-ffpack/fflas/fflas_sparse/csr/csr_pspmm.inl:48:2: error: stray '#' in program
   PAR_BLOCK{
  ^

comment:35 Changed 4 years ago by cpernet

  • Branch changed from u/jdemeyer/givaro_fflasffpack_linbox to u/cpernet/givaro_fflasffpack_linbox

comment:36 Changed 4 years ago by cpernet

  • Commit changed from f31752c6865b53eeef48d4fc7a46280823a7494e to 4cd2289c8711642d448883ee6d843524ed5da5d5
  • Description modified (diff)

I've updated the tarballs of the 3 libraries to the latests rc1 (the failing code in longer there) and updated the checksums. Everything builds on my box.


New commits:

db82895Patch merged upstream in fflas-ffpack
a45e379missing coma
4cd2289updating givaro, fflas-ffpack and linbox to latest rc1 version
Note: See TracTickets for help on using tickets.