bench.py

来自「Dolfin provide a high-performance linear」· Python 代码 · 共 37 行

PY
37
字号
#!/usr/bin/env python## Copyright (C) 2006 Garth N. Wells.# Licensed under the GNU LGPL Version 2.1.## Run benchmarks for linear algebra.from os import systemfrom time import time# Log filelogfile = "bench.log"tic = time()# Run benchmark for vectorssystem("./vector/dolfin-vector | tee bench.tmp")# Run benchmark for spase matricessystem("./sparse-matrix/dolfin-sparse-matrix | tee -a bench.tmp")toc = time() - tic# Save results to log filesystem("pkg-config --modversion dolfin >> " + logfile)system("date >> " + logfile)file = open(logfile, "a")tempfile = open('./bench.tmp', 'r')file.write(tempfile.read())file.write("Total CPU time: %g\n" % toc)file.write("----------------------------------------\n")tempfile.close()file.close()# Print finished messageprint "Finished linear algebra benchmarks. See '"+logfile+"' for the results."

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?