mumps-src

Crates.iomumps-src
lib.rsmumps-src
version0.1.2+5.7.2
sourcesrc
created_at2024-01-19 08:34:08.72105
updated_at2024-07-08 14:28:49.02714
descriptionBuild Mumps as a crate.
homepage
repositoryhttps://github.com/Maroon502/mumps-src
max_upload_size
id1105090
size34,344
Maroon (Maroon502)

documentation

README

Mumps-src

Package Documentation License

Mumps-src crate is a *-src crate. This links Mumps libraries to executable build by cargo, but does not provide Rust bindings. Mumps is built with OpenBLAS (openblas-src)(Optional) or Intel-MKL (intel-mkl-src)(Optional).

By this package, you don't need to worry about installing Mumps in the system, and it's a package for all platforms(linux).

Mumps (MUltifrontal Massively Parallel sparse direct Solver) is is a package for solving systems of linear equations of the form Ax = b, where A is a square sparse matrix that can be either unsymmetric, symmetric positive definite, or general symmetric, on distributed memory computers.

Note: Only sequential version is supported now. And Metis is not supported now.

Usage

  1. Add the following to your Cargo.toml:

    [dependencies]
    mumps-src = "\*"
    
  2. Add the following to your lib.rs:

    extern crate mumps_src;
    

This package does not provide bindings.

Configure

Features

The following Cargo features are supported:

  • default to openblas-static feature and d_arith feature;

At least 1 following feature need to be selected:

  • openblas-system to link to OpenBLAS system library;
  • openblas-static to link to OpenBLAS statically;
  • intel-mkl-system to link to intel-mkl system library;
  • intel-mkl-static to link to intel-mkl statically;

There's 4 kinds of precision for mumps, and at least 1 following feature need to be selected:

  • s_arith single, real, precision;
  • d_arith double, real, precision;
  • c_arith single, complex, precision;
  • z_arith double, complex, precision;

Environment

The package build from the source and link statically by default. It also provide the following environment variables to allow users to link to system library customly:

  • CARGO_MUMPS_STATIC to link to Mumps statically;
  • CARGO_MUMPS_SYSTEM to link to Mumps system library;

Set the environment variable to 1 to enable the feature. For example, to link to system library dynamically, set CARGO_${LIB_NAME}_SYSTEM to 1; to link to system library statically, set both CARGO_${LIB_NAME}_SYSTEM and CARGO_${LIB_NAME}_STATIC to 1.

If you enable OpenBLAS(openblas-src), you can also pass env to make by OPENBLAS_*. Read more at here

Others

If you enable OpenBLAS(openblas-src), you can link OpenBLAS staticaly or dynamicly by disable default feature and select what you like, for example:

mumps-src = { version = "\*", default-features = no, features = ["d_arith", "openblas-system"] }

Similarly, you can link Intel MKL(intel-mkl-src) with:

mumps-src = { version = "\*", default-features = no, features = ["d_arith", "intel-mkl-system"] }

If you want more configuration, you can try this:

mumps-src = { version = "\*", default-features = no, features = ["d_arith"] }
intel-mkl-src = { version = "\*", features = ["mkl-static-lp64-seq"] }

Cross Compilation

If you use OpenBLAS(openblas-src), you need to set OPENBLAS_CC, OPENBLAS_FC, OPENBLAS_HOSTCC, and OPENBLAS_TARGET to pass env to OpenBLAS, ref:openblas-src and OpenBLAS. For example:

export OPENBLAS_TARGET=ARMV8
export OPENBLAS_HOSTCC=gcc
export OPENBLAS_CC=aarch64-linux-gnu-gcc
export OPENBLAS_FC=aarch64-linux-gnu-gfortran

You can compile it for the other target by providing the --target option to cargo build.

Target supported
arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabi
armv7-unknown-linux-gnueabihf
armv7-unknown-linux-musleabi
armv7-unknown-linux-musleabihf
aarch64-unknown-linux-gnu
aarch64-unknown-linux-musl
riscv64gc-unknown-linux-gnu
x86_64-ps-windows-msvc
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
others not test

Note: Features intel-mkl-* can only be used for x86_64-*. Features openblas-static can only be used for linux.

Contribution

Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in LICENSE.

Commit count: 13

cargo fmt