[{"data":1,"prerenderedAt":529},["ShallowReactive",2],{"content-query-SXempOBGxl":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"cover":11,"type":12,"body":13,"_type":523,"_id":524,"_source":525,"_file":526,"_stem":527,"_extension":528},"/news/zh/1671","zh",false,"","国产科学计算软件实现“弯道超车”的难得机遇","分子动力学MD模拟是一种根据分子力场所描述的势能函数模拟分子的微观运动，从而计算分子体系的物理和化学性质的科学计算工具。","2022-08-01","https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/a26fa486e82d4ec2b128de368c3119fd.png","news",{"type":14,"children":15,"toc":520},"root",[16,24,33,42,52,57,62,69,84,89,94,99,104,118,123,128,133,143,155,160,165,170,184,189,194,199,204,218,223,228,233,238,243,257,262,267,272,277,284,289,297,302,307,312,317,322,330,335,340,345,366,371,378,383,390,395,400,411,416,425,430,439,446,454,464,479,489,505],{"type":17,"tag":18,"props":19,"children":21},"element","h1",{"id":20},"国产科学计算软件实现弯道超车的难得机遇",[22],{"type":23,"value":8},"text",{"type":17,"tag":25,"props":26,"children":27},"p",{},[28],{"type":17,"tag":29,"props":30,"children":32},"img",{"alt":7,"src":31},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/c169f302dee045dfa24216d001eee581.gif",[],{"type":17,"tag":25,"props":34,"children":35},{},[36],{"type":17,"tag":37,"props":38,"children":39},"strong",{},[40],{"type":23,"value":41},"前言——本文作者：杨奕，深圳湾实验室副研究员",{"type":17,"tag":25,"props":43,"children":44},{},[45,50],{"type":17,"tag":37,"props":46,"children":47},{},[48],{"type":23,"value":49},"分子动力学MD（molecular dynamics）模拟",{"type":23,"value":51},"是一种根据分子力场（force field）所描述的势能（potential energy）函数模拟分子的微观运动，从而计算分子体系的物理和化学性质的科学计算工具。",{"type":17,"tag":25,"props":53,"children":54},{},[55],{"type":23,"value":56},"目前，MD模拟在化学、生物、物理、制药、材料、环境等领域有着广泛的应用。早在上世纪六七十年代，就已经出现了针对特定体系的MD模拟程序，而经过几十年的发展，目前市面上已经有了很多通用型的MD模拟软件，表1展示了部分当前较为流行的MD模拟软件。",{"type":17,"tag":25,"props":58,"children":59},{},[60],{"type":23,"value":61},"从中可以看出，他们大多都已经有了几十年的开发历史，产品成熟，且这些软件绝大多数都由西方发达国家开发，特别是由美国开发的软件更是占到大半以上。而由中国人开发的MD模拟软件不但数量很少，且用户群体也基本上都局限在很小的范围，可以说跟这些“流行”的MD模拟软件还有着不小的差距。",{"type":17,"tag":25,"props":63,"children":64},{},[65],{"type":17,"tag":29,"props":66,"children":68},{"alt":7,"src":67},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/218573c9aad149c2af38ffd142ee5fc2.png",[],{"type":17,"tag":25,"props":70,"children":71},{},[72,77,79],{"type":17,"tag":37,"props":73,"children":74},{},[75],{"type":23,"value":76},"1",{"type":23,"value":78}," ",{"type":17,"tag":37,"props":80,"children":81},{},[82],{"type":23,"value":83},"MD模拟软件的先天缺陷",{"type":17,"tag":25,"props":85,"children":86},{},[87],{"type":23,"value":88},"1.程序框架老旧，且灵活性差，如果想要在原有程序上添加新的算法，往往需要对程序代码进行大幅改动。特别对于第三方的开发者来说，想要在程序中实现自己开发的算法难度非常大。",{"type":17,"tag":25,"props":90,"children":91},{},[92],{"type":23,"value":93},"2.程序多基于CPU进行编写，如果要在GPU等计算加速设备上运行这些程序并实现有效的加速，就必须对程序进行整体改动。不但工程量浩大，且往往会导致之前由第三方人员开发的算法失效。",{"type":17,"tag":25,"props":95,"children":96},{},[97],{"type":23,"value":98},"3.程序多用C/C++甚至Fortran语言编写，难以兼容目前主流的以Python语言为前端语言的AI框架。这导致近些年来开发的一些基于AI的算法难以真正地在MD模拟软件中得到广泛应用。",{"type":17,"tag":25,"props":100,"children":101},{},[102],{"type":23,"value":103},"这些问题都严重制约了MD模拟的发展，特别是最后一条与AI框架的兼容性问题，更是一个严重阻碍AI技术对MD模拟进行“智能化”改造的技术壁垒。",{"type":17,"tag":25,"props":105,"children":106},{},[107,112,113],{"type":17,"tag":37,"props":108,"children":109},{},[110],{"type":23,"value":111},"2",{"type":23,"value":78},{"type":17,"tag":37,"props":114,"children":115},{},[116],{"type":23,"value":117},"完全基于AI框架的MD模拟软件",{"type":17,"tag":25,"props":119,"children":120},{},[121],{"type":23,"value":122},"为了从根本上解决MD模拟软件的先天缺陷，就需要开发完全基于AI框架的MD模拟软件，实现AI算法与MD模拟的无缝结合。",{"type":17,"tag":25,"props":124,"children":125},{},[126],{"type":23,"value":127},"这几十年来，IT技术的发展日新月异，科学计算领域也在随之发生着变化。一方面体现在各种新硬件的推出，比如基于GPU芯片的加速设备已经在科学计算中得到了大量的应用，极大地加快了科学计算的速度。",{"type":17,"tag":25,"props":129,"children":130},{},[131],{"type":23,"value":132},"而另一方面则在于各种新算法的出现，特别是以AlphaFold为代表的基于人工智能AI（artificial intelligent）的算法，展示了AI可以在科学计算中实现很多曾经无法实现或难以企及的目标。",{"type":17,"tag":25,"props":134,"children":135},{},[136,138],{"type":23,"value":137},"著名科技企业Google于2019年底推出了基于自家JAX框架的MD模拟软件JAX-MD，而几个欧美大学课题也基于PyTorch框架开发了TorchMD。",{"type":17,"tag":37,"props":139,"children":140},{},[141],{"type":23,"value":142},"国内方面高毅勤教授课题组同华为合作，基于华为全场景AI框架MindSpore开发了新一代智能MD模拟软件MindSpore SPONGE。",{"type":17,"tag":25,"props":144,"children":145},{},[146,148,153],{"type":23,"value":147},"相比于传统MD模拟软件，",{"type":17,"tag":37,"props":149,"children":150},{},[151],{"type":23,"value":152},"基于AI框架MindSpore的“智能”MD模拟软件MindSpore SPONGE",{"type":23,"value":154},"有几个优势：",{"type":17,"tag":25,"props":156,"children":157},{},[158],{"type":23,"value":159},"1.借助MindSpore“自动微分（automatic differentiation）”的功能，可以大幅简化分子力场的代码形式。",{"type":17,"tag":25,"props":161,"children":162},{},[163],{"type":23,"value":164},"2.基于MindSpore编写的程序可以大幅简化软件对不同硬件设备的适配。",{"type":17,"tag":25,"props":166,"children":167},{},[168],{"type":23,"value":169},"3.“端到端可微（end-to-end differentiable）”的MD模拟程序。",{"type":17,"tag":25,"props":171,"children":172},{},[173,178,179],{"type":17,"tag":37,"props":174,"children":175},{},[176],{"type":23,"value":177},"3",{"type":23,"value":78},{"type":17,"tag":37,"props":180,"children":181},{},[182],{"type":23,"value":183},"基于自动微分简化分子力场代码形式",{"type":17,"tag":25,"props":185,"children":186},{},[187],{"type":23,"value":188},"在数学上，MD模拟通过分子力场给出的势能函数计算每个原子的受力，从而模拟出分子的运动轨迹。但使用一般程序语言编写的势能函数代码无法直接用来计算原子受力，也就是原子坐标相对于势能函数的负梯度。",{"type":17,"tag":25,"props":190,"children":191},{},[192],{"type":23,"value":193},"因此传统的MD模拟软件不但要编写势能函数的代码，还需要事先求解势能函数对原子坐标的导数，也就是原子受力的解析表达式。因此，无论是理论推导还是代码编写层面的工作量都会大幅增加，也会让程序变得更加复杂，这也是编写传统MD模拟程序的难点之一。",{"type":17,"tag":25,"props":195,"children":196},{},[197],{"type":23,"value":198},"另外，需要手工求解势能函数这一点也极大地限制了分子力场采用数学形式更加复杂的势能函数，否则其函数的导数将难以求解，这也制约了分子力场的发展。",{"type":17,"tag":25,"props":200,"children":201},{},[202],{"type":23,"value":203},"而华为昇思MindSpore的“自动微分”功能，可以直接计算函数的导数，因此基于MindSpore编写分子力场只需编写势能函数的代码即可，原子受力即原子坐标对势能函数的负梯度可以直接通过“自动微分”计算，这不但大幅减少了代码编写的工作量，也在很大程度上简化了MD模拟程序结构的复杂度，同时也极大地拓宽了分子力场可以采用的数学模型的范围。",{"type":17,"tag":25,"props":205,"children":206},{},[207,212,213],{"type":17,"tag":37,"props":208,"children":209},{},[210],{"type":23,"value":211},"4",{"type":23,"value":78},{"type":17,"tag":37,"props":214,"children":215},{},[216],{"type":23,"value":217},"简化软件对不同硬件设备的适配",{"type":17,"tag":25,"props":219,"children":220},{},[221],{"type":23,"value":222},"MD模拟软件是一类计算量超大的科学计算程序，因此在实际使用中往往需要进行并行化计算，或者使用GPU等计算加速设备进行计算。",{"type":17,"tag":25,"props":224,"children":225},{},[226],{"type":23,"value":227},"对于传统的MD模拟程序来说，在实现了程序“科学”上的功能之后，对程序进行并行化或GPU设备的移植等“工程”上的工作才是整个软件项目中最复杂、最困难的地方。",{"type":17,"tag":25,"props":229,"children":230},{},[231],{"type":23,"value":232},"而华为全场景AI框架MindSpore能在CPU、GPU和华为自主研发的“昇腾”（Ascend）AI加速芯片上运行，使用MindSpore编写的程序只需修改一行代码便可移植到不同的硬件设备上。",{"type":17,"tag":25,"props":234,"children":235},{},[236],{"type":23,"value":237},"此外，华为昇思MindSpore还具备“自动并行”（automatic parallelism）的能力，只需简单修改代码就能自动实现程序的并行化计算。",{"type":17,"tag":25,"props":239,"children":240},{},[241],{"type":23,"value":242},"因此，基于华为昇思MindSpore开发MD模拟程序，可以使科学家们专注于程序的“科学”功能，而将“工程”上的问题交由MindSpore本身来处理。",{"type":17,"tag":25,"props":244,"children":245},{},[246,251,252],{"type":17,"tag":37,"props":247,"children":248},{},[249],{"type":23,"value":250},"5",{"type":23,"value":78},{"type":17,"tag":37,"props":253,"children":254},{},[255],{"type":23,"value":256},"“端到端可微”的MD模拟程序",{"type":17,"tag":25,"props":258,"children":259},{},[260],{"type":23,"value":261},"如果AI框架具备“高阶自动微分”的能力，那么还能编写出“端到端可微” （end-to-end differentiable）的MD模拟程序，从而实现很多传统MD模拟完全无法实现的功能。",{"type":17,"tag":25,"props":263,"children":264},{},[265],{"type":23,"value":266},"华为昇思MindSpore具备“高阶自动微分”的能力，可以自动求解函数的高阶导数，而“端到端可微”MD模拟是Google在发布JAX-MD时提出的新概念，指MD模拟从输入坐标到计算力再到更新坐标的整个过程都是可微，这对于MD模拟来说是一种革命性的技术。",{"type":17,"tag":25,"props":268,"children":269},{},[270],{"type":23,"value":271},"使用传统MD模拟无法直接获知模拟的最终结果同输入坐标或参数的关系，一旦模拟的结果不符合预期，科研人员只能通过个人经验不断地调整起始坐标或程序参数，再反复进行模拟直到获得理想的结果。",{"type":17,"tag":25,"props":273,"children":274},{},[275],{"type":23,"value":276},"而在“端到端可微”MD模拟中，由于可以直接求解输出结果相对输入坐标或参数的导数，因此科研人员可以像运行一般的AI优化算法那样，直接对MD模拟过程本身进行优化，从而获得理想的结果，避免了“反复尝试”的过程。这即是一种“元优化”（meta-optimization）过程。“端到端可微”被认为是下一代MD模拟的重要特征。",{"type":17,"tag":25,"props":278,"children":279},{},[280],{"type":17,"tag":29,"props":281,"children":283},{"alt":7,"src":282},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/cf26e6ed0ca2452c93c50f21d0573582.png",[],{"type":17,"tag":25,"props":285,"children":286},{},[287],{"type":23,"value":288},"图1 深度学习训练与分子动力学模拟的对比。左：基于MindSpore人工智能框架进行神经网络参数训练过程的示意图。右：基于MindSpore SPONGE分子动力学模拟库进行分子动力学模拟过程的示意图。其中每个方块代表一种程序模块，灰色粗箭头为模块地组合过程，而黑色箭头表示数据更新流程。",{"type":17,"tag":25,"props":290,"children":291},{},[292],{"type":17,"tag":37,"props":293,"children":294},{},[295],{"type":23,"value":296},"6 “类AI”架构编写的MD模拟软件",{"type":17,"tag":25,"props":298,"children":299},{},[300],{"type":23,"value":301},"MindSpore SPONGE相比传统软件架构更简单、开发更高效、使用更“智能”，还能实现很多传统软件所不能实现功能。认真思考就会发现，AI训练和MD模拟这两个看似完全不同的过程，存在着许多相似的地方。",{"type":17,"tag":25,"props":303,"children":304},{},[305],{"type":23,"value":306},"如图1所示，AI训练的过程是优化器（optimizer）以损失函数（loss function）为优化目标，通过提供的训练数据集（training dataset）计算神经网络参数的梯度，从而对网络模型的参数进行更新。",{"type":17,"tag":25,"props":308,"children":309},{},[310],{"type":23,"value":311},"而MD模拟则是积分器（integrator）根据势能函数计算原子受力，即势能函数相对原子坐标的负梯度，从而对原子坐标进行更新。",{"type":17,"tag":25,"props":313,"children":314},{},[315],{"type":23,"value":316},"因此，MD模拟在某种程度上可以看成是一种特殊的AI训练过程。这种按照AI训练的过程来编写MD模拟程序即为“类AI”框架的MD模拟程序。",{"type":17,"tag":25,"props":318,"children":319},{},[320],{"type":23,"value":321},"MindSpore SPONGE还具备模块化、高通量、“端到端可微”等优点，是根据该架构编写的一款下一代智能MD模拟软件。",{"type":17,"tag":25,"props":323,"children":324},{},[325],{"type":17,"tag":37,"props":326,"children":327},{},[328],{"type":23,"value":329},"7 总结",{"type":17,"tag":25,"props":331,"children":332},{},[333],{"type":23,"value":334},"MD模拟是一种重要科学计算工具，但目前主流的MD模拟软件几乎都由西方发达国家开发，且经过数十年的积累，产品成熟度高、用户依赖性强，通常开发全新的MD模拟软件很难实现对老牌软件的超越。",{"type":17,"tag":25,"props":336,"children":337},{},[338],{"type":23,"value":339},"而下一代的智能MD模拟软件MindSpore SPONGE具备很多传统软件所不具备的优势，可以实现很多传统软件无法实现的功能，而其作为一种全新事物目前尚处于萌芽阶段。",{"type":17,"tag":25,"props":341,"children":342},{},[343],{"type":23,"value":344},"因此，这给了我们对西方MD模拟软件实现“弯道超车”的难得机遇，全力发展国产的智能MD模拟软件将带给国产科学计算软件一个引领行业发展的机会。",{"type":17,"tag":25,"props":346,"children":347},{},[348,357,359,364],{"type":17,"tag":37,"props":349,"children":350},{},[351],{"type":17,"tag":352,"props":353,"children":354},"em",{},[355],{"type":23,"value":356},"8月11至15日",{"type":23,"value":358}," ，昇思MindSpore社区举办",{"type":17,"tag":37,"props":360,"children":361},{},[362],{"type":23,"value":363},"第二季「MindSpore SPONGE暑期学校」",{"type":23,"value":365},"。",{"type":17,"tag":25,"props":367,"children":368},{},[369],{"type":23,"value":370},"14位国内知名专家全程手把手授课，我们希望MindSpore SPONGE被更多的老师，学生和业界开发者使用，并吸引到更多的开发者加入社区共同开发，丰富MindSpore SPONGE套件，共同探索开源科学软件的未来。",{"type":17,"tag":25,"props":372,"children":373},{},[374],{"type":17,"tag":29,"props":375,"children":377},{"alt":7,"src":376},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/a2c5df38ddf5474194664e3c359b8d12.png",[],{"type":17,"tag":25,"props":379,"children":380},{},[381],{"type":23,"value":382},"（扫码报名）",{"type":17,"tag":25,"props":384,"children":385},{},[386],{"type":17,"tag":29,"props":387,"children":389},{"alt":7,"src":388},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/49102926a8874252b2ca5f529c1f70e9.jpg",[],{"type":17,"tag":25,"props":391,"children":392},{},[393],{"type":23,"value":394},"MindSpore SPONGE官方资料",{"type":17,"tag":25,"props":396,"children":397},{},[398],{"type":23,"value":399},"MindSpore SPONGE Gitee：",{"type":17,"tag":25,"props":401,"children":402},{},[403],{"type":17,"tag":404,"props":405,"children":409},"a",{"href":406,"rel":407},"https://gitee.com/mindspore/mindscience/",[408],"nofollow",[410],{"type":23,"value":406},{"type":17,"tag":25,"props":412,"children":413},{},[414],{"type":23,"value":415},"MindSpore官网：",{"type":17,"tag":25,"props":417,"children":418},{},[419],{"type":17,"tag":404,"props":420,"children":423},{"href":421,"rel":422},"https://www.mindspore.cn/",[408],[424],{"type":23,"value":421},{"type":17,"tag":25,"props":426,"children":427},{},[428],{"type":23,"value":429},"MindSpore Gitee：",{"type":17,"tag":25,"props":431,"children":432},{},[433],{"type":17,"tag":404,"props":434,"children":437},{"href":435,"rel":436},"https://gitee.com/mindspore/mindspore",[408],[438],{"type":23,"value":435},{"type":17,"tag":25,"props":440,"children":441},{},[442],{"type":17,"tag":29,"props":443,"children":445},{"alt":7,"src":444},"https://obs-mindspore-file.obs.cn-north-4.myhuaweicloud.com/file/2022/08/04/f0ec6b5338424d74ba370e7db538195c.jpg",[],{"type":17,"tag":25,"props":447,"children":448},{},[449],{"type":17,"tag":37,"props":450,"children":451},{},[452],{"type":23,"value":453},"MindSpore官方资料",{"type":17,"tag":25,"props":455,"children":456},{},[457,462],{"type":17,"tag":37,"props":458,"children":459},{},[460],{"type":23,"value":461},"官方QQ群",{"type":23,"value":463}," : 486831414",{"type":17,"tag":25,"props":465,"children":466},{},[467,472,474],{"type":17,"tag":37,"props":468,"children":469},{},[470],{"type":23,"value":471},"官网",{"type":23,"value":473},"：",{"type":17,"tag":404,"props":475,"children":477},{"href":421,"rel":476},[408],[478],{"type":23,"value":421},{"type":17,"tag":25,"props":480,"children":481},{},[482,487],{"type":17,"tag":37,"props":483,"children":484},{},[485],{"type":23,"value":486},"Gitee",{"type":23,"value":488}," : https : //gitee.com/mindspore/mindspore",{"type":17,"tag":25,"props":490,"children":491},{},[492,497,499],{"type":17,"tag":37,"props":493,"children":494},{},[495],{"type":23,"value":496},"GitHub",{"type":23,"value":498}," : ",{"type":17,"tag":404,"props":500,"children":503},{"href":501,"rel":502},"https://github.com/mindspore-ai/mindspore",[408],[504],{"type":23,"value":501},{"type":17,"tag":25,"props":506,"children":507},{},[508,513,514],{"type":17,"tag":37,"props":509,"children":510},{},[511],{"type":23,"value":512},"论坛",{"type":23,"value":473},{"type":17,"tag":404,"props":515,"children":518},{"href":516,"rel":517},"https://bbs.huaweicloud.com/forum/forum-1076-1.html",[408],[519],{"type":23,"value":516},{"title":7,"searchDepth":521,"depth":521,"links":522},4,[],"markdown","content:news:zh:1671.md","content","news/zh/1671.md","news/zh/1671","md",1776506053223]