Skip to content

jywang616/ParallelProgramming_WordCount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ParallelProgramming_WordCount

Using pthread/openmp/mpi to solve the problem

Environment: Visual Studio 2019

To start with parallel programming:

Pthread:

Building environment of Pthread

Pthread.zip

Mpi:

Building environment of Mpi

Introduction of Mpi(with demo)

Download

Test code:

#include<stdio.h>
#include<mpi.h>

int main(int argc, char* argv[])
{
    int myid, numprocs, namelen;
    char processor_name[MPI_MAX_PROCESSOR_NAME];
    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &myid);
    MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
    MPI_Get_processor_name(processor_name, &namelen);
    if (myid == 0) printf("number of processes: %d\n", numprocs);
    printf("%s: Hello world from process %d \n", processor_name, myid);
    MPI_Finalize();
    return 0;
}

Q:MPI是可以传map类型的吗sos 套娃失败————

About

Using pthread/openmp/mpi to solve the problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages