在运行一个遗传算法的模型时,发现模型运行过程中CPU的占用率低,而且模型运行速度非常慢
一个步骤就花了一个小时
模型中关于线程设置的代码
虽然有代码但不知道怎么修改
# Maximum number of threads as command line argument
# defaults
default_nthreads = "max cpu cores"
# parsing arguments
#解析参数
parser = ArgumentParser(
description = 'CoMOLA - Constrained Multi-objective Optimization of Land use Allocation'
)
parser.add_argument(
"-t", "--threads",
help = "number of threads to use, defaults to " + str(default_nthreads),
dest = "nthreads",
default = default_nthreads,
metavar = 4
)
options = parser.parse_args()
# Get absolute path of this file
wrkDir = os.path.abspath(".")
另外,自述文件里说了这个
希望大家可以帮忙看看
希望模型可以早点跑出来!万分感谢!!
修改变量default_nthreads为你想要的线程数有没效果