简体   繁体   English

初学者ILNumerics:在VS2012下安装

[英]Beginner ILNumerics: install under VS2012

I am very much interested in ILNUmerics and would like to try the free version, but I am having troubles. 我对ILNUmerics非常感兴趣,想尝试免费版,但我遇到了麻烦。

I have started with a console application and was trying to run the 'hello ilnumerics'console application but I noticed that VS fails to find MKL libraries. 我已经开始使用控制台应用程序,并试图运行'hello ilnumerics'console应用程序,但我注意到VS无法找到MKL库。

I am using VS2012 under Windwos 8 (through Bootcamp on a MacBook Pro mid 2010; should it be relevant); 我在Windwos 8下使用VS2012(在2010年中期的MacBook Pro上通过Bootcamp;它是否相关); I have installed the NuGet Packages extension from the Project solution. 我已从Project解决方案中安装了NuGet Packages扩展。 Then right-click on references in the solution explorer, 'Manage Nu Get Packages', fron online/search found ilnumerics in various versions. 然后右键单击解决方案资源管理器中的引用,“管理Nu获取包”,在线/搜索各种版本的ilnumerics。 I chose 'ILNumerics' and install. 我选择'ILNumerics'并安装。 I got 'ILNumerics' and 'ILNumerics.Native' added to my project. 我将'ILNumerics'和'ILNumerics.Native'添加到我的项目中。 Then I can see ILNumerics under 'References' in Solution Explorer and also get two new folders /bin32/ and /bin64/ they both contain two DLLs named: libiomp5md.dll and mkl_custom.dll. 然后我可以在解决方案资源管理器中的“引用”下看到ILNumerics并获得两个新文件夹/ bin32 /和/ bin64 /它们都包含两个名为libiomp5md.dll和mkl_custom.dll的DLL。 I have checked their 'Copy to Ouput Directory' property and they are all set to 'Copy if newer'. 我检查了他们的'复制到输出目录'属性,他们都设置为'复制如果更新'。

Apparently mkl_custom is not found. 显然找不到mkl_custom。 I write the following code, taken from the quickstart guide: 我从快速入门指南中编写了以下代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ILNumerics;

namespace ConsoleApplication3
{

  class Program  : ILMath
{
    static void Main(string[] args)
    {

        ILArray<double> A = array<double>
            (new double[] { 1,1,1,1,1,2,3,4,1,3,6,10,1,4,10,20} ,4, 4);
        ILArray<double> B = counter(4, 2);

        ILArray<double> Result = linsolve(A, B);
        Console.Out.WriteLine("A: " + Environment.NewLine +
                A.ToString());

            Console.Out.WriteLine("B: " + Environment.NewLine + B.ToString());

            Console.ReadKey();
        }
    }
}

and I get this exception: An unhandled exception of type 'System.DllNotFoundException' occurred in ILNumerics.dll 我得到此异常:ILNumerics.dll中出现未处理的“System.DllNotFoundException”类型异常

Additional information: Unable to load DLL 'mkl_custom': The specified module could not be found. 附加信息:无法加载DLL'mkl_custom':找不到指定的模块。 (Exception from HRESULT: 0x8007007E) (来自HRESULT的异常:0x8007007E)

If I do not invoke linsolve the ToString method of ILArray does work: if I comment // ILArray Result = linsolve(A, B); 如果我不调用linsolve,ILArray的ToString方法确实有效:如果我发表评论// ILArray Result = linsolve(A,B);

I get the two matrices printed on the screen. 我在屏幕上打印了两个矩阵。

I have also tried to compute the determinant of a matrix and got the same exception: apparently any time I call mkl_custom VS is not capable to find it. 我也尝试计算矩阵的行列式并得到相同的异常:显然我任何时候调用mkl_custom VS都无法找到它。

Any help/hint, please? 有任何帮助/提示吗?

Also, is it necessary to install ILNumerics through NuGet on any project added to the solution? 另外,是否有必要在添加到解决方案的任何项目中通过NuGet安装ILNumerics? Would it be possible to install it locally once for all and then add the reference if necessary? 是否可以在本地安装一次,然后在必要时添加引用?

Two options: 两种选择:

1) Make sure, all binaries are accesible as intended: ILNumerics uses AnyCPU targets and chooses the platform dependend subfolder by adding the "bin32" / "bin64" directories to the PATH envoronment variable on startup. 1)确保所有二进制文件都可以按预期访问:ILNumerics使用AnyCPU目标并通过在启动时将“bin32”/“bin64”目录添加到PATH envoronment变量来选择平台dependend子文件夹。 Possibly there is something failing on your machine? 您的机器可能会出现故障? You can make sure by placing the correct binaries (depending on your platform) directly into the output path manually. 您可以通过手动将正确的二进制文件(取决于您的平台)直接放入输出路径来确保。

2) In case the error persists: mkl_custom.dll depends on some other dlls itself. 2)如果错误仍然存​​在:mkl_custom.dll依赖于其他一些dll本身。 One (libiomp5md.dll) is delivered with the ILNumerics nuget package. 一个(libiomp5md.dll)随ILNumerics nuget包一起提供。 Others are expected to exist on your system: KERNEL32.DLL and MSVCR110.DLL. 其他人应该存在于您的系统上:KERNEL32.DLL和MSVCR110.DLL。 Make sure, you have these! 确保你有这些! If the kernel dll was missing -> call it a miracle and reinstall your system. 如果内核DLL丢失了 - >称之为奇迹并重新安装系统。 If the msvcr110 is missing -> go here and install the "Visual C++ Redistributable for Visual Studio 2012". 如果缺少msvcr110 - >转到此处并安装“Visual C ++ Redistributable for Visual Studio 2012”。

In case the problem persists, you may file a bug on the ILNumerics bugtracker , because, the runtime should be there, as you wrote you are using VS2012. 如果问题仍然存在,您可能会在ILNumerics 错误跟踪器上提交错误 ,因为运行时应该在那里,正如您所写,您使用的是VS2012。 Possibly it is a versioning problem though. 可能这是一个版本问题。

EDIT: Since version 4.0 ILNumerics does not deploy the native binaries in bin32/ bin64/ subfolder anymore but installs all native dependencies systemwide into the GAC and System32/WOW folders. 编辑:从版本4.0开始,ILNumerics不再在bin32 / bin64 /子文件夹中部署本机二进制文件,而是将系统范​​围内的所有本机依赖项安装到GAC和System32 / WOW文件夹中。 The old scheme will still work (for compatibility with old projects) though. 旧方案仍然有效(为了与旧项目兼容)。 But it is not necessary anymore to deal with any dependancies for ILNumerics explicitly. 但是,没有必要明确地处理ILNumerics的任何依赖性。 They should simply be found at runtime. 它们应该只是在运行时找到。

Like numbers303 said, ILNumerics.dll can't find a required dependency. 就像number303所说,ILNumerics.dll无法找到所需的依赖项。 You can brute force fixing this dependency by copying the required DLLs to the same directory as the ILNumerics.dll as a post build step, but I think there's a more elegant solution. 您可以通过将所需的DLL复制到与ILNumerics.dll相同的目录作为后期构建步骤来强制修复此依赖关系,但我认为这是一个更优雅的解决方案。

A VS2010 .NET console solution gets created by default with the x86 configuration. 默认情况下,使用x86配置创建VS2010 .NET控制台解决方案。 Compiling and running the ILNumerics example Hello ILNumerics! 编译并运行ILNumerics示例Hello ILNumerics! code with this configuration results in a DLL not found exception (mkl_custom.dll). 具有此配置的代码导致DLL找不到异常(mkl_custom.dll)。

Re-targeting the solution via configuration manager to 'Any CPU' fixed the issue for me: In Solution Explorer, right click on the solution and select properties. 通过配置管理器将解决方案重新定位到“任何CPU”为我解决了问题:在解决方案资源管理器中,右键单击解决方案并选择属性。 Select Configuration Properties and click on the Configuration Manager... button in the upper right hand corner. 选择Configuration Properties,然后单击右上角的Configuration Manager ...按钮。 Make sure that the project that uses ILNumerics has the 'Any CPU' selected. 确保使用ILNumerics的项目选择了“任何CPU”。 If 'Any CPU' isn't available as a selection, select '' from the pulldown and create an 'Any CPU' platform based on your current platform. 如果“任何CPU”无法作为选择,请从下拉列表中选择“”并根据您当前的平台创建“任何CPU”平台。 Usually this just means accepting the default in the 'New Project Platform' dialog. 通常这只是意味着接受“新建项目平台”对话框中的默认值。 You'll probably also want to modify the 'Active solution platform:' to contain an 'Any CPU' target as well. 您可能还想修改“Active solution platform:”以包含“Any CPU”目标。

Rebuild/run. 重建/运行。

In my case it helped to install "Visual C++ Redistributable for Visual Studio 2012" although I work with Visual Studio 2010 with the corresponding "Visual C++ Redistributable for Visual Studio 2010" installed. 在我的例子中,它帮助安装了“Visual C ++ Redistributable for Visual Studio 2012”,尽管我使用Visual Studio 2010并安装了相应的“Visual C ++ Redistributable for Visual Studio 2010”。 Which worked fine as long as the mkl_custom.dll is not needed. 只要不需要mkl_custom.dll,哪个工作正常。 But colleagues of mine dosn't have this problem without having the 2012 Redistributable installed. 但是如果没有安装2012 Redistributable,我的同事就不会遇到这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM