Forge 2014-08-18

Creating new repositories in FusionForge

Forge has a peculiar project management system where only one repository is allowed for project. This has a downside that putting everything into one folder leads to mixed history, unnecessary conflicts and a greater complexity in general. However creating a separate Forge project for each repository is also suboptimal, since it requires setting up a separate set of permissions.

Creating repository manually

The part that does not support multiple repositories is the Forge UI. Since GIT repository is just a folder, we can create it manually on the server.

In the commands below we assume that the Forge username is george, the project is called stator and we want to create a repository called ournewrepo.

# SSH in. The login is the Forge login, it may or may not be the same as
# your LDAP:
$ ssh george@scm.forge.imag.fr

# Go into the project directory.
$ cd /var/lib/gforge/chroot/scmrepos/stator
# We can see already existing git repos:
$ ls
smtlibinterface.git stator.git ...

# [mkdir] is not installed on the server, but [cp] is:
$ cp -r mir.git ournewrepo.git
$ cd ournewrepo.git
$ rm -rf *
$ git init --bare

ONumerical 2014-04-01

https://github.com/cheshire/onumerical

OCaml library featuring:

  • Sparse Linear Expressions

    Functorized module for dealing with linear expressions over any number type and over any variable type (Zarith rationals, floats, integers for numbers and strings for variables are supported out-of-the-box):

    module Expression = Expression_f.Make(Str_var)(Float_number);;
    let a = Expression.of_assoc_list_and_const
    [("x", 1.0), ("y", 1.0)] 0.0;;
    let b = Expression.of_assoc_list_and_const
    [("x", -1.0), ("z", 3.0)] 5.0;;
    Expression.(to_string (a ++ b));;
    (* Output: 1 (y) + 3 (z) + 5 *)
    
  • Generic vectors, represented using arrays:

    module Vector = Vector_f.Make(Float_number);;
    let a = [| 0.0; 3.0; 4.0 |];;
    let b = [| 2.0; 8.0; 2.0 |];;
    Vector.(to_string (a -- b));;
    (* Output: [-2.0    -5.0    2.0] *)
    
  • Generic matrixes represented using arrays:

    module Matrix = Matrix_f.Make(Float_number);;
    let a = [|
    [|2.0; 3.0; 4.0|];
    [|1.0; 9.0; 1.0|];
    [|0.5; -1.0; 0.0|];
    |];;
    let b = [|
    [|2.0; 3.0; 4.0|];
    [|3.0; 6.0; 3.0|];
    [|0.5; -1.0; 3.0|];
    |];;
    Matrix.(to_string (a *** b))
    (* Output:
    | 15.0    20.0    29.0|
    | 29.5    56.0    34.0|
    |-2.0     -4.5     1.0|
    *)
    
  • Dual Simplex Solver on expressions:

    Solves linear optimization problems which are dual-feasible.

    module Solver = Opt_solver_f.Make(Str_var)(Float_number)
    module Expression = Solver.Expression
    let constraints = [
    ([("x1", -1.0); ("x2", -1.0); ("x3", 2.0)], 3.0);
    ([("x1", -4.0); ("x2", -2.0); ("x3", 1.0)], 4.0);
    ([("x1", 1.0); ("x2", 1.0); ("x3", -4.0)], -2.0);
    ];;
    let opt_problem = Solver.of_constraints_and_objective
    (List.map constraints ~f:(fun (coeffs, const) -> (
        Opt.LessThanZero,
            (Expression.of_assoc_list_and_const coeffs const)
    )))
    (Opt.Maximize
        Expression.of_assoc_list_and_const
            [("x1", -4.0); ("x2", -2.0); ("x3", -1.0)]
            0.0
    );;
    let Opt.Solution solution = Opt.solve opt_problem;;
    solution.primal_var_assignment
    (* output: [("x1", 0.0); ("x2", 4.0, "x3", 0.5)] *)
    

Opam 2014-03-01

OCaml Package Manager

It is notoriously difficult to manually install OCaml packages. The problem becomes worse when you have multiple versions to worry about: constantly changing your findlib.conf, making sure you use the right version at the right time, manually checking all the paths can be a big problem.

In the university lab the problem is complicated even more by the fact that PhD students don't have a root access, and all the installation requests have to go through the sysadmins.

Enter OPAM!

OPAM can solve all of your OCaml packages problems, including

  • Easy, one-line commands for package installation.

    For example, installing LLVM is literally opam install llvm

  • Easy switching between multiple versions of the same library.

  • Access to the latest version of OCaml.

    The version in the Debian repository can lag year behind the current one.

  • And all of the above can be done without the SUDO access!