支持多线程并行的 PyWolf 改进版

IF 7.2 2区 物理与天体物理 Q1 COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS
Tiago E.C. Magalhães
{"title":"支持多线程并行的 PyWolf 改进版","authors":"Tiago E.C. Magalhães","doi":"10.1016/j.cpc.2024.109431","DOIUrl":null,"url":null,"abstract":"<div><div>PyWolf is an open-source software with a graphical user interface that performs numerical simulations of the cross-spectral density function propagation of planar sources using parallel computation through PyOpenCL. In the previous versions of PyWolf, the user could select the OpenCL devices and platforms to perform the parallel computations on several tasks, except for that related to the two-dimensional (2D) fast Fourier transform (FFT) algorithm. The latter task can have a large computation time since one has to perform a large amount of 2D FFTs over 2D slices of a four-dimensional array. The option of using multithread-based computation on these loops and other tasks can be an advantage for multi-core CPUs and can significantly decrease the computation time. Here, I present version 3.0.0 of PyWolf, which adds a multithreading option to be used for the 2D FFT computations. This multithreading option can also be easily implemented in other time-consuming tasks.</div></div><div><h3>New version program summary</h3><div><em>Program Title:</em> PyWolf</div><div><em>CPC Library link to program files:</em> <span><span>https://doi.org/10.17632/frjscxypkd.3</span><svg><path></path></svg></span></div><div><em>Developer's repository link:</em> <span><span>https://github.com/tiagoecmagalhaes/PyWolf</span><svg><path></path></svg></span></div><div><em>Licensing provisions:</em> GPLv3</div><div><em>Programming language:</em> Python</div><div><em>Supplementary material:</em> Overview of the main changes with performance results.</div><div><em>Journal reference of previous version:</em> Comput. Phys. Commun. 294 (2024) 108899.</div><div><em>Reasons for the new version:</em> In the original paper of PyWolf <span><span>[1]</span></span> and in the previous version <span><span>[2]</span></span>, parallel computation was performed only using PyOpenCL. However, in some cases where multiple cores are available in the CPU, multithreading <span><span>[3]</span></span> can significantly decrease the computation time of some tasks, for instance, the loops of 2D fast Fourier transforms (FFTs). This new version includes a built-in option for multithreading, enabling users to select the number of threads to be used in the numerical simulation.</div><div><em>Summary of revisions:</em> Multithreading support was added to PyWolf and users can now select this feature in PyWolf's graphical user interface and choose the number of available threads to be used in the simulation. In the current version, multithreading is only used for the loops of 2D FFTs but can be easily extended to other tasks. Other small features have been added and some issues have been corrected, namely: (i) a requirements file has been added listing all the libraries used; (ii) some errors associated with file paths have been corrected.</div><div><em>Nature of problem:</em> Propagation of partially coherent light from planar sources in the Fresnel or far field approximations using four-dimensional arrays <span><span>[4]</span></span>, <span><span>[5]</span></span> demands large memory and computation time. PyWolf uses PyOpenCL to perform parallel computation to reduce time-consuming calculations in the propagation of the cross-spectral density function <span><span>[4]</span></span>, restricting the memory capacity as the main limitation.</div><div><em>Solution method:</em> The open-source toolkit PyOpenCL along with multithreading is used to decrease the computation time. Users can modify and add more features to PyWolf, such as source, propagation, and geometrical models. Custom-made optical components can also be added (e.g., lenses and apertures). The PyQt5-based graphical user interface enables users to easily set the input parameters to simulate their optical setup, plot and export the simulated results, and save or load the simulation session.</div></div>","PeriodicalId":285,"journal":{"name":"Computer Physics Communications","volume":"307 ","pages":"Article 109431"},"PeriodicalIF":7.2000,"publicationDate":"2024-11-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"An improved version of PyWolf with multithread-based parallelism support\",\"authors\":\"Tiago E.C. Magalhães\",\"doi\":\"10.1016/j.cpc.2024.109431\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><div>PyWolf is an open-source software with a graphical user interface that performs numerical simulations of the cross-spectral density function propagation of planar sources using parallel computation through PyOpenCL. In the previous versions of PyWolf, the user could select the OpenCL devices and platforms to perform the parallel computations on several tasks, except for that related to the two-dimensional (2D) fast Fourier transform (FFT) algorithm. The latter task can have a large computation time since one has to perform a large amount of 2D FFTs over 2D slices of a four-dimensional array. The option of using multithread-based computation on these loops and other tasks can be an advantage for multi-core CPUs and can significantly decrease the computation time. Here, I present version 3.0.0 of PyWolf, which adds a multithreading option to be used for the 2D FFT computations. This multithreading option can also be easily implemented in other time-consuming tasks.</div></div><div><h3>New version program summary</h3><div><em>Program Title:</em> PyWolf</div><div><em>CPC Library link to program files:</em> <span><span>https://doi.org/10.17632/frjscxypkd.3</span><svg><path></path></svg></span></div><div><em>Developer's repository link:</em> <span><span>https://github.com/tiagoecmagalhaes/PyWolf</span><svg><path></path></svg></span></div><div><em>Licensing provisions:</em> GPLv3</div><div><em>Programming language:</em> Python</div><div><em>Supplementary material:</em> Overview of the main changes with performance results.</div><div><em>Journal reference of previous version:</em> Comput. Phys. Commun. 294 (2024) 108899.</div><div><em>Reasons for the new version:</em> In the original paper of PyWolf <span><span>[1]</span></span> and in the previous version <span><span>[2]</span></span>, parallel computation was performed only using PyOpenCL. However, in some cases where multiple cores are available in the CPU, multithreading <span><span>[3]</span></span> can significantly decrease the computation time of some tasks, for instance, the loops of 2D fast Fourier transforms (FFTs). This new version includes a built-in option for multithreading, enabling users to select the number of threads to be used in the numerical simulation.</div><div><em>Summary of revisions:</em> Multithreading support was added to PyWolf and users can now select this feature in PyWolf's graphical user interface and choose the number of available threads to be used in the simulation. In the current version, multithreading is only used for the loops of 2D FFTs but can be easily extended to other tasks. Other small features have been added and some issues have been corrected, namely: (i) a requirements file has been added listing all the libraries used; (ii) some errors associated with file paths have been corrected.</div><div><em>Nature of problem:</em> Propagation of partially coherent light from planar sources in the Fresnel or far field approximations using four-dimensional arrays <span><span>[4]</span></span>, <span><span>[5]</span></span> demands large memory and computation time. PyWolf uses PyOpenCL to perform parallel computation to reduce time-consuming calculations in the propagation of the cross-spectral density function <span><span>[4]</span></span>, restricting the memory capacity as the main limitation.</div><div><em>Solution method:</em> The open-source toolkit PyOpenCL along with multithreading is used to decrease the computation time. Users can modify and add more features to PyWolf, such as source, propagation, and geometrical models. Custom-made optical components can also be added (e.g., lenses and apertures). The PyQt5-based graphical user interface enables users to easily set the input parameters to simulate their optical setup, plot and export the simulated results, and save or load the simulation session.</div></div>\",\"PeriodicalId\":285,\"journal\":{\"name\":\"Computer Physics Communications\",\"volume\":\"307 \",\"pages\":\"Article 109431\"},\"PeriodicalIF\":7.2000,\"publicationDate\":\"2024-11-15\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Computer Physics Communications\",\"FirstCategoryId\":\"101\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0010465524003540\",\"RegionNum\":2,\"RegionCategory\":\"物理与天体物理\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q1\",\"JCRName\":\"COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Computer Physics Communications","FirstCategoryId":"101","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0010465524003540","RegionNum":2,"RegionCategory":"物理与天体物理","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q1","JCRName":"COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS","Score":null,"Total":0}
引用次数: 0

摘要

PyWolf 是一款图形用户界面的开源软件,通过 PyOpenCL 并行计算,对平面光源的交叉谱密度函数传播进行数值模拟。在 PyWolf 以前的版本中,用户可以选择 OpenCL 设备和平台来执行多项任务的并行计算,但与二维(2D)快速傅立叶变换(FFT)算法相关的任务除外。后一项任务的计算时间较长,因为需要在四维阵列的二维切片上执行大量的二维 FFT。对于多核 CPU 而言,在这些循环和其他任务中使用基于多线程的计算是一个优势,可以显著减少计算时间。在此,我介绍 PyWolf 的 3.0.0 版本,它为二维 FFT 计算添加了一个多线程选项。新版本程序摘要程序标题:PyWolfCPC Library 程序文件链接:https://doi.org/10.17632/frjscxypkd.3Developer's repository 链接:https://github.com/tiagoecmagalhaes/PyWolfLicensing provisions:GPLv3 编程语言:Python补充材料:上一版本的期刊参考文献:Comput.Phys.294 (2024) 108899.Reasons for the new version:在 PyWolf 最初的论文[1]和之前的版本[2]中,并行计算只使用 PyOpenCL 进行。然而,在某些情况下,如果 CPU 有多个内核,多线程[3]可以显著减少某些任务的计算时间,例如二维快速傅立叶变换(FFT)的循环。新版本内置了多线程选项,用户可以选择数值模拟中使用的线程数量:PyWolf 增加了对多线程的支持,用户现在可以在 PyWolf 的图形用户界面中选择该功能,并在仿真中选择可用线程的数量。在当前版本中,多线程仅用于 2D FFT 的循环,但可以很容易地扩展到其他任务。问题的本质:使用四维阵列[4]、[5]以菲涅尔或远场近似的方式传播来自平面光源的部分相干光需要大量内存和计算时间。PyWolf 使用 PyOpenCL 进行并行计算,以减少跨谱密度函数传播过程中耗时的计算[4],内存容量是主要限制因素:解决方法:使用开源工具包 PyOpenCL 和多线程来减少计算时间。用户可以修改和添加 PyWolf 的更多功能,如源、传播和几何模型。用户还可以添加定制的光学元件(如透镜和光圈)。基于 PyQt5 的图形用户界面可让用户轻松设置输入参数以模拟其光学设置,绘制和导出模拟结果,以及保存或加载模拟会话。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
An improved version of PyWolf with multithread-based parallelism support
PyWolf is an open-source software with a graphical user interface that performs numerical simulations of the cross-spectral density function propagation of planar sources using parallel computation through PyOpenCL. In the previous versions of PyWolf, the user could select the OpenCL devices and platforms to perform the parallel computations on several tasks, except for that related to the two-dimensional (2D) fast Fourier transform (FFT) algorithm. The latter task can have a large computation time since one has to perform a large amount of 2D FFTs over 2D slices of a four-dimensional array. The option of using multithread-based computation on these loops and other tasks can be an advantage for multi-core CPUs and can significantly decrease the computation time. Here, I present version 3.0.0 of PyWolf, which adds a multithreading option to be used for the 2D FFT computations. This multithreading option can also be easily implemented in other time-consuming tasks.

New version program summary

Program Title: PyWolf
CPC Library link to program files: https://doi.org/10.17632/frjscxypkd.3
Developer's repository link: https://github.com/tiagoecmagalhaes/PyWolf
Licensing provisions: GPLv3
Programming language: Python
Supplementary material: Overview of the main changes with performance results.
Journal reference of previous version: Comput. Phys. Commun. 294 (2024) 108899.
Reasons for the new version: In the original paper of PyWolf [1] and in the previous version [2], parallel computation was performed only using PyOpenCL. However, in some cases where multiple cores are available in the CPU, multithreading [3] can significantly decrease the computation time of some tasks, for instance, the loops of 2D fast Fourier transforms (FFTs). This new version includes a built-in option for multithreading, enabling users to select the number of threads to be used in the numerical simulation.
Summary of revisions: Multithreading support was added to PyWolf and users can now select this feature in PyWolf's graphical user interface and choose the number of available threads to be used in the simulation. In the current version, multithreading is only used for the loops of 2D FFTs but can be easily extended to other tasks. Other small features have been added and some issues have been corrected, namely: (i) a requirements file has been added listing all the libraries used; (ii) some errors associated with file paths have been corrected.
Nature of problem: Propagation of partially coherent light from planar sources in the Fresnel or far field approximations using four-dimensional arrays [4], [5] demands large memory and computation time. PyWolf uses PyOpenCL to perform parallel computation to reduce time-consuming calculations in the propagation of the cross-spectral density function [4], restricting the memory capacity as the main limitation.
Solution method: The open-source toolkit PyOpenCL along with multithreading is used to decrease the computation time. Users can modify and add more features to PyWolf, such as source, propagation, and geometrical models. Custom-made optical components can also be added (e.g., lenses and apertures). The PyQt5-based graphical user interface enables users to easily set the input parameters to simulate their optical setup, plot and export the simulated results, and save or load the simulation session.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
Computer Physics Communications
Computer Physics Communications 物理-计算机:跨学科应用
CiteScore
12.10
自引率
3.20%
发文量
287
审稿时长
5.3 months
期刊介绍: The focus of CPC is on contemporary computational methods and techniques and their implementation, the effectiveness of which will normally be evidenced by the author(s) within the context of a substantive problem in physics. Within this setting CPC publishes two types of paper. Computer Programs in Physics (CPiP) These papers describe significant computer programs to be archived in the CPC Program Library which is held in the Mendeley Data repository. The submitted software must be covered by an approved open source licence. Papers and associated computer programs that address a problem of contemporary interest in physics that cannot be solved by current software are particularly encouraged. Computational Physics Papers (CP) These are research papers in, but are not limited to, the following themes across computational physics and related disciplines. mathematical and numerical methods and algorithms; computational models including those associated with the design, control and analysis of experiments; and algebraic computation. Each will normally include software implementation and performance details. The software implementation should, ideally, be available via GitHub, Zenodo or an institutional repository.In addition, research papers on the impact of advanced computer architecture and special purpose computers on computing in the physical sciences and software topics related to, and of importance in, the physical sciences may be considered.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信