/// <summary>
        /// Initialize and verify that the provided is indeed available.
        /// If not, fall back to alternatives like the managed provider
        /// </summary>
        public override void InitializeVerify()
        {
            OpenBlasProvider.Load(minRevision: 1);

            int linearAlgebra = SafeNativeMethods.query_capability((int)ProviderCapability.LinearAlgebraMajor);

            // we only support exactly one major version, since major version changes imply a breaking change.
            if (linearAlgebra != 1)
            {
                throw new NotSupportedException(string.Format("OpenBLAS Native Provider not compatible. Expecting linear algebra v1 but provider implements v{0}.", linearAlgebra));
            }
        }
示例#2
0
        /// <summary>
        /// Initialize and verify that the provided is indeed available.
        /// If not, fall back to alternatives like the managed provider
        /// </summary>
        public override void InitializeVerify()
        {
            int revision = OpenBlasProvider.Load(hintPath: _hintPath);

            if (revision < MinimumCompatibleRevision)
            {
                throw new NotSupportedException(FormattableString.Invariant($"OpenBLAS Native Provider revision r{revision} is too old. Consider upgrading to a newer version. Revision r{MinimumCompatibleRevision} and newer are supported."));
            }

            int linearAlgebra = SafeNativeMethods.query_capability((int)ProviderCapability.LinearAlgebraMajor);

            // we only support exactly one major version, since major version changes imply a breaking change.
            if (linearAlgebra != 1)
            {
                throw new NotSupportedException(FormattableString.Invariant($"OpenBLAS Native Provider not compatible. Expecting linear algebra v1 but provider implements v{linearAlgebra}."));
            }
        }
示例#3
0
 /// <summary>
 /// Try to find out whether the provider is available, at least in principle.
 /// Verification may still fail if available, but it will certainly fail if unavailable.
 /// </summary>
 public override bool IsAvailable()
 {
     return(OpenBlasProvider.IsAvailable(hintPath: _hintPath));
 }
示例#4
0
 public override string ToString()
 {
     return(OpenBlasProvider.Describe());
 }
示例#5
0
 /// <summary>
 /// Frees memory buffers, caches and handles allocated in or to the provider.
 /// Does not unload the provider itself, it is still usable afterwards.
 /// </summary>
 public override void FreeResources()
 {
     OpenBlasProvider.FreeResources();
 }
 /// <summary>
 /// Frees memory buffers, caches and handles allocated in or to the provider.
 /// Does not unload the provider itself, it is still usable afterwards.
 /// </summary>
 public void FreeResources()
 {
     OpenBlasProvider.FreeResources();
 }
 /// <summary>
 /// Try to find out whether the provider is available, at least in principle.
 /// Verification may still fail if available, but it will certainly fail if unavailable.
 /// </summary>
 public override bool IsAvailable()
 {
     return(OpenBlasProvider.IsAvailable(minRevision: 1));
 }