Esempio n. 1
0
File: mpi.go Progetto: adk9/go-mpi
func Recv(buf interface{}, count int, datatype MPI_Datatype, source int,
	tag int, comm MPI_Comm, status MPI_Status) int {
	switch ptr := buf.(type) {
	case *int:
		ret := C.MPI_Recv(unsafe.Pointer(ptr), C.int(count), datatype,
			C.int(source), C.int(tag), comm, status)
		return int(ret)
	}
	return 0
}
Esempio n. 2
0
File: mpi.go Progetto: rwl/mpi
func Recv_float64(recvbuf []float64, source, tag int, comm C.MPI_Comm) {

	err := C.MPI_Recv(
		unsafe.Pointer(&recvbuf[0]), C.int(len(recvbuf)), FLOAT64,
		C.int(source), C.int(tag), comm, nil)

	if err != 0 {
		log.Fatal(err)
	}
}
Esempio n. 3
0
func RecvFloat32(data []float32, source, tag int) Status {
	var status C.MPI_Status
	C.MPI_Recv(unsafe.Pointer(&data[0]), C.int(len(data)), MPI_FLOAT, C.int(source), C.int(tag),
		COMM_WORLD, &status)
	var s Status
	s.Source = int(status.MPI_SOURCE)
	s.Tag = int(status.MPI_TAG)
	s.Error = int(status.MPI_ERROR)
	return s
}
Esempio n. 4
0
File: mpi.go Progetto: rwl/mpi
func Recv_int32(recvbuf []int32, source, tag int, comm C.MPI_Comm) {

	err := C.MPI_Recv(
		unsafe.Pointer(&recvbuf[0]), C.int(len(recvbuf)), INT32,
		C.int(source), C.int(tag), comm, nil)

	if err != 0 {
		log.Fatal(err)
	}
}
Esempio n. 5
0
//Recv
//Performs a standard-mode blocking receive.
func Recv(buffer interface{},
	count int,
	dataType Datatype,
	source int,
	tag int,
	comm Comm) (Status, int) {

	var status C.MPI_Status
	bufferVoidPointer := Get_void_ptr(buffer)

	err := C.MPI_Recv(bufferVoidPointer,
		C.int(count),
		C.MPI_Datatype(dataType),
		C.int(source),
		C.int(tag),
		C.MPI_Comm(comm),
		&status)

	return Status(status), int(err)
}