首页 > 代码库 > Python脚本运行linux命令

Python脚本运行linux命令

用gem5执行不同的脚本,将stats输出到不同的目录;

#!/usr/bin/env python3

#
# A Python script to run all Chai‘s data-partition benchmarks with different partition ratios.
#
# Copyright (C) Huan Chen 2017
#

import os

ratios = [
    #‘0‘,
    #‘0.05‘,
    #‘0.1‘,
    #‘0.15‘,
    0.2,
    0.25,
    0.3,
    0.35,
    0.4,
    0.45,
    0.5,
    0.55,
    0.6,
    0.65,
    0.7,
    0.75,
    0.8,
    0.85,
    0.9,
    0.95,
    0.1
]

def run(ratio):
    cmd_run =/home/hao/gem5-gpu/gem5/build/X86_VI_hammer_GPU/gem5.opt -d /home/hao/gem5-gpu/m5out+ratio+ /home/hao/gem5-gpu/gem5-gpu/configs/fs_fusion.py --script=/home/hao/gem5-gpu/m5out+ratio+/BS.rcS  --cpu-type=timing  --gpu_core_config=Maxwell --num-cpus=8 --clusters=8 --cores_per_cluster=2 --num-dirs=4 --mem-type=DDR4_2400_x64 --total-mem-size=3GB --access-host-pagetable
    print(cmd_run)
    os.system(cmd_run)

def run_experiments():
    for ratio in ratios:
        run(ratio)

run_experiments()

 

Python脚本运行linux命令