mpich2 visual studio 2013链接器错误(mpich2 visual studio 2013 linker error)
我想用c ++方式使用mpi,所以我从mpich2的例子中得到了cxxpi.cxx的代码:
#include "mpi.h" #include <iostream> #include <math.h> using namespace std; double f(double); double f(double a) { return (4.0 / (1.0 + a*a)); } int main(int argc, char **argv) { int n, myid, numprocs, i; double PI25DT = 3.141592653589793238462643; double mypi, pi, h, sum, x; double startwtime = 0.0, endwtime; int namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI::Init(argc, argv); numprocs = MPI::COMM_WORLD.Get_size(); myid = MPI::COMM_WORLD.Get_rank(); MPI::Get_processor_name(processor_name, namelen); cout << "Process " << myid << " of " << numprocs << " is on " << processor_name << endl; n = 10000; /* default # of rectangles */ if (myid == 0) startwtime = MPI::Wtime(); MPI::COMM_WORLD.Bcast(&n, 1, MPI_INT, 0); h = 1.0 / (double) n; sum = 0.0; /* A slightly better approach starts from large i and works back */ for (i = myid + 1; i <= n; i += numprocs) { x = h * ((double) i - 0.5); sum += f(x); } mypi = h * sum; MPI::COMM_WORLD.Reduce(&mypi, &pi, 1, MPI_DOUBLE, MPI_SUM, 0); if (myid == 0) { endwtime = MPI::Wtime(); cout << "pi is approximately " << pi << " Error is " << fabs(pi - PI25DT) << endl; cout << "wall clock time = " << endwtime - startwtime << endl; } MPI::Finalize(); return 0; }
我设置了VS2013项目的属性:
- 属性> VC ++目录>包含目录>(添加路径) “C:\ Program Files \ MPICH2 \ include”
- 属性> VC ++目录>库目录>(添加路径) “C:\ Program Files \ MPICH2 \ lib”
- 属性>链接器>输入>附加依赖项>(添加了lib) “mpi.lib”
- 属性>平台>(设置为) 活动(x64)
而且我有未解决的引用链接器错误。 具有相同属性的cpi.c代码编译没有问题。 我认为问题出在链接器需要的库中,但我试图找到它们的组合,但它没有解决问题。 MPICH2有这样的库:cxx.lib,fmpich2.lib,fmpich2g.lib,irlog2rlog.lib,mpe.lib,mpi.lib,rlog.lib,TraceInput.lib。 如何使程序正常工作?
I want to use mpi in c++ way, so I have code of cxxpi.cxx from mpich2 examples:
#include "mpi.h" #include <iostream> #include <math.h> using namespace std; double f(double); double f(double a) { return (4.0 / (1.0 + a*a)); } int main(int argc, char **argv) { int n, myid, numprocs, i; double PI25DT = 3.141592653589793238462643; double mypi, pi, h, sum, x; double startwtime = 0.0, endwtime; int namelen; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI::Init(argc, argv); numprocs = MPI::COMM_WORLD.Get_size(); myid = MPI::COMM_WORLD.Get_rank(); MPI::Get_processor_name(processor_name, namelen); cout << "Process " << myid << " of " << numprocs << " is on " << processor_name << endl; n = 10000; /* default # of rectangles */ if (myid == 0) startwtime = MPI::Wtime(); MPI::COMM_WORLD.Bcast(&n, 1, MPI_INT, 0); h = 1.0 / (double) n; sum = 0.0; /* A slightly better approach starts from large i and works back */ for (i = myid + 1; i <= n; i += numprocs) { x = h * ((double) i - 0.5); sum += f(x); } mypi = h * sum; MPI::COMM_WORLD.Reduce(&mypi, &pi, 1, MPI_DOUBLE, MPI_SUM, 0); if (myid == 0) { endwtime = MPI::Wtime(); cout << "pi is approximately " << pi << " Error is " << fabs(pi - PI25DT) << endl; cout << "wall clock time = " << endwtime - startwtime << endl; } MPI::Finalize(); return 0; }
I set properties of my VS2013 project:
- Properties > VC++ Directories > Include Directories > (added path) "C:\Program Files\MPICH2\include"
- Properties > VC++ Directories > Library Directories > (added path) "C:\Program Files\MPICH2\lib"
- Properties > Linker > Input > Additional Dependencies > (added lib) "mpi.lib"
- Properties > Platform > (setted to) Active(x64)
And I've got unresolved reference linker errors. The code of cpi.c with the same properties compiles with no problems. I think the problem is in libs which linker needs, but I tried to find a combination of them, but it didn't solve the problem. MPICH2 has such libs: cxx.lib, fmpich2.lib, fmpich2g.lib, irlog2rlog.lib, mpe.lib, mpi.lib, rlog.lib, TraceInput.lib. How to make the program work correct?
原文:https://stackoverflow.com/questions/30151062
最满意答案
假设您的状态字段为
Status
,它将类似于:<script type="text/x-kendo-tmpl" id="template"> <div class="product #if (Status == 'Active') {# active #} else {# inactive #}#"> <h3>#:CustomerVersion#</h3> <h5>#:Rank#</h5> <h3>#:AccountType#</h3> </div> </script>
可在此处找到正在运行的示例: http : //dojo.telerik.com/@mmillican/iDOSu
Assuming your status field is
Status
it would be similar to this:<script type="text/x-kendo-tmpl" id="template"> <div class="product #if (Status == 'Active') {# active #} else {# inactive #}#"> <h3>#:CustomerVersion#</h3> <h5>#:Rank#</h5> <h3>#:AccountType#</h3> </div> </script>
A running sample can be found here: http://dojo.telerik.com/@mmillican/iDOSu
相关问答
更多-
您可以使用委托的索引属性来确定此委托元素是偶数还是奇数,并使用它来更改委托的颜色。 ListView { anchors.fill: parent model: 3 delegate: Rectangle { width: 20 height: 30 color: index % 2 == 0 ? "blue" : "black" } } You can use the index property of the delegat ...
-
现在你有特殊要求,它不再简单 ,你不能使用SimpleAdapter来达到你所要求的效果。 您必须扩展BaseAdapter并且在getView()方法中,您可以执行以下操作: if (position == 0) { convertView.setBackground(color1); } else { convertView.setBackground(color2); } 或者如果你想要的是一个Header ,你可以毫不费力地使用ListView.addHeaderV ...
-
你可以使用js函数和逻辑。 { category: "Africa", value: 17.6, color: GetColor } 这里的例子 这是你在找什么? You can use js function and logic do there. { category: "Africa", value: 17.6, color: GetColor } example here Is that what you are looking for?
-
kendoui过滤模板(kendoui filtering template)[2022-03-31]
改变了我的方法,因为我不喜欢模板中的逻辑: -
function listRankBarOnDataBound(arg) { //Fires when the list view has received data from the data source and it is already rendered. // get a reference to the list view widget var listView = $("#ListRankBar").data("kendoListView"); // selec ...
-
您需要创建自己的适配器,如ArrayAdapter,每行都有自己的布局。 然后,在该适配器中,您可以为getView方法中的每个项目设置颜色。 You will need to create your own adapter like ArrayAdapter, with your own layout for each row. Then, in that adapter, you can set the colors for each item in the getView method.
-
如何为kendoUI中的不同listview项设置不同的颜色(How to set different color for different listview item in kendoUI)[2023-07-06]
假设您的状态字段为Status ,它将类似于: ... -
您需要制作自定义适配器并在项目中记住已检查状态。 或者,您可以使用SparseBooleanArray来记住已检查项目的位置,当您向视图膨胀时,检查是否已选中该项目/位置并根据后者设置背景。 请参阅此处的其他帖子以获得类似的解决方案 You need to make a custom adapter and in your item remember the checked state. Alternatively you can use a SparseBooleanArray to remember t ...
-
你需要这样的课程: public class StillSimpleAdapter extends SimpleAdapter { public StillSimpleAdapter(Context context, List extends Map
> data, int resource, String[] from, int[] to) { super(context, data, resource, from, to); } @Override p ... -
v.setTextColor(Color.argb(125,175,43,30)) v.setTextColor(Color.argb(125,175,43,30))