go-mpi are GO bindings for the Message Passing Interface (MPI Forum).
MPI is a standard but the different implementations differ in some details. At the moment go-mpi support Open MPI and MPICH version 2.
To tell go where to look for mpi.h and mpi library, use the CGO_CFLAGS and CGO_LDFALG environment variable to indicate respectively.
For Open MPI:
export CGO_LDFLAGS='-L/usr/lib/openmpi -lmpi'
go install go-mpi/MPI
For MPICH:
You can find paths of mpi.h and mpi library through command:
$ mpichversion
Assume mpi.h dir is "/usr/local/include", mpi library dir is "/usr/local/lib", you could compile go-mpi/MPI like the following:
export CGO_CFLAGS='-I/usr/local/include'
export CGO_LDFLAGS='-L/usr/local/lib -lmpich'
go install go-mpi/MPI
Firstly you should import "go-mpi/MPI" in your go-mpi application.
import "go-mpi/MPI"
The syntax of MPI invokes in go-mpi is similar to it in C-binding MPI implementations.
<package_name>.Mpi_function(arguments)
For example:
err = MPI.Init(&os.Args)
err = MPI.Irecv(recvBuffer, count, MPI.INT, 0, 1, MPI.COMM_WORLD, &request)