HPX入门教程 假设您使用的是PBS或slurm.这些在HPC社区中可能很常见,但作为开发人员,我更习惯这里的场景是你可以安装的几台机器.
现在不是很明显是否需要像slurm这样的调度程序来利用多个物理机器或者只是方便管理集群.
我知道你可以在运行HPX应用程序时使用-l标志模拟多个地点(例如参见这个问题)我想要的是在2个节点上运行相同的应用程序并让它们相互通信.
告诉HPX需要的最低要求是:
这是另一台具有此IP地址的计算机,您可以向其发送任务吗?
或者,达到这个阶段的最低浆液配置是什么?
安装slurm很容易找到一个简单的2节点示例.虽然这个链接到播客可能会有所帮助
我还假设HPX的parcel端口只能在TCP上工作而无需安装任何额外的东西(例如MPI).它是否正确?
更新 我觉得我越来越近但我仍然缺少一些东西.首先我使用的是hello_world示例.难道它对于2节点测试来说太简单了吗?我希望类似的输出在同一节点上运行2个地点:
APP=$HPX/bin/hello_world
$APP --hpx:node 0 --hpx:threads 4 -l2 &
$APP --hpx:node 1 --hpx:threads 4
Run Code Online (Sandbox Code Playgroud)
样本输出:
hello world from OS-thread 2 on locality 0 hello world from OS-thread 0 on locality 0 hello world from OS-thread 1 on locality 1 hello world from OS-thread 3 on locality 1 hello world from OS-thread 2 on locality 1 hello world from OS-thread 1 on locality 0 hello world …
我正在查看一些与n3960标准提案有关的代码,并注意到一些函数具有没有名称的参数,但具有完整的函数定义.有人可以解释这是怎么回事吗?
例:
template <typename ExPolicy, typename IteratorTag>
void test_for_each(ExPolicy const& policy, IteratorTag) //just IteratorTag, no name?
{
BOOST_STATIC_ASSERT(hpx::parallel::is_execution_policy<ExPolicy>::value);
typedef std::vector<std::size_t>::iterator base_iterator;
typedef test::test_iterator<base_iterator, IteratorTag> iterator;
std::vector<std::size_t> c(10000);
std::iota(boost::begin(c), boost::end(c), std::rand());
hpx::parallel::for_each(policy,
iterator(boost::begin(c)), iterator(boost::end(c)),
[](std::size_t& v) {
v = 42;
});
// verify values
std::size_t count = 0;
std::for_each(boost::begin(c), boost::end(c),
[](std::size_t v) {
HPX_TEST_EQ(v, std::size_t(42));
++count;
});
HPX_TEST_EQ(count, c.size());
}
Run Code Online (Sandbox Code Playgroud)