Running with Mono

All the tutorials given in the Infer.NET user guide run on the latest version of Mono (2.4.2) on both the Windows and Linux platforms. However there is a Mono Compiler bug which means that the Mixture of Gaussians tutorial needs to call a different method or be compiled on Windows with the C# compiler.

Also note that the Examples Browser is currently not supported under Mono.

Compile time bug

The tutorial MixtureOfGaussians.cs produces a compile time error with the mono gmcs compiler. This Compiletime error is already logged as a bug on Bugzilla https://bugzilla.novell.com/show_bug.cgi?id=439125 with ID number 439125 and description: CS0309 with generic methods where constraints have generic parameters. The output is from the compiler is shown below. Compiling with the .NET CSharp compiler csc.exe will eradicate this error but still produces the Runtime error described above.

[i-ellang@CAMRESUNXA01 MONO_STUFF]$
gmcs /target:exe /out:MixtureGaussians.exe /reference:Microsoft.GLEE.All.dll /reference:Infer.Compiler.dll /reference:Infer.Runtime.dll MixtureGaussians.cs

MixtureGaussians.cs(51,58): error CS0309: The type `MicrosoftResearch.Infer.Distributions.Discrete' must be convertible to
`MicrosoftResearch.Infer.Distributions.IDistribution<MicrosoftResearch.Infer.Distributions.Discrete>' in order to use it as parameter
`Distribution' in the generic type or method `MicrosoftResearch.Infer.Distributions.Distribution<int>.Array<Distribution>(Distribution[])'
/home/i-ellang/MONO_STUFF/Infer.Runtime.dll (Location of the symbol related to previous error)
/home/i-ellang/MONO_STUFF/Infer.Runtime.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
[i-ellang@CAMRESUNXA01 MONO_STUFF]$

Work around

As mentioned above the Mixture of Gaussians tutorial can be compiled on Windows with the C# compiler csc.exe. However an easy work around is provided for Linux users, in the form of an alternative method call as shown below: The type of DistributionArray to be returned must be specified, as the method Distribution.FromArray returns an object which is then inferred using the var keyword.

var v = (DistributionArray<Discrete, int>)Distribution.FromArray(zinit);

replaces the call:

IDistribution<int[]> v = Distribution<int>.Array<Discrete>(zinit);

Mono Migration Analyser

The Mono Migration Analyzer (MoMA) tool identifies issues you may have when porting your .Net application to Mono. It helps pinpoint platform specific calls (P/Invoke) and areas that are not yet supported by the Mono project. The Output from a MoMA scan shows plattform specific calls to Lapack.dll, User32.dll and Kernel32.dll and Atlas.dll when analyzing Infer.Runtime.dll. However these libraries are not called by the factors or distributions. They are only used by methods which support fast matrix operations and are of no benefit unless working with large Vector Gaussian distributions.

Last modified at 9/18/2009 3:07 PM  by John Guiver 
©2009 Microsoft Corporation. All rights reserved.  Terms of Use | Trademarks | Privacy Statement