【发布时间】:2010-08-29 18:26:49
【问题描述】:
我编写了一个程序,该程序调用具有以下原型的函数:
def Process(n):
# the function uses data that is stored as binary files on the hard drive and
# -- based on the value of 'n' -- scans it using functions from numpy & cython.
# the function creates new binary files and saves the results of the scan in them.
#
# I optimized the running time of the function as much as I could using numpy &
# cython, and at present it takes about 4hrs to complete one function run on
# a typical winXP desktop (three years old machine, 2GB memory etc).
我的目标是以最快、最经济的方式准确运行此函数 10,000 次(对于 10,000 个不同的 'n' 值)。在这些运行之后,我将拥有 10,000 个不同的二进制文件,其中包含所有单独扫描的结果。请注意,每个“运行”函数都是独立的(也就是说,各个运行之间没有任何依赖关系)。
所以问题是这样的。家里只有一台电脑,很明显,我需要大约 4.5 年(10,000 次运行 x 每次运行 4 小时 = 40,000 小时 ~= 4.5 年)才能在家完成所有运行。然而,我希望在一两周内完成所有的运行。
我知道解决方案将涉及一次访问许多计算资源。最好的(最快/最实惠,因为我的预算有限)的方法是什么?我必须买一个强大的服务器(它会花多少钱?)或者我可以让这个在线运行吗?在这种情况下,这样做是否会暴露我的专有代码?
如果有帮助,'Process()' 的每个实例只需要大约 500MB 的内存。谢谢。
【问题讨论】:
-
Process是做什么的?如果没有更多信息,我认为将速度提高 2 倍以上并不容易(假设双核)。 -
KennyTM:感谢您的回答。即使运行时间减少一半(这不太可能),我仍然需要 2.5 年才能运行所有内容。因此,这里的重点是问题的并行化方面。如果您对此有一个好主意,那就太好了。