From bc1d9df3bc8c933d1586df7f82807686665adad5 Mon Sep 17 00:00:00 2001 From: Marcus Cuda Date: Mon, 4 Apr 2011 21:33:54 +0800 Subject: [PATCH] native: finished acml provider - needs more testing --- .gitignore | 2 + build/t4.bat | 7 ++ .../ACMLWrapperTests/ACMLWrapperTests.csproj | 102 ++++++++++++++++++ .../Complex/AcmlLinearAlgebraProviderTests.cs | 51 +++++++++ .../AcmlLinearAlgebraProviderTests.cs | 51 +++++++++ .../Double/AcmlLinearAlgebraProviderTests.cs | 51 +++++++++ .../Properties/AssemblyInfo.cs | 36 +++++++ .../Single/AcmlLinearAlgebraProviderTests.cs | 51 +++++++++ src/NativeWrappers/Windows/NativeWrappers.sln | 14 +++ .../Acml/AcmlLinearAlgebraProvider.Common.tt | 7 ++ .../Acml/AcmlLinearAlgebraProvider.Complex.tt | 13 +++ .../AcmlLinearAlgebraProvider.Complex32.tt | 13 +++ .../Acml/AcmlLinearAlgebraProvider.double.tt | 13 +++ .../Acml/AcmlLinearAlgebraProvider.float.tt | 13 +++ .../LinearAlgebra/Acml/SafeNativeMethods.tt | 8 ++ src/Numerics/Numerics.csproj | 54 ++++++++++ src/UnitTests/Setup.cs | 4 + 17 files changed, 490 insertions(+) create mode 100644 src/NativeWrappers/Windows/ACMLWrapperTests/ACMLWrapperTests.csproj create mode 100644 src/NativeWrappers/Windows/ACMLWrapperTests/Complex/AcmlLinearAlgebraProviderTests.cs create mode 100644 src/NativeWrappers/Windows/ACMLWrapperTests/Complex32/AcmlLinearAlgebraProviderTests.cs create mode 100644 src/NativeWrappers/Windows/ACMLWrapperTests/Double/AcmlLinearAlgebraProviderTests.cs create mode 100644 src/NativeWrappers/Windows/ACMLWrapperTests/Properties/AssemblyInfo.cs create mode 100644 src/NativeWrappers/Windows/ACMLWrapperTests/Single/AcmlLinearAlgebraProviderTests.cs create mode 100644 src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Common.tt create mode 100644 src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex.tt create mode 100644 src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex32.tt create mode 100644 src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.double.tt create mode 100644 src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.float.tt create mode 100644 src/Numerics/Algorithms/LinearAlgebra/Acml/SafeNativeMethods.tt diff --git a/.gitignore b/.gitignore index 5dafca16..c11ecba8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ bin *.XML Version1.cs src/Numerics/Algorithms/LinearAlgebra/Mkl/*.cs +src/Numerics/Algorithms/LinearAlgebra/Acml/*.cs +src/Numerics/Algorithms/LinearAlgebra/GotoBlas/*.cs out \ No newline at end of file diff --git a/build/t4.bat b/build/t4.bat index a4bdd742..0d11a9b7 100644 --- a/build/t4.bat +++ b/build/t4.bat @@ -26,4 +26,11 @@ GOTO prepare "%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\GotoBlas\GotoBlasLinearAlgebraProvider.float.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\GotoBlas\GotoBlasLinearAlgebraProvider.float.tt "%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\GotoBlas\SafeNativeMethods.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\GotoBlas\SafeNativeMethods.tt +"%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.Common.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.Common.tt +"%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.Complex.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.Complex.tt +"%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.Complex32.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.Complex32.tt +"%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.double.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.double.tt +"%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.float.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\Acml\AcmlLinearAlgebraProvider.float.tt +"%common%\Microsoft Shared\TextTemplating\10.0\texttransform.exe" -out ..\src\Numerics\Algorithms\LinearAlgebra\Acml\SafeNativeMethods.cs -P "%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.5" ..\src\Numerics\Algorithms\LinearAlgebra\Acml\SafeNativeMethods.tt + set common = \ No newline at end of file diff --git a/src/NativeWrappers/Windows/ACMLWrapperTests/ACMLWrapperTests.csproj b/src/NativeWrappers/Windows/ACMLWrapperTests/ACMLWrapperTests.csproj new file mode 100644 index 00000000..c5e97dfb --- /dev/null +++ b/src/NativeWrappers/Windows/ACMLWrapperTests/ACMLWrapperTests.csproj @@ -0,0 +1,102 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB} + Library + Properties + ACMLWrapperTests + ACMLWrapperTests + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + x86 + + + + ..\..\..\..\out\debug\Net40\MathNet.Numerics.dll + + + ..\..\..\..\lib\NUnit.2.5.9\nunit.framework.dll + + + + + + + + + + + + + AssertHelpers.cs + + + Complex32\LinearAlgebraProviderTests.cs + + + Complex\LinearAlgebraProviderTests.cs + + + Double\LinearAlgebraProviderTests.cs + + + Single\LinearAlgebraProviderTests.cs + + + + + + + + + + MathNET.Numerics.ACML.dll + Always + + + libacml_mp_dll.dll + Always + + + libifcoremd.dll + Always + + + libiomp5md.dll + Always + + + libmmd.dll + Always + + + + + \ No newline at end of file diff --git a/src/NativeWrappers/Windows/ACMLWrapperTests/Complex/AcmlLinearAlgebraProviderTests.cs b/src/NativeWrappers/Windows/ACMLWrapperTests/Complex/AcmlLinearAlgebraProviderTests.cs new file mode 100644 index 00000000..9e8bdf2a --- /dev/null +++ b/src/NativeWrappers/Windows/ACMLWrapperTests/Complex/AcmlLinearAlgebraProviderTests.cs @@ -0,0 +1,51 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009-2010 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +using MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex; + +namespace MathNet.Numerics.AcmlBlasWrapperTests.LinearAlgebra.Complex +{ + using NUnit.Framework; + + /// + /// Unit test container for the ACML linear algebra provider. + /// + [TestFixture] + public class AcmlLinearAlgebraProviderTests : LinearAlgebraProviderTests + { + /// + /// Initializes a new instance of the class. + /// + public AcmlLinearAlgebraProviderTests() + { + Control.LinearAlgebraProvider = new Algorithms.LinearAlgebra.Acml.AcmlLinearAlgebraProvider(); + } + } +} diff --git a/src/NativeWrappers/Windows/ACMLWrapperTests/Complex32/AcmlLinearAlgebraProviderTests.cs b/src/NativeWrappers/Windows/ACMLWrapperTests/Complex32/AcmlLinearAlgebraProviderTests.cs new file mode 100644 index 00000000..dba706df --- /dev/null +++ b/src/NativeWrappers/Windows/ACMLWrapperTests/Complex32/AcmlLinearAlgebraProviderTests.cs @@ -0,0 +1,51 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009-2010 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +using MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex; + +namespace MathNet.Numerics.AcmlBlasWrapperTests.LinearAlgebra.Complex32 +{ + using NUnit.Framework; + + /// + /// Unit test container for the ACML linear algebra provider. + /// + [TestFixture] + public class AcmlLinearAlgebraProviderTests : LinearAlgebraProviderTests + { + /// + /// Initializes a new instance of the class. + /// + public AcmlLinearAlgebraProviderTests() + { + Control.LinearAlgebraProvider = new Algorithms.LinearAlgebra.Acml.AcmlLinearAlgebraProvider(); + } + } +} diff --git a/src/NativeWrappers/Windows/ACMLWrapperTests/Double/AcmlLinearAlgebraProviderTests.cs b/src/NativeWrappers/Windows/ACMLWrapperTests/Double/AcmlLinearAlgebraProviderTests.cs new file mode 100644 index 00000000..5ef39b30 --- /dev/null +++ b/src/NativeWrappers/Windows/ACMLWrapperTests/Double/AcmlLinearAlgebraProviderTests.cs @@ -0,0 +1,51 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009-2010 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +using MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex; + +namespace MathNet.Numerics.AcmlBlasWrapperTests.LinearAlgebra.Double +{ + using NUnit.Framework; + + /// + /// Unit test container for the ACML linear algebra provider. + /// + [TestFixture] + public class AcmlLinearAlgebraProviderTests : LinearAlgebraProviderTests + { + /// + /// Initializes a new instance of the class. + /// + public AcmlLinearAlgebraProviderTests() + { + Control.LinearAlgebraProvider = new Algorithms.LinearAlgebra.Acml.AcmlLinearAlgebraProvider(); + } + } +} diff --git a/src/NativeWrappers/Windows/ACMLWrapperTests/Properties/AssemblyInfo.cs b/src/NativeWrappers/Windows/ACMLWrapperTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..6c6a3455 --- /dev/null +++ b/src/NativeWrappers/Windows/ACMLWrapperTests/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ACMLWrapperTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("ACMLWrapperTests")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("83801bc7-d554-4669-aede-db11d009d283")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NativeWrappers/Windows/ACMLWrapperTests/Single/AcmlLinearAlgebraProviderTests.cs b/src/NativeWrappers/Windows/ACMLWrapperTests/Single/AcmlLinearAlgebraProviderTests.cs new file mode 100644 index 00000000..ac5dd2f7 --- /dev/null +++ b/src/NativeWrappers/Windows/ACMLWrapperTests/Single/AcmlLinearAlgebraProviderTests.cs @@ -0,0 +1,51 @@ +// +// Math.NET Numerics, part of the Math.NET Project +// http://numerics.mathdotnet.com +// http://github.com/mathnet/mathnet-numerics +// http://mathnetnumerics.codeplex.com +// +// Copyright (c) 2009-2010 Math.NET +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +using MathNet.Numerics.UnitTests.LinearAlgebraProviderTests.Complex; + +namespace MathNet.Numerics.AcmlBlasWrapperTests.LinearAlgebra.Single +{ + using NUnit.Framework; + + /// + /// Unit test container for the ACML linear algebra provider. + /// + [TestFixture] + public class AcmlLinearAlgebraProviderTests : LinearAlgebraProviderTests + { + /// + /// Initializes a new instance of the class. + /// + public AcmlLinearAlgebraProviderTests() + { + Control.LinearAlgebraProvider = new Algorithms.LinearAlgebra.Acml.AcmlLinearAlgebraProvider(); + } + } +} diff --git a/src/NativeWrappers/Windows/NativeWrappers.sln b/src/NativeWrappers/Windows/NativeWrappers.sln index c1a2e939..0862f0ac 100644 --- a/src/NativeWrappers/Windows/NativeWrappers.sln +++ b/src/NativeWrappers/Windows/NativeWrappers.sln @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GotoBLAS2WrapperTests", "Go EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ACMLWrapper", "ACMLWrapper\ACMKWrapper.vcxproj", "{8774BCBE-27D0-44D2-A1B3-8ED705E252CB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACMLWrapperTests", "ACMLWrapperTests\ACMLWrapperTests.csproj", "{8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -96,6 +98,18 @@ Global {8774BCBE-27D0-44D2-A1B3-8ED705E252CB}.Release|Win32.Build.0 = Release|Win32 {8774BCBE-27D0-44D2-A1B3-8ED705E252CB}.Release|x64.ActiveCfg = Release|x64 {8774BCBE-27D0-44D2-A1B3-8ED705E252CB}.Release|x64.Build.0 = Release|x64 + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Debug|Win32.ActiveCfg = Debug|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Debug|x64.ActiveCfg = Debug|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Release|Any CPU.Build.0 = Release|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Release|Win32.ActiveCfg = Release|Any CPU + {8A42A7F3-23C0-46D9-9DBA-B9039EB3C8EB}.Release|x64.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Common.tt b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Common.tt new file mode 100644 index 00000000..b24683c1 --- /dev/null +++ b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Common.tt @@ -0,0 +1,7 @@ +<#@ template language="C#" debug="true" #> +<#@ output extenstion="cs" #> +<# string library = "Acml";#> +<# string title = "AMD Core Math Library (ACML)";#> +<# string dataType = "Common";#> +<#@ include file="..\native.header.include" #> +<#@ include file="..\native.footer.include" #> diff --git a/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex.tt b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex.tt new file mode 100644 index 00000000..344ec72f --- /dev/null +++ b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex.tt @@ -0,0 +1,13 @@ +<#@ template language="C#" debug="true" #> +<#@ output extenstion="cs" #> +<# string library = "Acml";#> +<# string title = "AMD Core Math Library (ACML)";#> +<# string dataType = "Complex";#> +<# string zero = "Complex.Zero";#> +<# string one = "Complex.One";#> +<# string prefix = "z";#> +<# string svd_work = "2 * Math.Min(rowsA, columnsA) + Math.Max(rowsA, columnsA)";#> +<#@ include file="..\native.header.include" #> +<#@ include file="..\native.dotproduct.include" #> +<#@ include file="..\native.generic.include" #> +<#@ include file="..\native.footer.include" #> diff --git a/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex32.tt b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex32.tt new file mode 100644 index 00000000..abbe1f5b --- /dev/null +++ b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.Complex32.tt @@ -0,0 +1,13 @@ +<#@ template language="C#" debug="true" #> +<#@ output extenstion="cs" #> +<# string library = "Acml";#> +<# string title = "AMD Core Math Library (ACML)";#> +<# string dataType = "Complex32";#> +<# string zero = "Complex32.Zero";#> +<# string one = "Complex32.One";#> +<# string prefix = "c";#> +<# string svd_work = "2 * Math.Min(rowsA, columnsA) + Math.Max(rowsA, columnsA)";#> +<#@ include file="..\native.header.include" #> +<#@ include file="..\native.dotproduct.include" #> +<#@ include file="..\native.generic.include" #> +<#@ include file="..\native.footer.include" #> diff --git a/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.double.tt b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.double.tt new file mode 100644 index 00000000..07105f25 --- /dev/null +++ b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.double.tt @@ -0,0 +1,13 @@ +<#@ template language="C#" debug="true" #> +<#@ output extenstion="cs" #> +<# string library = "Acml";#> +<# string title = "AMD Core Math Library (ACML)";#> +<# string dataType = "double";#> +<# string zero = "0.0";#> +<# string one = "1.0";#> +<# string prefix = "d";#> +<# string svd_work = "Math.Max((3 * Math.Min(rowsA, columnsA)) + Math.Max(rowsA, columnsA), 5 * Math.Min(rowsA, columnsA))";#> +<#@ include file="..\native.header.include" #> +<#@ include file="..\native.dotproduct.include" #> +<#@ include file="..\native.generic.include" #> +<#@ include file="..\native.footer.include" #> diff --git a/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.float.tt b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.float.tt new file mode 100644 index 00000000..64815dfa --- /dev/null +++ b/src/Numerics/Algorithms/LinearAlgebra/Acml/AcmlLinearAlgebraProvider.float.tt @@ -0,0 +1,13 @@ +<#@ template language="C#" debug="true" #> +<#@ output extenstion="cs" #> +<# string library = "Acml";#> +<# string title = "AMD Core Math Library (ACML)";#> +<# string dataType = "float";#> +<# string zero = "0.0f";#> +<# string one = "1.0f";#> +<# string prefix = "s";#> +<# string svd_work = "Math.Max((3 * Math.Min(rowsA, columnsA) + Math.Max(rowsA, columnsA)), 5 * Math.Min(rowsA, columnsA))";#> +<#@ include file="..\native.header.include" #> +<#@ include file="..\native.dotproduct.include" #> +<#@ include file="..\native.generic.include" #> +<#@ include file="..\native.footer.include" #> diff --git a/src/Numerics/Algorithms/LinearAlgebra/Acml/SafeNativeMethods.tt b/src/Numerics/Algorithms/LinearAlgebra/Acml/SafeNativeMethods.tt new file mode 100644 index 00000000..93d0dfac --- /dev/null +++ b/src/Numerics/Algorithms/LinearAlgebra/Acml/SafeNativeMethods.tt @@ -0,0 +1,8 @@ +<#@ template language="C#" debug="true" #> +<#@ output extenstion="cs" #> +<# string namespaceSuffix = "Acml"; + string library = "ACML"; +#> +<#@ include file="..\safe.native.common.include" #> + } +} \ No newline at end of file diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj index fe36952f..6ffc7d6b 100644 --- a/src/Numerics/Numerics.csproj +++ b/src/Numerics/Numerics.csproj @@ -70,6 +70,30 @@ + + TextTemplatingFileGenerator + AcmlLinearAlgebraProvider.Common.cs + + + TextTemplatingFileGenerator + AcmlLinearAlgebraProvider.Complex.cs + + + TextTemplatingFileGenerator + AcmlLinearAlgebraProvider.Complex32.cs + + + TextTemplatingFileGenerator + AcmlLinearAlgebraProvider.double.cs + + + TextTemplatingFileGenerator + AcmlLinearAlgebraProvider.float.cs + + + TextTemplatingFileGenerator + SafeNativeMethods.cs + TextTemplatingFileGenerator @@ -126,6 +150,36 @@ SafeNativeMethods.cs + + AcmlLinearAlgebraProvider.Common.tt + True + True + + + AcmlLinearAlgebraProvider.Complex.tt + True + True + + + AcmlLinearAlgebraProvider.Complex32.tt + True + True + + + AcmlLinearAlgebraProvider.double.tt + True + True + + + AcmlLinearAlgebraProvider.float.tt + True + True + + + SafeNativeMethods.tt + True + True + GotoBlasLinearAlgebraProvider.Common.tt True diff --git a/src/UnitTests/Setup.cs b/src/UnitTests/Setup.cs index a2954b4a..8d588224 100644 --- a/src/UnitTests/Setup.cs +++ b/src/UnitTests/Setup.cs @@ -49,5 +49,9 @@ public class Setup { MathNet.Numerics.Control.LinearAlgebraProvider = new MathNet.Numerics.Algorithms.LinearAlgebra.GotoBlas.GotoBlasLinearAlgebraProvider(); } + else if (provider.Contains("acml")) + { + MathNet.Numerics.Control.LinearAlgebraProvider = new MathNet.Numerics.Algorithms.LinearAlgebra.Acml.AcmlLinearAlgebraProvider(); + } } }