示例#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
文件: main.go 项目: npadmana/npgo
func main() {
	mpi.Initialize()
	TestInt64()
	mpi.Finalize()
}