public static void UseNativeMKL( MklConsistency consistency = MklConsistency.Auto, MklPrecision precision = MklPrecision.Double, MklAccuracy accuracy = MklAccuracy.High) { LinearAlgebraControl.Provider = CreateNativeMKL(consistency, precision, accuracy); }
public static bool TryUseNativeMKL( MklConsistency consistency = MklConsistency.Auto, MklPrecision precision = MklPrecision.Double, MklAccuracy accuracy = MklAccuracy.High) { return(LinearAlgebraControl.TryUse(CreateNativeMKL(consistency, precision, accuracy))); }
public static ILinearAlgebraProvider CreateNativeMKL( MklConsistency consistency = MklConsistency.Auto, MklPrecision precision = MklPrecision.Double, MklAccuracy accuracy = MklAccuracy.High) { return(new MklLinearAlgebraProvider(GetCombinedHintPath(), consistency, precision, accuracy)); }
/// <param name="hintPath">Hint path where to look for the native binaries</param> /// <param name="consistency"> /// Sets the desired bit consistency on repeated identical computations on varying CPU architectures, /// as a trade-off with performance. /// </param> /// <param name="precision">VML optimal precision and rounding.</param> /// <param name="accuracy">VML accuracy mode.</param> internal MklLinearAlgebraProvider(string hintPath, MklConsistency consistency, MklPrecision precision, MklAccuracy accuracy) { _hintPath = hintPath; _consistency = consistency; _precision = precision; _accuracy = accuracy; }
/// <param name="hintPath">Hint path where to look for the native binaries</param> /// <param name="consistency"> /// Sets the desired bit consistency on repeated identical computations on varying CPU architectures, /// as a trade-off with performance. /// </param> /// <param name="precision">VML optimal precision and rounding.</param> /// <param name="accuracy">VML accuracy mode.</param> internal MklLinearAlgebraProvider(string hintPath, MklConsistency consistency, MklPrecision precision, MklAccuracy accuracy) { _hintPath = hintPath != null?Path.GetFullPath(hintPath) : null; _consistency = consistency; _precision = precision; _accuracy = accuracy; }
public MklLinearAlgebraProvider( MklConsistency consistency = MklConsistency.Auto, MklPrecision precision = MklPrecision.Double, MklAccuracy accuracy = MklAccuracy.High) { _consistency = consistency; _precision = precision; _accuracy = accuracy; }
public static void ConfigurePrecision(MklConsistency consistency, MklPrecision precision, MklAccuracy accuracy) { // set numerical consistency, precision and accuracy modes, if supported if (SafeNativeMethods.query_capability((int)ProviderConfig.Precision) > 0) { SafeNativeMethods.set_consistency_mode((int)consistency); SafeNativeMethods.set_vml_mode((uint)precision | (uint)accuracy); } }
/// <summary> /// Use the Intel MKL native provider for linear algebra, with the specified configuration parameters. /// Throws if it is not available or failed to initialize, in which case the previous provider is still active. /// </summary> public static void UseNativeMKL( MklConsistency consistency = MklConsistency.Auto, MklPrecision precision = MklPrecision.Double, MklAccuracy accuracy = MklAccuracy.High) { MklLinearAlgebraControl.UseNativeMKL(consistency, precision, accuracy); MklFourierTransformControl.UseNativeMKL(); MklSparseSolverControl.UseNativeMKL(); }
public static int Load( string hintPath = null, MklConsistency consistency = MklConsistency.Auto, MklPrecision precision = MklPrecision.Double, MklAccuracy accuracy = MklAccuracy.High) { if (_loaded) { return(_nativeRevision); } int a, b; try { NativeProviderLoader.TryLoad(SafeNativeMethods.DllName, hintPath); a = SafeNativeMethods.query_capability(0); b = SafeNativeMethods.query_capability(1); _nativeRevision = SafeNativeMethods.query_capability((int)ProviderConfig.Revision); _nativeX86 = SafeNativeMethods.query_capability((int)ProviderPlatform.x86) > 0; _nativeX64 = SafeNativeMethods.query_capability((int)ProviderPlatform.x64) > 0; _nativeIA64 = SafeNativeMethods.query_capability((int)ProviderPlatform.ia64) > 0; // set numerical consistency, precision and accuracy modes, if supported if (SafeNativeMethods.query_capability((int)ProviderConfig.Precision) > 0) { SafeNativeMethods.set_consistency_mode((int)consistency); SafeNativeMethods.set_vml_mode((uint)precision | (uint)accuracy); } // set threading settings, if supported if (SafeNativeMethods.query_capability((int)ProviderConfig.Threading) > 0) { SafeNativeMethods.set_max_threads(Control.MaxDegreeOfParallelism); } _mklVersion = new Version( SafeNativeMethods.query_capability((int)ProviderConfig.MklMajorVersion), SafeNativeMethods.query_capability((int)ProviderConfig.MklMinorVersion), SafeNativeMethods.query_capability((int)ProviderConfig.MklUpdateVersion)); } catch (DllNotFoundException e) { throw new NotSupportedException("MKL Native Provider not found.", e); } catch (BadImageFormatException e) { throw new NotSupportedException("MKL Native Provider found but failed to load. Please verify that the platform matches (x64 vs x32, Windows vs Linux).", e); } catch (EntryPointNotFoundException e) { throw new NotSupportedException("MKL Native Provider does not support capability querying and is therefore not compatible. Consider upgrading to a newer version.", e); } if (a != 0 || b != -1 || _nativeRevision < MinimumCompatibleRevision) { throw new NotSupportedException("MKL Native Provider too old. Consider upgrading to a newer version."); } _loaded = true; return(_nativeRevision); }
public MklLinearAlgebraProvider() { _consistency = MklConsistency.Auto; _precision = MklPrecision.Double; _accuracy = MklAccuracy.High; }