Global Array(GA)函数库的安装、使用

一、GA库的安装

  1. 解压
  2. configure
./configure F77=gfortran CC=gcc CXX=g++ MPIF77=mpif77 MPICXX=mpicxx MPICC=mpicc \
  --with-gnu-ld --enable-cxx --prefix=/home/jrf/tools/ga-5.8  \
  --exec-prefix=/home/jrf/tools/ga-5.8 --with-blas=/home/jrf/tools/openblas \
  --with-mpi-pr=1
  1. make && make install
注意
  1. --with-mpi-pr=1将ARMCI的网络模式设置为Mpi-pr的模式,这是最被推荐的选项。若不设置mpi-pr,默认使用mpi-ts,不支持异步通信,可能会在和PETSc函数库结合的时候导致通信死锁。

    使用了mpi-pr 之后,每个节点会有一个进程被用来专门负责通信,不支持实际的计算任务。在该模式下编程时,需要使用GA的函数创建一个新的通信子,该通信子包含的仅有可以用来执行计算的进程,在使用boost和PETSc的时候需要将GA生成的通信子传递给这两个函数库。具体看这里

二、部分函数使用介绍

1.put get的使用

void GlobalArray::put(int lo[], int hi[], void *buf, int ld[])

Type Name Description Intent
int* lo[ndim] array of starting indices for global array section input
int* hi[ndim] array of ending indices for global array section input
void* buf pointer to the local buffer array where the data is input
int* ld[ndim-1] array specifying leading dimensions/strides/extents for buffer array input

(1)二维数组

当为2维数组时,这里的lo、hi包含的第一个数字和第二个数字分别为行索引、列索引,而ld仅有一个数字,代表总列数(因为用的是c++,数组是按行存储的。)

完整的测试算例:

#include<boost/mpi.hpp>
#include<iostream>
#include"ga++.h"
#include<macdecls.h>
#include<vector>
namespace mpi = boost::mpi;

void test_get();

int main(int argc, char **argv){
   
    int heap = 3000000, stack = 3000000;
    size_t size = 0; 
    
    GA::Initialize(argc, argv, heap, stack
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值