Exemplo n.º 1
0
//Request_free
//Frees a communication request object.
func Request_free(request Request) (Request, int) {

	cRequest := C.MPI_Request(request)
	err := C.MPI_Request_free(&cRequest)

	return Request(cRequest), int(err)
}
Exemplo n.º 2
0
//Testany
//Tests for completion of any one previously initiated communication in a list.
func Testany(requests []Request) ([]int, []bool, []Status, int) {

	count := len(requests)
	cStatuses := make([]C.MPI_Status, count)
	cFlags := make([]C.int, count)
	cIndex := make([]C.int, count)
	cRequests := make([]C.MPI_Request, count)
	for i := 0; i < count; i++ {
		cRequests[i] = C.MPI_Request(requests[i])
	}

	err := C.MPI_Testany(C.int(count),
		&cRequests[0],
		&cIndex[0],
		&cFlags[0],
		&cStatuses[0])

	statuses := make([]Status, count)
	flags := make([]bool, count)
	index := make([]int, count)
	for i := 0; i < count; i++ {
		statuses[i] = Status(cStatuses[i])
		index[i] = int(cIndex[i])
		if int(cFlags[i]) != 0 {
			flags[i] = true
		} else {
			flags[i] = false
		}
	}

	return index, flags, statuses, int(err)
}
Exemplo n.º 3
0
//Testsome
//Tests for completion of one or more previously initiated communications in a list.
func Testsome(requests []Request) (int, []int, []Status, int) {

	count := len(requests)
	cStatuses := make([]C.MPI_Status, count)
	cIndex := make([]C.int, count)
	cRequests := make([]C.MPI_Request, count)
	for i := 0; i < count; i++ {
		cRequests[i] = C.MPI_Request(requests[i])
	}
	var cOutCount C.int

	err := C.MPI_Testsome(C.int(count),
		&cRequests[0],
		&cOutCount,
		&cIndex[0],
		&cStatuses[0])

	statuses := make([]Status, count)
	index := make([]int, count)
	for i := 0; i < count; i++ {
		statuses[i] = Status(cStatuses[i])
		index[i] = int(cIndex[i])
	}

	return int(cOutCount), index, statuses, int(err)
}
Exemplo n.º 4
0
//Start
//Initiates a communication with a persistent request handle.
func Start(request Request) (Request, int) {

	cRequest := C.MPI_Request(request)

	err := C.MPI_Start(&cRequest)

	return Request(cRequest), int(err)
}
Exemplo n.º 5
0
//Cancel
//Cancels a communication request.
func Cancel(request Request) int {

	cRequest := C.MPI_Request(request)

	err := C.MPI_Cancel(&cRequest)

	return int(err)
}
Exemplo n.º 6
0
//Startall
//Starts a collection of persistent requests.
func Startall(requests []Request) int {

	count := len(requests)
	cArrayOfRequests := make([]C.MPI_Request, count)

	for i := 0; i < len(requests); i++ {
		cArrayOfRequests[i] = C.MPI_Request(requests[i])
	}

	err := C.MPI_Startall(C.int(count), &cArrayOfRequests[0])

	return int(err)
}
Exemplo n.º 7
0
//Request_get_status
//Access information associated with a request without freeing the request.
func Requset_get_status(request Request) (bool, Status, int) {

	cFlag := C.int(0)
	flag := false
	var cStatus C.MPI_Status

	err := C.MPI_Request_get_status(C.MPI_Request(request), &cFlag, &cStatus)

	if int(cFlag) != 0 {
		flag = true
	}

	return flag, Status(cStatus), int(err)
}
Exemplo n.º 8
0
//Test
//Tests for the completion of a request.
func Test(request Request) (bool, Status, int) {

	cRequest := C.MPI_Request(request)
	var cFlag C.int
	var cStatus C.MPI_Status
	flag := false

	err := C.MPI_Test(&cRequest, &cFlag, &cStatus)

	if int(cFlag) != 0 {
		flag = true
	}

	return flag, Status(cStatus), int(err)
}
Exemplo n.º 9
0
//Grequest_complete
//Reports that a generalized request is complete.
func Grequest_completes(request Request) int {

	err := C.MPI_Grequest_complete(C.MPI_Request(request))

	return int(err)
}