OpenMPI的底层实现: 我们知道,OpenMPI应用起来还是比较简单的,但是如果让我自己来实现一个MPI的并行计算,你会怎么设计呢?————这就涉及到比较底层的东西了. 回想起我们最简单的代码,通过comm_rank来决定做不同的事情,那么这个comm_rank是怎么得到的呢? 源代码从哪里看起?在百度,谷歌都没有找到关于源码剖析的一些资料,只能先找找头文件 mpi.h搜索找到了在ompi/include/mpi.h.in中的一个文件,查找一下最简单的函数 MPI_Comm_size 和 M…
template <class InputIterator, class ForwardIterator>inline ForwardIterator uninitialized_copy(InputIterator first, InputIterator last,ForwardIterator result) 函数使用示例 #include <algorithm> #include <iostream> #include <memory> #inclu…
接着上一篇的疑问,我们说道,会执行 try_kill_peers 函数,它的函数定义在 ompi_mpi_abort.c 下: // 这里注释也说到了,主要是杀死在同一个communicator的进程(不包括自己) /* * Local helper function to build an array of all the procs in a * communicator, excluding this process. * * Killing a just the indicated pe…
因为比较常用的是 TCP 协议,所以在 opal/mca/btl/tcp/btl_tcp.h 头文件中找到对应的 struct mca_btl_tcp_component_t { mca_btl_base_component_3_0_0_t super; /**< base BTL component */ uint32_t tcp_addr_count; /**< total number of addresses */ uint32_t tcp_num_btls; /**< numb…
上一篇文章说道,初始化失败会有一个函数调用: ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, message); 所以这里简单地进入了 ompi_mpi_errors_are_fatal_comm_handler 函数:看到其头文件 errhandler_predefined.h : #ifndef OMPI_ERRHANDLER_PREDEFINED_H #define OMPI_ERRHANDLER_PREDEFINED_H #inclu…
SGI  STL的list的函数的实现源码大致如下: //list 不能使用sort函数,因为list的迭代器是bidirectional_iterator, 而sort //sort函数要求random_access_iterator template<class T,class Alloc> void list<T,Alloc>::sort() { //如果元素个数小于等于1,直接返回 if(node->next==node||node->next->next…
MPI中的网络通信的原理,需要解决以下几个问题: 1. MPI使用什么网络协议进行通信? 2.中央数据库是存储在哪一台机器上? 3.集群中如果有一台机器挂掉了是否会影响其他机器? 参考: https://aosabook.org/en/openmpi.html 根据MCA, 每个框架下的模块是可变的,例如, btl (字节传输层)框架下有N多个网络协议模块: 既然是可变的,但是我们运行的时候都没有传入对应的选择参数,也就是说明有默认值. 官方文档也说了,工程师和科学家尽可能帮我们选择一个合理的默…
上一篇文章中说道,我们在 rte.h 中发现了有价值的说明: 我们一块一块来分析,首先看到第一块,关于 Process name Object: * (a) Process name objects and operations // 进程名Object * 1. Definitions for integral types ompi_jobid_t and ompi_vpid_t. * The jobid must be unique for a given MPI_COMM_WORLD ca…
1. inline Mat::Mat(int _rows, int _cols, int _type) : size(&rows) { initEmpty();//将data.cols.rows等初始化为0 create(_rows, _cols, _type); } 2. inline Mat::Mat(int _rows, int _cols, int _type, const Scalar& _s) : size(&rows) { initEmpty(); create(_r…
一.前言 大约在夏季,我们谈过ES6的Promise(详见here),其实在ES6前jQuery早就有了Promise,也就是我们所知道的Deferred对象,宗旨当然也和ES6的Promise一样,通过链式调用,避免层层嵌套,如下: //jquery版本大于1.8 function runAsync(){ var def = $.Deferred(); setTimeout(function(){ console.log('I am done'); def.resolve('whatever'…