小编use*_*317的帖子

通过MPI传递Armadillo C++矩阵

我需要通过MPI 传递由Armadillo C++ Matrix Library定义的矩阵或复杂矩阵类型.有什么好办法可以解决这个问题?我想过尝试:

  1. 写基质中以某种阵列,然后发送
    行/的那个列,方法脱/再构建的阵列任一侧MPI_send/recv

  2. 使用类似的东西MPI_BYTE

谢谢

更新

所以我试图通过在一个节点上发送和接收一个简单的例子来实现其他方案.

translate.cpp

    #include <mpi.h>
    #include <armadillo>
    #include <vector> 
    #include <cstdlib>

    using namespace std; 
    using namespace arma; 
    using std::vector; 

    class ArmadilloMPI
    {
        public:
            ArmadilloMPI(int nRows, int nCols)
            {
                this->nRows = nRows;
                this->nCols = nCols; 
                realArray = (double **)malloc(nCols * nRows * sizeof(double*));
                imArray = (double **)malloc(nCols * nRows * sizeof(double*));
            }

            ~ArmadilloMPI()
            {
                free(realArray[0]);
                free(realArray);
                free(imArray[0]);
                free(imArray);
            }

            double **realArray; 
            double **imArray; 
            int nCols; …
Run Code Online (Sandbox Code Playgroud)

c++ matrix mpi armadillo

5
推荐指数
1
解决办法
1235
查看次数

标签 统计

armadillo ×1

c++ ×1

matrix ×1

mpi ×1