Catégorie: "Linux"

Rebuild of the Debian archive with clang

February 29th, 2012

Recently, I have been working on a side project for Debian. The goal was to rebuild of the Debian archive (the distribution) with clang, a new C/C++ compiler.

clang is now ready to build software for production (either for C, C++ or Objective-C). This compiler is providing many more warnings and interesting errors than the gcc suite while not carrying the same legacy as gcc.
This rebuild has several goals. The first one is to prove (or not) that clang is a viable alternative. Second, building a software with different compilers improves the overall quality of code by providing different checks and alerts.

The result are detailed and explained here:
http://clang.debian.net/

Conclusions
When I had the idea to rebuild Debian with a new compiler, I was expecting many issues and bugs caused by clang but I have been surprised to notice that most of the issues are either difference in C standard supported, difference of interpretation or corner cases.
My personal opinion is that clang is now stable and good enough to rebuild most of the packages in the Debian archive, even if many of them will need minor tweaks to compile properly.
In the next few years, coupled with better static analysis tools, clang might replace gcc/g++ as the C/C++ compiler used by default in Linux and BSD distributions.
The clang developers are progressing very fast: 14.5% of the packages were failing with version 2.9 against 8.8% with version 3.0.
Several major steps in the clang adoptions have been made like chromium/chrome being built by default with clang, Xcode providing clang by default, FreeBSD working on the gcc -> clang switch, etc.
However, on the Debian point of view, one of the important step would be to make sure that clang manages all the Debian architecture/kernel (11 official, 6 unofficial)

Update of the linear algebra libraries in Debian

April 6th, 2010

In the numerical computing world, the cornerstones libraries are BLAS and LAPACK. They have been used in most of the numerical software for decades (like Scilab, R, numpy, OpenOffice with calc, etc).

During that time, many implementations appeared to improve the performances taking advantages of clusters, multicore, SEE{1,2,3,4}, various levels of cache...
Between the reference BLAS (refblas) to an optimized one like ATLAS or MKL (Math Kernel Library by Intel - non-free), it is not rare to have a 15 factor.

In Debian, we use by default the reference implementation of BLAS (168 reverse dependencies) and LAPACK (178 reverse dependencies). If the results are usually bad, they are pretty easy to use. What is hard to use, is switch between highly optimized libraries.
For now, the main one in the archive is ATLAS. ATLAS build process will launch many computations to know what will work best on the architecture. Results are usually excellent.

1) Upload of a refactoring of the ATLAS package.
I have been working on this for a while and after 19 uploads into Debian Experimental and I am happy (and kind of relief) to upload into debian unstable the release 3.8.3 of ATLAS.

The new key elements in this release are:

  • Package of the release 3.8.3 ... Long overdue
  • Much more packages for recent architectures (sse3, core2sse3, etc)
  • A simplified maintenance
  • Easy to build a custom package: fakeroot debian/rules custom
  • Easy upgrade to version 3.9.X when it is stable
  • 12 bugs closed in Debian (including 4 RCs)
  • 6 bugs closed in Launchpad.
  • MMX optimized package removed

Note that, as before, all prebuilt binaries of ATLAS will be always slower than if you built them on the target architecture (but using Debian binary packages will save a few kilograms of Uranium).

And one of most important feature is the capability to switch to any ATLAS implementation.

2) Switch between the different implementation
The problem in Debian (and Ubuntu) was that it was hard to switch between the ref BLAS/LAPACK and the optimized libraries. The user has to play with the LD_LIBRARY_PATH to use the various optimized packages and since there is no convention between the various distribution, the upstream developer has to develop crappy tricks to handle such things.

It is why I implemented the following proposal: Handle different versions of BLAS and LAPACK.

The main idea is to use the update-alternatives system to allow a quick and easy switch. For example:

# update-alternatives --config libblas.so.3gf 
There are 3 choices for the alternative libblas.so.3gf (providing /usr/lib/libblas.so.3gf).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
* 0            /usr/lib/atlas-core2sse3/atlas/libblas.so.3gf   55        auto mode
  1            /usr/lib/atlas-base/atlas/libblas.so.3gf        35        manual mode
  2            /usr/lib/atlas-core2sse3/atlas/libblas.so.3gf   55        manual mode
  3            /usr/lib/libblas/libblas.so.3gf                 10        manual mode

# update-alternatives --config liblapack.so.3gf
There are 3 choices for the alternative liblapack.so.3gf (providing /usr/lib/liblapack.so.3gf).

  Selection    Path                                             Priority   Status
------------------------------------------------------------
* 0            /usr/lib/atlas-core2sse3/atlas/liblapack.so.3gf   55        auto mode
  1            /usr/lib/atlas-base/atlas/liblapack.so.3gf        35        manual mode
  2            /usr/lib/atlas-core2sse3/atlas/liblapack.so.3gf   55        manual mode
  3            /usr/lib/lapack/liblapack.so.3gf                  10        manual mode

Thanks to this, it is just trivial to switch from one to the other...

Conclusion:
I just pushed the changes into Debian unstable for blas, lapack and atlas.
I have been testing a lot these deep modifications and I fixed all the problems that I found. However, in case I missed something, please report a bug...

A few news around Scilab (packaging & other stuff)

Décembre 30th, 2008

Here is a quick list of new things around Scilab (note that it is slightly modified message of the one I sent on the dev mailing list).

  • Sagemath - it is a software which combines the power of various opensource software.

    A Experimental "Scilab/Sage package" is planed for Sage 3.4 and an experimental package by Jaap Spies is already available

  • Debian/Ubuntu
    Packages are available on my Scilab homepage
    Debian packages are up-to-date (5.0.3-2). I will to upload the new Ubuntu's packages in 2009 (for now, it is 5.0.3-1 which is working too). I might backport them to Debian Lenny (future stable) & Ubuntu Hardy.

  • Mandriva
    Tomasz Pawel Gajc (a regular Mandriva contributor) created a package available on zarb.org

  • Opensuse
    A Scilab package for Opensuse has been created by Andrea Florio.
    It is available on packman
    and should be included in the next version of opensuse.
    Note that Mandriva & Opensuse packages have been created for Scilab 5.0.3 and I applied most of their patches (or update some part of the code) for Scilab 5.0.4.

  • Redhat/Fedora
    The work is still going on.
    They are also doing a great work packaging the misc dependencies but they are a bit stuck about the JOGL packaging (jogl and glugen should produce two different packages ... which I should also do in Debian/Ubuntu too)

  • Arch Linux
    It is also available under Arch Linux by Simon Lipp (one of our former trainee).

  • Gentoo
    A bit stuck for now but some activities have been seen lately around on jrosetta (one of the dependency introduced by Scilab 5).

  • Slackware
    Scilab has been packaged by the Italian Slackware community. It is available on their website. I don't know if it is going to be included in Slackware by default or not;

-bash: /bin/ls: No such file or directory

September 19th, 2006

If you have done a mistake/lost the /lib/ directory. Example :

mv lib lib.

And you are stuck without anything working :

# ls
-bash: /bin/ls: No such file or directory

Don't waste your time in a reinstallation, there is a trick :

/lib./ld-linux.so.2 --library-path /bin/ mv /lib. /lib/

It invokes the program loader directly and the problem will be fixed (of course, you can use this command to call many programs).

Ma vie (piouf)

Mai 25th, 2006

De retour en France début avril, ces deux derniers mois ont été consacrés à la recherche d'un boulot et d'un appartement.
J'ai maintenant les deux et qui ont tout pour me plaire.
Niveau de l'appartement, je me suis installé avec mon amie dans un trois pièces situé à Paris (20 ème) près de la place de Nation. Super appartement, content et bien chez nous dedans. Bon, le seul problème est que l'on a pas encore l'ADSL... Donc je squate la connexion chez Pimentech.

Pour le boulot, après de longues recherches (cf message précédent), j'ai finalement trouvé exactement le boulot que je recherchais. Je vais intégrer le prestigieux institut qu'est l'INRIA - Institut National de Recherche en Informatique et Automate (pour ceux qui ne connaissent pas, c'est comme le CNRS mais appliqué à l'informatique). Régulièrement classé dans le top 3 de 01 informatique des entreprises préférées des informaticiens.
Je vais être amené à travailler sur le projet Scilab, logiciel de calcul scientifique. Mon travail consistera principalement en les développements multi plates-formes en vue de la réalisation des fonctionnalités de Scilab 5 et la responsabilité des versions UNIX et GNU/Linux du logiciel Scilab. Je sens que je vais bien m'amuser !

Ce fut un retour et une réinstallation en France un peu plus longue que je ne l'avais imaginé mais qu'il est au final bien passé !