ubuntu源码编译(ubuntu编译chromium)

ubuntu源码编译(ubuntu编译chromium)这一篇专栏教程我放的私货太多 主要是放了很多实用工具和数据库链接 这些都是为了以后进行并行开发准备的 这就好比准备做饭 我把锅 铲 勺子 碗 筷子 瓢盆 燃料 柴 米 油 盐 酱 醋 茶 肉 菜都准备好了 但是搞了个大阵仗 却告诉你今天只教你开关点火 因此 属于有点扯 教程和示例验证直接拉到最后看 这个教程是关于并行环境开发的 当然我主要是研究 particle in

大家好,我是讯享网,很高兴认识大家。



这一篇专栏教程我放的私货太多。主要是放了很多实用工具和数据库链接。这些都是为了以后进行并行开发准备的。这就好比准备做饭,我把锅、铲、勺子、碗、筷子、瓢盆、燃料、柴、米、油、盐、酱、醋、茶、肉、菜都准备好了,但是搞了个大阵仗,却告诉你今天只教你开关点火。因此,属于有点扯,教程和示例验证直接拉到最后看。

这个教程是关于并行环境开发的,当然我主要是研究particle in cell粒子模拟的(缩写是PIC)。其实也不是研究,主要是利用particle in cell进行激光等离子体物理模拟计算的。这一块儿主要有三个主要的开源程序OSIRIS、epoch和SmileiPIC(或Smilei)。后两个一直是在更新的。Osiris虽然是开源的,但必须通过一定渠道获得,不像后两个可以直接从GitHub上获取。

Smilei官网:

https://smileipic.github.io/Smilei/

https://smileipic.github.io/Smilei/

 

https://github.com/SmileiPIC

https://github.com/SmileiPIC

https://github.com/SmileiPIC/Smilei

https://github.com/SmileiPIC/Smilei

 

 


讯享网

https://github.com/SmileiPIC/Smilei/tags

https://github.com/SmileiPIC/Smilei/tags

 

GitHub-epoch PIC程序 SDF已被独立出来

https://github.com/Warwick-Plasma

https://github.com/Warwick-Plasma

 

注意: GitHub 上面 epoch 安装包下的 SDF 被独立出来了,如下图所示。

需要单独下载、上传和解压。 主要是下载 FORTRAN 和 Matlab,上传后文件夹重命名为FORTRAN,并移动到 epoch 安装包 SDF 文件夹下,仍然以 FORTRAN 命名。

https://github.com/Warwick-Plasma/SDF

https://github.com/Warwick-Plasma/SDF

分别进入 epoch 安装包的 epoch1d、 epoch2d、 epoch3d 并用 make COMPILER=gfortran命令编译,等待全部编译完成后,修改~/.bashrc 文件,添加 epoch 可执行文件的路径。

export PATH=/data/home/YLin23/software/epoch-4.17.10/epoch1d/bin:\(PATH</p><p>export PATH=/data/home/YLin23/software/epoch-4.17.10/epoch2d/bin:\)PATH

export PATH=/data/home/YLin23/software/epoch-4.17.10/epoch3d/bin:\(PATH</p><p> </p><p>https://github.com/Warwick-Plasma/epoch</p><p>https://github.com/Warwick-Plasma/epoch</p><p> </p><p>Git安装方法</p><p style="text-align: center;">sudo apt-get install git</p><p style="text-align: center;">sudo apt install git</p><p>git clone --recursive https://github.com/Warwick-Plasma/epoch.git</p><p style="text-align: center;"><strong>没成功!可以用make COMPILER=gfortran来编译</strong></p><p>这个是很容易安装成功的,只是我没有用Git安装成功</p><p> </p><p>GitHub-osiris PIC程序</p><p>需要的zlib库文件:</p><p>https://www.zlib.net/</p><p>https://www.zlib.net/</p><p> </p><p>需要的szip库文件</p><p>https://support.hdfgroup.org/doc_resource/SZIP/</p><p>https://support.hdfgroup.org/doc_resource/SZIP/</p><p>https://support.hdfgroup.org/ftp/HDF5/documentation/doc_resource/</p><p>https://support.hdfgroup.org/ftp/HDF5/documentation/doc_resource/</p><p> </p><p>需要的hdf5源程序</p><p>https://support.hdfgroup.org/ftp/HDF5/</p><p>https://support.hdfgroup.org/ftp/HDF5/</p><p>https://support.hdfgroup.org/ftp/HDF5/releases/</p><p>https://support.hdfgroup.org/ftp/HDF5/releases/</p><p> </p><p>需要的OpenMPI并行编译</p><p>https://www.open-mpi.org/</p><p>https://www.open-mpi.org/</p><p>https://www.open-mpi.org/software/ompi/v5.0/</p><p>https://www.open-mpi.org/software/ompi/v5.0/</p><p>https://www.open-mpi.org/software/ompi/v4.0/</p><p>https://www.open-mpi.org/software/ompi/v4.0/</p><p> </p><p>OpenMPI需要作业调度系统openpbs和slurm</p><p>https://softpanorama.org/HPC/PBS_and_derivatives/PBSpro/Installation/index.shtml</p><p>https://softpanorama.org/HPC/PBS_and_derivatives/PBSpro/Installation/index.shtml</p><p>https://slurm.schedmd.com/</p><p>https://slurm.schedmd.com/</p><p>https://github.com/openpbs/openpbs/tags</p><p>https://github.com/openpbs/openpbs/tags</p><p>https://github.com/openpbs</p><p>https://github.com/openpbs</p><p>https://slurm.schedmd.com/download.html</p><p>https://slurm.schedmd.com/download.html</p><p> </p><p>这种作业调度系统就跟手机一样,专门卖高性能计算机的厂商是有软件工程师可以为你安装好的。你只需要提要求安装slurm还是openPBS就行了,他们还会提供后续的使用咨询服务。这就像你穿衣服但并不自己生产衣服,你玩手机但并不自己生产手机,道理是一样的。我们只需要跟高性能计算机市场对接就行了。当然,作业调度系统的提交任务的脚本你还是要自己能看懂的,就像你买了手机自己要会使用才行。</p><p> </p><p>GNU/GCC编译器网址:</p><p>https://gcc.gnu.org/</p><p>https://gcc.gnu.org/</p><p>https://gcc.gnu.org/mirrors.html</p><p>https://gcc.gnu.org/mirrors.html</p><p>清华大学开源镜像</p><p>https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/</p><p>https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/</p><p>上海交大开源镜像</p><p>https://mirrors.sjtug.sjtu.edu.cn/gnu/gcc/</p><p>https://mirrors.sjtug.sjtu.edu.cn/gnu/gcc/</p><p> </p><p>GoLP-IST/osiris源程序网址</p><p>https://github.com/GoLP-IST/osiris</p><p>https://github.com/GoLP-IST/osiris</p><p>https://osirisdoc.wimpzilla.ist.utl.pt/dev/index.php/Reference_Guide</p><p>https://osirisdoc.wimpzilla.ist.utl.pt/dev/index.php/Reference_Guide</p><p>https://osirisdoc.wimpzilla.ist.utl.pt/</p><p>https://osirisdoc.wimpzilla.ist.utl.pt/</p><p> </p><p>OSIRIS需要一定的渠道才能登陆下载,不过另外两个PIC程序都是自由下载的。</p><p> </p><p>为什么要安装特定版本的gnu/gcc编译器呢?因为有些程序并没有随着C语言的标准来进行更新。以OSIRIS为例,是2018年11月份更新了一次。后面再也没有消息了。谁也不知道还更不更新了。因此,及早未雨绸缪很重要。但是在转向epoch和Smilei的过程中,我们还是要保证osiris在过渡期能够使用。</p><p>这个系列是从geant4开始的,我们在这里补充一些数据库。这些数据库可能是geant4没有的(这点不确定)。</p><p>核物理主题数据库·中国核物理评价数据库</p><p>http://www.nuclear.csdb.cn/</p><p>http://www.nuclear.csdb.cn/</p><p> </p><p>核物理主题数据库·中国核物理评价数据库·核天体数据库</p><p>http://www.nuclear.csdb.cn/endf.html</p><p>http://www.nuclear.csdb.cn/endf.html</p><p>http://www.nuclear.csdb.cn/endf.html</p><p>http://www.nuclear.csdb.cn/endf.html</p><p> </p><p> </p><p>我们从gnu/gcc官网或者镜像源中下载特定版本的gnu/gcc安装包,这里以gcc-9.2.0版本为例</p><p>正常的解压缩,建立安装文件目录就直接跳过了。注意尽量不要在源代码文件中安装,哪怕你在源代码文件中新建个build文件夹都行。别问我是怎么知道了,想想谁是成功他妈。</p><p> </p><p>1、先解决需要预安装的程序</p><p>执行https://www.bilibili.com/read/contrib/download_prerequisites</p><p>提示error: You must run this script in the top-level GCC source directory</p><p>不要慌这只是提示你要在源代码文件夹执行该命令,而我在新建build执行就出错了</p><p> </p><p>https://www.bilibili.com/read/cv28755754/contrib/download_prerequisites</p><p>2、执行configure</p><p>https://www.bilibili.com/read/cv28755754/configure --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --prefix=/build</p><p> </p><p>https://www.bilibili.com/read/cv28755754/configure --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --prefix=/build</p><p> </p><p>--enable-languages=c,c++,fortran是确定编译语言有C、C++、Fortran这些是主流。</p><p>--disable-multilib查了一下是跟交叉编译有关,官网上的解释是</p><p>Specify that multiple target libraries to support different target variants, calling conventions, etc. should not be built. The default is to build a predefined set of them.</p><p>含义是不需要考虑同一个系列硬件架构下面的兼容性,例如aarch64目标机能运行,是否需要做aarch32上运行?x86_64的程序是否需要做i586上运行等等,一般应该没这种需求。</p><p>--prefix=dirname是安装路径,官网上的解释是</p><p>Specify the toplevel installation directory. This is the recommended way to install the tools into a directory other than the default. The toplevel installation directory defaults to /usr/local.</p><p> </p><p>反正大概概念了解即可,不求甚解。</p><p>make -jN</p><p>make install</p><p> </p><p>这个我在Ubuntu22.04上实际上是没有编译成功的。Ubuntu也很难向下兼容更低版本的gcc编译器。我在CentOS 7系统上用这个方法成功过很多次。因此,这也不要紧,我们直接用Ubuntu默认的编译器编译OpenMPI,这里我所选择的版本是OpenMPI-4.1.3</p><p>正常解压缩步骤我们都跳过。我们一定要在一个新建的空文件夹里安装,注意这个目录是自/home/这一级开始向下寻找的</p><p> </p><p>https://www.bilibili.com/read/cv28755754/configure --prefix=/home/ydn/opt/software/openmpi-4.1.3/build</p><p>make -j 2</p><p>make install</p><p> </p><p>最后没有报错</p><p>接下来修改环境变量vi ~/.bashrc用gedit也能修改都是加两行</p><p>source ~/.bashrc</p><p>#openMPI-4.1.3</p><p>export PATH=/home/ydn/opt/software/openmpi-4.1.3/build/bin:\)PATH

export LD_LIBRARY_PATH=/home/ydn/opt/software/openmpi-4.1.3/build/lib:$LD_LIBRARY_PATH

来看看几个并行编译器mpirun、mpicc、mpicxx、mpifort都在不在?

示例验证

找到OpenMPI源代码文件里面的examples文件夹,直接执行make,会生成一个https://www.bilibili.com/read/cv/hello_c的可执行文件,然后执行

mpirun -n 2 https://www.bilibili.com/read/cv/hello_c

这是因为我这里只有两个线程,多了就会出错。

小讯
上一篇 2025-05-05 19:41
下一篇 2025-05-27 23:26

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/181266.html