Пример #1
0
Файл: mpi.go Проект: rwl/mpi
func Allreduce_float64(sendbuf, recvbuf []float64, op C.MPI_Op, comm C.MPI_Comm) {

	// mpi communication call
	err := C.MPI_Allreduce(
		unsafe.Pointer(&sendbuf[0]), unsafe.Pointer(&recvbuf[0]),
		C.int(len(sendbuf)), FLOAT64, op, comm)

	if err != 0 {
		log.Fatal(err)
	}
}
Пример #2
0
//Allreduce
//Combines values from all processes and distributes the result back to all processes.
func Allreduce(sendBuffer interface{},
	recvBuffer interface{},
	count int,
	dataType Datatype,
	op Op,
	comm Comm) int {

	sendBufferVoidPointer := Get_void_ptr(sendBuffer)
	recvBufferVoidPointer := Get_void_ptr(recvBuffer)

	err := C.MPI_Allreduce(sendBufferVoidPointer,
		recvBufferVoidPointer,
		C.int(count),
		C.MPI_Datatype(dataType),
		C.MPI_Op(op),
		C.MPI_Comm(comm))

	return int(err)
}
Пример #3
0
// AllReduceInt64 : MPI_Allreduce for int64
func AllReduceInt64(comm Comm, in, out *int64, n int, op Op) {
	C.MPI_Allreduce(unsafe.Pointer(in), unsafe.Pointer(out), C.int(n), MPI_i64, SUM, comm)
}
Пример #4
0
// AllReduceInt64 : MPI_Allreduce for int64
func AllReduceInt64(comm Comm, in, out *int64, n int, op Op) {
	C.MPI_Allreduce(unsafe.Pointer(in), unsafe.Pointer(out), C.int(n), C.MPI_Datatype(MPI_i64), C.MPI_Op(SUM), C.MPI_Comm(comm))
}