分布式并行编程框架 CharmPy

码农软件 · 软件分类 · 并发/并行处理框架 · 2019-09-02 13:59:07

软件介绍

CharmPy

CharmPy 是一个通用的分布式并行编程框架,具有简单而强大的 API ,基于可迁移的 Python 对象和远程方法调用; 构建于自适应 C ++ 运行时系统之上,提供速度、可扩展性和动态负载平衡。

CharmPy 允许开发从笔记本电脑到超级计算机的并行应用程序。

简单示例:

from charmpy import charm, Chare, Group, Reducerfrom math import piimport timeclass Worker(Chare):

    def work(self, n_steps, pi_future):
        h = 1.0 / n_steps
        s = 0.0
        for i in range(self.thisIndex, n_steps, charm.numPes()):
            x = h * (i + 0.5)
            s += 4.0 / (1.0 + x**2)        # perform a reduction among members of the group, sending the result to the future
        self.contribute(s * h, Reducer.sum, pi_future)def main(args):
    n_steps = 1000
    if len(args) > 1:
        n_steps = int(args[1])
    mypi = charm.createFuture()
    workers = Group(Worker)  # create one instance of Worker on every processor
    t0 = time.time()
    workers.work(n_steps, mypi)  # invoke 'work' method on every worker
    print('Approximated value of pi is:', mypi.get(),  # 'get' blocks until result arrives
          'Error is', abs(mypi.get() - pi), 'Elapsed time=', time.time() - t0)
    charm.exit()

charm.start(main)

本文地址:https://www.codercto.com/soft/d/13716.html

JavaScript DOM高级程序设计

JavaScript DOM高级程序设计

Jeffrey Sambells、Aaron Gustafson / 李松峰、李雅雯 / 人民邮电出版社 / 2008-7 / 59.00元

本书注重理论与实践的结合,全面讲述高级的DOM 脚本编程。全书分为3 个部分:第一部分“深入理解DOM 脚本编程”,涉及W3C DOM 规范的各方面,包括非标准的浏览器支持和不支持的内容;第二部分“浏览器外部通信”,以Ajax 和客户端—服务器端通信为主题;第三部分“部分高级脚本编程资源”,集中介绍了一批第三方脚本编程资源,包括库和API。同时,每部分的最后一章都为案例研究,将学到的内容应用于实践......一起来看看 《JavaScript DOM高级程序设计》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换