问题描述
我正在尝试使用MPI.Net软件包运行我的简单.Net控制台应用程序。我有以下例外情况:
"Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'MPI,Version=1.4.0.0,Culture=neutral,PublicKeyToken=29b4a045737654fe' or one of its dependencies. The system cannot find the file specified.
File name: 'MPI,PublicKeyToken=29b4a045737654fe'
at MPIProject.Program.Main(String[] args)"
我在启动的每个进程中都有这个
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MPI;
namespace MPIProject
{
class Program
{
static void Main(string[] args)
{
using (new MPI.Environment(ref args))
{
if (MPI.Environment.Finalized)
{
Console.WriteLine(Communicator.world.Rank);
}
}
}
}
}
解决方法
当我尝试在 MPI.NET 存储库中运行 PingPong example program 时,我遇到了类似的异常。我最终这样做了:
- 在 Visual Studio 中创建一个新的控制台应用项目
- 添加 MPI.NET nuget 包(通过在解决方案资源管理器中右键单击项目,选择“管理 NuGet 包”,然后搜索“MPI.NET”)
- 将示例程序复制到我的主类中。
在那之后,程序运行了。我认为存储库与项目一起存储的元数据中的引用有问题。