使用VS2019+Intel OneAPI (ifort)+Intel MPI编译和运行MPI程序与Coarray程序

您所在的位置:网站首页 新型冠状病毒肺炎的防控方法 使用VS2019+Intel OneAPI (ifort)+Intel MPI编译和运行MPI程序与Coarray程序

使用VS2019+Intel OneAPI (ifort)+Intel MPI编译和运行MPI程序与Coarray程序

2024-07-14 03:10:14| 来源: 网络整理| 查看: 265

使用VS2019+Intel OneAPI (ifort)+Intel MPI编译和运行MPI程序与Coarray程序 一、安装环境 安装vs2019安装Intel OneAPI Base Toolkit中的Intel Fortran Compiler,并勾选与vs2019适配安装Intel OneAPI HPC Toolkit中的Intel MPI运行intel mpi安装目录下/env/vars.bat进行环境变量的注册,路径为\mpi\.\env\vars.bat用管理员身份运行cmd或者shell,运行:hydra_service -install和hydra_service -start继续用管理员身份在cmd中运行:mpiexec -register,输入的用户名为空,密码为电脑的登陆密码运行:mpiexec -validate. 二、编译和运行MPI程序

以下是针对Release程序的设置,如果是Debug程序,需要相应修改,且只支持x64程序。

编译:

在Fortran—General—Additional Include Directories加入C:\Program Files (x86)\Intel\oneAPI\mpi\latest\include,也即mpi的include目录。在Linker—General—Additional Library Directories加入C:\Program Files (x86)\Intel\oneAPI\mpi\latest\lib和C:\Program Files (x86)\Intel\oneAPI\mpi\latest\lib\release.在Linker—Input—Additional Dependices加入impi.lib

运行:在cmd中使用mpiexec即可。 注记:windows下,如果运行exe时提示缺少MKL的dll,那么把linker-libraries-runtime libirary改成default(multithreaded),不要使用DLL.

三、编译和运行Coarray程序

编译:打开项目属性—Fortran—Language,开启Enable Coarrays并输入Coarray Images数量,直接编译。 运行:win系统上鼠标双击即可运行,或者通过cmd运行,别去用mpiexec。 注记:Coarray程序只要安装了Intel MPI就可以运行。

四、使用MKL

如果使用Fortran95编程,想要使用新的MKL Lapack函数,需要在VS2019加入mkl_lapack95_lp64.lib,其他的也类似处理。在Linux上,需要在编译选项添加-lmkl_lapack95_lp64.

五、Linux上用PBS启动分布式计算 1. 纯MPI

编写job.pbs文件如下,使用qsub job.pbs提交任务。

#PBS -N name #任务的名字 #PBS -l nodes=2:ppn=28 #请求2个节点,每个节点28个核心 #PBS -l walltime=24000:00:00 #运算时间无限 #PBS -q cu1 #节点在cu1队列中 #PBS -o stdout #标准输出到stdout #PBS -e stderr #标准错误到stderr #PBS -r y #可运行 #这一个对于纯MPI项目不重要,可写可不写 export I_MPI_JOB_RESPECT_PROCESS_PLACEMENT=off cd $PBS_O_WORKDIR #进入pbs文件所在目录 #编译 /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe rm -r *.mod #删除mod组件 mpirun -np 56 ./main.exe #启动2*28=56个进程

这样就启动了56个进程,正好占用满了所有申请的进程。如果启动的进程数量更少,那么就有空置的进程。

2. 混合MPI/OpenMP #PBS -N name #任务的名字 #PBS -l nodes=2:ppn=28 #请求2个节点,每个节点28个核心 #PBS -l walltime=24000:00:00 #运算时间无限 #PBS -q cu1 #节点在cu1队列中 #PBS -o stdout #标准输出到stdout #PBS -e stderr #标准错误到stderr #PBS -r y #可运行 #禁用PBS系统的进程排布方案,在mpirun显式指定 export I_MPI_JOB_RESPECT_PROCESS_PLACEMENT=off cd $PBS_O_WORKDIR #进入pbs文件所在目录 #编译 /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe /opt/intel/impi/5.0.2.044/intel64/bin/mpiifort *.f90 -O3 -mtune=native -march=native -xHost -m64 -r8 -fpp -ipo -qopt-prefetch=5 -qopenmp -qopenmp-simd -no-wrap-margin -mcmodel=large -fp-model fast=1 -mkl=sequential -lmkl_lapack95_lp64 -o main.exe rm -r *.mod #删除mod组件 mpirun -np 2 -ppn 1 ./main.exe #启动2个进程,每个node一个进程

这样,一共2个节点,每个节点1个MPI进程,节点内部使用OpenMP共享内存并行。



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭