BMI

Table of content

Introduction

The BLAD - MULTIPLE - INTERFACES library is a C library which implements interfaces between the BLAD libraries, and various computer algebra systems such as MAPLE and SAGE. The corresponding MAPLE package is called DifferentialAlgebra. The corresponding SAGE package is currently under development. The BMI library is protected by the Lesser General Public License.

Version numbers

The first open source version bmi-2.0 was released on October 25th, 2010. The version bmi-3.0 was released on February 3rd, 2012. Starting from release 3.10, the version number of BMI follows the one of BLAD, i.e. bmi-3.10 is supposed to be used with blad-3.10.

Download

BMI version 3.10.5 was released on February 1st, 2013 (it works with BLAD version 3.10.4).

Upgrading MAPLE dynamic libraries

Last update of these instructions: January 22, 2013, with MAPLE 16.

The following instructions aim at upgrading the versions of BLAD and BMI which are shipped with MAPLE using more recent ones. They build a directory tree which eventually looks as follows (there is a slight variant for users who download source code directly from the svn repository https://forge.lifl.fr/DifferentialAlgebra).

Linux and Solaris

The following instructions are supposed to work with MAPLE 14, 15 and 16 over LINUX. They should also work on Sun Solaris, though I lack feedback concerning this platform.

  1. Create the directory DifferentialAlgebra (say, in $HOME)
    mkdir $HOME/DifferentialAlgebra
    cd $HOME/DifferentialAlgebra
  2. Recover the source code of BLAD and create thereby the blad directory.
    • Normal users: it is assumed that the current version is blad-3.10 (you may need to change it) and that blad-3.10.tgz is present in the DifferentialAlgebra directory
      tar xzf blad-3.10.tgz
      mv blad-3.10 blad
    • svn users: the source code is not located directly under blad but under blad/trunk
      svn checkout --username your-login https://forge.lifl.fr/DifferentialAlgebra/svn/main/blad
  3. [svn users only] Create the blad/trunk/configure file.
    cd blad/trunk
    mkdir config
    libtoolize --force --copy
    aclocal
    autoheader
    automake --add-missing --copy
    autoconf
    • Note: You may need to install automake and autoconf.
  4. Configure BLAD for your machine
    cd $HOME/DifferentialAlgebra
    mkdir blad-build
    cd blad-build
    ../blad/configure --prefix=$HOME/DifferentialAlgebra/blad-install
    • Note: svn users should call ../blad/trunk/configure at line 4.
    • Note: you may need to install the GMP development library libgmp-dev, because you need the header file gmp.h. If this library is installed in some directory (say) /usr/local/gmp, which is not automatically scanned by the C compiler, you should pass the option --with-gmp=/usr/local/gmp at line 4.
    • Note: strictly speaking, one should use the GMP dynamic library shipped with MAPLE, which can be downloaded from this page. However, the use of the standard GMP development library was never reported to create any problem on Linux and Solaris (this is not the case for MAC OS, as explained below).
  5. Compile and install BLAD, creating thereby the blad-install directory and the files blad-install/lib/libblad.so.*
    make
    make check [optional]
    make install
  6. Recover the source code of BMI and create thereby the bmi directory (see remarks at step 2).
  7. [svn users only] Create the bmi/trunk/configure file (see remarks at step 3).
    cd bmi/trunk
    mkdir config
    libtoolize --force --copy
    aclocal
    autoheader
    automake --add-missing --copy
    autoconf
  8. Configure BMI for your machine
    cd $HOME/DifferentialAlgebra
    mkdir bmi-build
    cd bmi-build
    ../bmi/configure --prefix=$HOME/DifferentialAlgebra/bmi-install --with-blad=$HOME/DifferentialAlgebra/blad-install --enable-maple=yes
    • Note: svn users should call ../bmi/trunk/configure at line 4.
    • Note: If the GMP development library is installed in some directory (say) /usr/local/gmp, which is not automatically scanned by the C compiler, you should pass the option --with-gmp=/usr/local/gmp at line 4.
    • Note: If the MAPLE you want to use is located in some directory (say) /usr/local/maple16, you should specify it at the beginning of line 4, starting the command by: MAPLE=/usr/local/maple16/bin/maple ../bmi/configure
  9. Compile and install BMI, creating thereby the bmi-install directory and the file bmi-install/lib/libbmi.so
    make
    make install
    • Note: the experimental DifferentialAlgebra0 package is created and installed in the bmi-install/maple directory.
  10. Change the MAPLE dynamic libraries. Please, read carefully the notes below before proceeding.
    cd /usr/local/maple/bin.OS
    mv libblad.so libblad.so.orig
    mv libbmi.so libbmi.so.orig
    ln -s $HOME/DifferentialAlgebra/blad-install/lib/libblad.so.0.0.0 libblad.so
    ln -s $HOME/DifferentialAlgebra/bmi-install/lib/libbmi.so.0.0.0 libbmi.so
    • Note: The OS suffix at line 1 depends on your architecture (e.g. X86_64_LINUX on a 64 bits Linux). This directory can be determined using the kernelopts(bindir) command, in MAPLE.
    • Note: Depending on your installation, you may need to become a superuser before modifying the files, or to use the sudo command.
    • Note: Lines 2 and 3 rename the original dynamic libraries, for safety. Make sure they were successfully performed before proceeding.
    • Note: Lines 4 and 5 replace the old libraries by symbolic links to the new ones. Let us explain the idea which lies under these commands. The symbolic links should have the same name as the old dynamic libraries. In the blad-install/lib and bmi-install/lib directories, there are actual dynamic libraries and various symbolic links. Using ls -l and looking at the sizes of the files, it is easy to find out the names of the actual dynamic libraries. The symbolic links should point to these libraries.
    • Note: You could also copy the new libraries in the MAPLE bindir directory. The advantage/drawback of symbolic links is: next time you upgrade BLAD and BMI, MAPLE gets automatically updated.
  11. Final test. It the following command fails, then something went wrong and you may want to replace the symbolic links libblad.so and libbmi.so by the original files, in the MAPLE bin.OS directory (see former step).
    $ maple
    > with (DifferentialAlgebra):
    > R := DifferentialRing (derivations = [x], blocks = [y]);
  12. Using the experimental DifferentialAlgebra0 package. It is sufficient to modify the MAPLE libname variable, so that it mentions the $HOME/DifferentialAlgebra/bmi-install/maple directory. Observe that shell variables have to be replaced by their values. Here is an example.
    $ maple
    > libname := "/home/boulier/DifferentialAlgebra/bmi-install/maple", libname:
    > integrate := DifferentialAlgebra0:-Integrate;
    • Note: Both packages DifferentialAlgebra and DifferentialAlgebra0 take advantage of the new libraries. They can be used at the same time.
  13. Next time you want to update BLAD and BMI, it is sufficient to update the source codes of BLAD and BMI (svn users only need to perform svn update commands) and to perform again steps 3 to 5 and 7 to 9.

MAC OS

On this platform, this issue lies in the fact that MAPLE uses a specific GMP (the names of the GMP functions and the name of the library itself are not the standard ones) and that BLAD and BMI must use it. In the following, we assume that MAPLE is installed in /Library/Framework/Maple.Framework/Versions/16.

  1. Create the directory DifferentialAlgebra (say, in $HOME)
    mkdir $HOME/DifferentialAlgebra
    cd $HOME/DifferentialAlgebra
  2. Recover the source code of BLAD and create thereby the blad directory.
    • Normal users: it is assumed that the current version is blad-3.10 (you may need to change it) and that blad-3.10.tgz is present in the DifferentialAlgebra directory
      tar xzf blad-3.10.tgz
      mv blad-3.10 blad
    • svn users: the source code is not located directly under blad but under blad/trunk
      svn checkout --username your-login https://forge.lifl.fr/DifferentialAlgebra/svn/main/blad
  3. [svn users only] Create the blad/trunk/configure file.
    cd blad/trunk
    mkdir config
    glibtoolize --force --copy
    aclocal
    autoheader
    automake --add-missing --copy
    autoconf
    • Note: You may need to install automake and autoconf.
    • Note: Observe MAC OS users must use glibtoolize instead of libtoolize.
  4. Prepare GMP for MAPLE. We need this specific gmp.h header file. We assume it is downloaded in the DifferentialAlgebra directory. For the GMP dynamic library, we reuse the one of MAPLE.
    cd $HOME/DifferentialAlgebra
    mkdir maplegmp
    mkdir maplegmp/include
    mkdir maplegmp/lib
    mv gmp.h maplegmp/include
    ln -s /Library/Frameworks/Maple.framework/Versions/16/bin.APPLE_UNIVERSAL_OSX/libmgmp.dylib maplegmp/lib/libgmp.dylib
    • Note: The specific gmp.h header file is provided for convenience. It was built following the instructions given at this page.
    • Note: At the last step above, the symbolic link holds the standard libgmp.dylib name while its target holds the nonstandard libmgmp.dylib name.
  5. Configure BLAD for your machine
    cd $HOME/DifferentialAlgebra
    mkdir blad-build
    cd blad-build
    ../blad/configure --prefix=$HOME/DifferentialAlgebra/blad-install --with-gmp=$HOME/DifferentialAlgebra/maplegmp
    • Note: svn users should call ../blad/trunk/configure at line 4.
  6. Compile and install BLAD, creating thereby the blad-install directory and the files blad-install/lib/libblad.dylib
    make
    make install
    • Note: make check is not supposed to work with this version of GMP.
  7. Recover the source code of BMI and create thereby the bmi directory (see remarks at step 2).
  8. [svn users only] Create the bmi/trunk/configure file (see remarks at step 3).
    cd bmi/trunk
    mkdir config
    glibtoolize --force --copy
    aclocal
    autoheader
    automake --add-missing --copy
    autoconf
  9. Configure BMI for your machine
    cd $HOME/DifferentialAlgebra
    mkdir bmi-build
    cd bmi-build
    ../bmi/configure --prefix=$HOME/DifferentialAlgebra/bmi-install --with-blad=$HOME/DifferentialAlgebra/blad-install --with-gmp=$HOME/DifferentialAlgebra/maplegmp --enable-maple=yes
    • Note: svn users should call ../bmi/trunk/configure at line 4.
    • Note: To be on the safe side, you could specify the MAPLE to be used at the beginning of line 4, starting the command by: MAPLE=/Library/Frameworks/Maple.framework/Versions/16/bin/maple ../bmi/configure
  10. Compile and install BMI, creating thereby the bmi-install directory and the files bmi-install/lib/libbmi.dylib
    make
    make install
    • Note: the experimental DifferentialAlgebra0 package is created and installed in the bmi-install/maple directory.
  11. [optional] Test the libraries are correctly built.
    otool -L $HOME/DifferentialAlgebra/blad-install/lib/libblad.dylib
    ...
    libmgmp.dylib (compatibility version 8.0.0, current version 8.1.0)
    ...
    nm $HOME/DifferentialAlgebra/blad-install/lib/libblad.dylib | grep gmp
    U ___maple_gmp_get_memory_functions
    U ___maple_gmp_set_memory_functions
    U ___maple_gmpn_lshift
    ...
    • Note: In the result of the first command, one should see libmgmp, not libgmp. In the result of the second command, one should see the ___maple_ prefix before all GMP functions.
  12. Change the MAPLE dynamic libraries. Please, read carefully the notes below before proceeding.
    cd /Library/Frameworks/Maple.framework/Versions/16/bin.APPLE_UNIVERSAL_OSX
    mv libblad.dylib libblad.dylib.orig
    mv libbmi.so libbmi.so.orig
    ln -s $HOME/DifferentialAlgebra/blad-install/lib/libblad.0.dylib libblad.dylib
    ln -s $HOME/DifferentialAlgebra/bmi-install/lib/libbmi.0.dylib libbmi.so
    • Note: Depending on your installation, you may need to become a superuser before modifying the files, or to use the sudo command.
    • Note: Lines 2 and 3 rename the original dynamic libraries, for safety. Make sure they were successfully performed before proceeding.
    • Note: Lines 4 and 5 replace the old libraries by symbolic links to the new ones. Let us explain the idea which lies under these commands. The symbolic links should have the same name as the old dynamic libraries. In the blad-install/lib and bmi-install/lib directories, there are actual dynamic libraries and various symbolic links. Using ls -l and looking at the sizes of the files, it is easy to find out the names of the actual dynamic libraries. The symbolic links should point to these libraries.
  13. Final test. It the following command fails, then something went wrong and you may want to replace the symbolic links libblad.dylib and libbmi.so by the original files, in the MAPLE bin.APPLE_UNIVERSAL_OSX directory (see former step).
    $ maple
    > with (DifferentialAlgebra):
    > R := DifferentialRing (derivations = [x], blocks = [y]);
  14. Using the experimental DifferentialAlgebra0 package. It is sufficient to modify the MAPLE libname variable, so that it mentions the $HOME/DifferentialAlgebra/bmi-install/maple directory. Observe that shell variables have to be replaced by their values. Here is an example.
    $ maple
    > libname := "/home/boulier/DifferentialAlgebra/bmi-install/maple", libname:
    > integrate := DifferentialAlgebra0:-Integrate;
    • Note: Both packages DifferentialAlgebra and DifferentialAlgebra0 take advantage of the new libraries. They can be used at the same time.
  15. Next time you want to update BLAD and BMI, it is sufficient to update the source codes of BLAD and BMI (svn users only need to perform svn update commands), to recompile them and to reinstall them in blad-install and bmi-install.

Windows

Download the blad-windows-* and bmi-windows-* tarballs from the BLAD page and this one.

  1. Obtain the two dynamic libraries blad.dll and bmi.dll, plus the MAPLE library files maple.ind, maple.lib and maple.hdb containing the experimental DifferentialAlgebra0 package, for your platform. There are two possible methods
    • Compile BLAD, BMI and create the MAPLE library files using the instructions provided in the tarballs
    • Use the files provided in the tarballs. However, beware to the version of MAPLE actually used to build bmi.dll.
  2. Replace the old blad.dll and bmi.dll by the new ones. It is recommended to make a copy of the old files before replacement. These files are located in a directory called bin.win or bin.X86_64_WINDOWS, depending on the architecture of the machine. The location of this directory can be determined using the kernelopts(bindir) command, in MAPLE.
  3. Using the experimental DifferentialAlgebra0 package. It is sufficient to list the directory containing the MAPLE library files in the MAPLE libname variable.

How to extend DifferentialAlgebra0

To be done