小编Teó*_*alo的帖子

谐波进展总和c ++ MPI和OpenMP

我正在尝试使用MPI和opemMP一起制作并行版本的"Harmonic Progression Sum"问题.但输出是彼此不同的过程.

有人可以帮我完成这个问题吗?

并行程序:(MPI和OpenMP)

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <time.h>
#include <omp.h>
#include <mpi.h>

#define d 10    //Numbers of Digits (Example: 5 => 0,xxxxx)
#define n 1000  //Value of N (Example: 5 => 1/1 + 1/2 + 1/3 + 1/4 + 1/5)

using namespace std;

double t_ini, t_fim, t_tot;

int getProcessId(){
    int rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    return rank;
}

int numberProcess(){
    int numProc;
    MPI_Comm_size(MPI_COMM_WORLD, &numProc);
    return numProc;
}

void reduce(long unsigned int digits1 [])
{ …
Run Code Online (Sandbox Code Playgroud)

c++ parallel-processing mpi openmp openmpi

6
推荐指数
1
解决办法
788
查看次数

标签 统计

c++ ×1

mpi ×1

openmp ×1

openmpi ×1

parallel-processing ×1