Example #1
0
//Group_intersection
//Produces a group at the intersection of two existing groups.
func Group_intersection(group1, group2 Group) (Group, int) {

	var newgroup C.MPI_Group
	err := C.MPI_Group_intersection(C.MPI_Group(group1), C.MPI_Group(group2), &newgroup)

	return Group(newgroup), int(err)
}
Example #2
0
//Comm_create
//Creates a new communicator.
func Comm_create(comm Comm, group Group) (Comm, int) {

	var newComm C.MPI_Comm
	err := C.MPI_Comm_create(C.MPI_Comm(comm), C.MPI_Group(group), &newComm)

	return Comm(newComm), int(err)
}
Example #3
0
//Group_size
//Returns the size of a group.
func Group_size(group Group) (int, int) {

	var size C.int

	err := C.MPI_Group_size(C.MPI_Group(group), &size)

	return int(size), int(err)
}
Example #4
0
//Group_rank
//Returns the rank of the calling process in the given group.
func Group_rank(group Group) (int, int) {

	var rank C.int

	err := C.MPI_Group_rank(C.MPI_Group(group), &rank)

	return int(rank), int(err)
}
Example #5
0
//Group_incl
//Produces a group by reordering an existing group and taking only listed members.
func Group_incl(group Group, ranks []int) (Group, int) {

	length := len(ranks)

	var newgroup C.MPI_Group
	CintArray := make([]C.int, length)

	// copy slices data into the array
	for i := 0; i < length; i++ {
		CintArray[i] = C.int(ranks[i])
	}

	err := C.MPI_Group_incl(C.MPI_Group(group), C.int(length), &CintArray[0], &newgroup)

	return Group(newgroup), int(err)
}
Example #6
0
//Group_range_excl
//Produces a group by excluding ranges of processes from an existing group.
func Group_range_excl(group Group, ranks [][3]int) (Group, int) {

	length := len(ranks)

	var newgroup C.MPI_Group
	CintArray := make([][3]C.int, length)

	// copy slices data into the array
	for i := 0; i < length; i++ {
		CintArray[i][0] = C.int(ranks[i][0])
		CintArray[i][1] = C.int(ranks[i][1])
		CintArray[i][2] = C.int(ranks[i][2])
	}

	err := C.MPI_Group_range_excl(C.MPI_Group(group), C.int(length), &(CintArray[0]), &newgroup)

	return Group(newgroup), int(err)
}
Example #7
0
//Group_translate_ranks
//Translates the ranks of processes in one group to those in another group.
func Group_translate_ranks(group1 Group, ranks1 []int, group2 Group) ([]int, int) {
	length := len(ranks1)
	CintArray1 := make([]C.int, length)
	CintArray2 := make([]C.int, length)
	ranks2 := make([]int, length)

	// copy slices data into the array
	for i := 0; i < length; i++ {
		CintArray1[i] = C.int(ranks1[i])
	}

	err := C.MPI_Group_translate_ranks(C.MPI_Group(group1), C.int(length), &CintArray1[0], C.MPI_Group(group2), &CintArray2[0])

	for i := 0; i < length; i++ {
		ranks2[i] = int(CintArray2[i])
	}

	return ranks2, int(err)
}
Example #8
0
//Group_difference
//Makes a group from the difference of two groups.
func Group_difference(group1, group2 Group) (Group, int) {

	var newgroup C.MPI_Group
	err := C.MPI_Group_difference(C.MPI_Group(group1), C.MPI_Group(group2), &newgroup)
	return Group(newgroup), int(err)
}
Example #9
0
//Group_compare
//Compares two groups.
func Group_compare(group1, group2 Group) (int, int) {

	var result C.int
	err := C.MPI_Group_compare(C.MPI_Group(group1), C.MPI_Group(group2), &result)
	return int(result), int(err)
}