예제 #1
0
파일: main.go 프로젝트: npadmana/npgo
func main() {
	var err error

	mpi.Initialize()
	defer mpi.Finalize()

	var rank, size int
	if rank, err = mpi.Rank(mpi.WORLD); err != nil {
		mpi.Abort(mpi.WORLD, -1)
	}
	if size, err = mpi.Size(mpi.WORLD); err != nil {
		mpi.Abort(mpi.WORLD, -1)
	}

	// Define the input and output strings
	if len(os.Args) != 3 {
		fmt.Println("Incorrect number of parameters")
		mpi.Abort(mpi.WORLD, 1)
	}
	infn := os.Args[1]
	outfn := os.Args[2]

	// Open output file
	var outff LogFile
	outff.F, err = os.Create(fmt.Sprintf("%s-%05d.out", outfn, rank))
	if err != nil {
		log.Printf("Unable to open file %s-%05d.out", outfn, rank)
	}
	defer outff.F.Close()
	outff.Rank, outff.Size, outff.linenum = rank, size, 0

	lineio.Read(infn, &outff)

	mpi.Barrier(mpi.WORLD)

}
예제 #2
0
파일: petsc.go 프로젝트: npadmana/npgo
// Fatal calls MPI_Abort
func Fatal(err error) {
	log.Println("Calling MPI_Abort : ", err)
	mpi.Abort(WORLD, -1)
}