This tutorial is from the MBrace Starter Kit.
It is very simple to use C# DLLs, native DLLs and any nuget packages in your cloud computations. For C# DLLs you just download and reference the packages as normal in your F# scripting or other client application. The DLLs for the packages are automatically uploaded to the cloud workers as needed. In a sense, you don't need to do anything special.
In this tutorial, you first reference some C# DLLs from the Math.NET NuGet package. You also use native binaries from the Intel MKL library.
First, you reference and use the packages on the local machine:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
Next, run the code on MBrace. Note that the DLLs from the packages are uploaded automatically.
The following inverts 100 150x150 matrices using C# code on the cluster.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
Next, you run the same work using the Interl MKL native DLLs.
To upload native DLLs, register their paths as native dependencies. These will be included with all uploaded dependencies of the session.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
Now run a much larger job: 1000 250x250 matrices, inverted using Intel MKL:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
In this tutorial, you've learned how to use C# DLLs, NuGet packages and
native DLLs in your MBrace computations. You've also compared performance between native code and
C# code running on your cluster for one particular example.
Continue with further samples to learn more about the MBrace programming model.
Full name: 5-using-csharp-and-native-dlls.cluster
Full name: Config.GetCluster
Gets or creates a new Thespian cluster session.
Full name: 5-using-csharp-and-native-dlls.matrix1
member Add : scalar:'T -> Matrix<'T> + 3 overloads
member Append : right:Matrix<'T> -> Matrix<'T> + 1 overload
member At : row:int * column:int -> 'T + 1 overload
member Cholesky : unit -> Cholesky<'T>
member Clear : unit -> unit
member ClearColumn : columnIndex:int -> unit
member ClearColumns : [<ParamArray>] columnIndices:int -> unit
member ClearRow : rowIndex:int -> unit
member ClearRows : [<ParamArray>] rowIndices:int -> unit
member ClearSubMatrix : rowIndex:int * rowCount:int * columnIndex:int * columnCount:int -> unit
Full name: MathNet.Numerics.LinearAlgebra.Matrix<_>
val double : value:'T -> double (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.double
type double = Double
Full name: Microsoft.FSharp.Core.double
type Random =
new : unit -> Random + 1 overload
member Next : unit -> int + 2 overloads
member NextBytes : buffer:byte -> unit
member NextDouble : unit -> float
Full name: System.Random
Random() : unit
Random(Seed: int) : unit
Full name: 5-using-csharp-and-native-dlls.vector1
member AbsoluteMaximum : unit -> 'T
member AbsoluteMaximumIndex : unit -> int
member AbsoluteMinimum : unit -> 'T
member AbsoluteMinimumIndex : unit -> int
member Add : scalar:'T -> Vector<'T> + 3 overloads
member At : index:int -> 'T + 1 overload
member Clear : unit -> unit
member ClearSubVector : index:int * count:int -> unit
member Clone : unit -> Vector<'T>
member CoerceZero : threshold:float -> unit + 1 overload
Full name: MathNet.Numerics.LinearAlgebra.Vector<_>
Full name: 5-using-csharp-and-native-dlls.product
Full name: 5-using-csharp-and-native-dlls.check
Full name: 5-using-csharp-and-native-dlls.csharpMathJob
static member BlockSize : int with get, set
static member CheckDistributionParameters : bool with get, set
static member ConfigureAuto : unit -> unit
static member LinearAlgebraProvider : ILinearAlgebraProvider with get, set
static member MaxDegreeOfParallelism : int with get, set
static member NativeProviderPath : string with get, set
static member TaskScheduler : TaskScheduler with get, set
static member ThreadSafeRandomNumberGenerators : bool with get, set
static member UseManaged : unit -> unit
static member UseMultiThreading : unit -> unit
Full name: MathNet.Numerics.Control
Full name: 5-using-csharp-and-native-dlls.csharpMathResults
Full name: 5-using-csharp-and-native-dlls.contentDir
Full name: 5-using-csharp-and-native-dlls.firstNativeJob
Control.UseNativeMKL(?consistency: Providers.LinearAlgebra.Mkl.MklConsistency, ?precision: Providers.LinearAlgebra.Mkl.MklPrecision, ?accuracy: Providers.LinearAlgebra.Mkl.MklAccuracy) : unit
Full name: 5-using-csharp-and-native-dlls.nativeMathJob
Full name: 5-using-csharp-and-native-dlls.timeNative
Full name: 5-using-csharp-and-native-dlls.timeCSharp
Full name: 5-using-csharp-and-native-dlls.perfRatio