导航:首页 > 程序命令 > ifort编译命令

ifort编译命令

发布时间:2023-10-21 09:48:01

㈠ 请教ifort和pgf90编译差别的问题

方法一:
假如现在有两个Fortran程序1.f90和2.f90,其中1.f90是主程序,2.f90是在主程序中调用的子程序,将这两个程序传到linux的一个目录下,使用fortran编译命令,如PGI的pgf90,Intel的ifort,命令如下:
pgf90 -o exe_name 1.f90 2.f90
ifort -o exe_name 1.f90 2.f90
方法二:
在主程序1.f90中加入include '2.f90'语句,然后在Linux下用fortran命令编译,命令如下:
pgf90 -o exe_name 1.f90
ifort -o exe_name 1.f90

㈡ 如何 fortran 编译成 .obj

看你在何种操作平台(windows还是linux),是使用何种编译器,何种版本?是通过集成环境,还是命令行编译?

一般情况下,键入编译器的名称,空格,然后源代码名称就可以编译为 obj 文件了。
比如 Intel Fortran,键入 ifort 源代码.f90 既可。
某些编译器可能会同时自动链接为exe,但是obj还是会为你保留的。

如果通过集成开发环境,通常按下编译按钮既可完成。而 obj 文件一般位于 Debug 文件夹或 Release 文件夹。

㈢ ifort命令怎么编译mpi

1、icc

Intel C/C++编译器接受遵守ANSI C/C++ , ISO C/C++ standards,GNU inline ASM for IA-32 architecture标准的输入。与linux下常用的gcc兼容并支持更大的C语言扩展,包括源文件、命令行参数、目标文件。不支持gcc的inline方式的汇编。例,f.c

#include<stdio.h>

int main(int argc, char* argv[]){

printf("Hello\n");

return 0;

}

编译:icc -c f.cpp -o f.o

链接:icc f.o -o f

运行:./f

注意,编译与链接都由icc来完成,icc常用命令行参数:

-o 输出文件命名

-I include路径

-L lib路径

-l 包含的lib名

-c 仅生成目标文件(*.o),不链接

-On n=0,1,2,3 编译器优化选项,n=0关闭编译器优化,n=3使用最激进的优化

-c99[-] 打开/关闭 c99规范的支持

详细的请参照icc的manpage.

2、ifort

Intel Fortran编译器支持F77/90/95标准并与CFV(Compaq Visual Fortran)兼容。例,f.f90

program f

print *, "Hello"

stop

end

编译:ifort -c f.f90 -o f.o

链接:ifort f.o -o f

运行:./f

编译与连接同样由ifort来完成,ifort常用命令行参数:

-o 输出文件命名

-I include路径

-L lib路径

-l 包含的lib名

-c 仅生成目标文件(*.o),不链接

-On n=0,1,2,3 编译器优化选项,n=0关闭编译器优化,n=3使用最激进的优化

-std90 使用F90标准编译

-std95 使用F 95标准编译

-f77rtl 编译使用F77运行方式的代码(用于解决特殊问题)

These options optimize application performance for a particular Intel? processor or family of processors. The compiler generates code that takes advantage of features of the specified processor.

Option

Description
tpp5 or G5 Optimizes for Intel? Pentium? and Pentium? with MMX? technology processors.
tpp6 or G6 Optimizes for Intel? Pentium? Pro, Pentium? II and Pentium? III processors.
tpp7 or G7 Optimizes for Intel? Pentium? 4, Intel? Xeon?, Intel? Pentium? M processors, and Intel? Pentium? 4 processors with Streaming SIMD Extensions 3 (SSE3) instruction support.
On Intel? EM64T systems, only option tpp7 (Linux) or G7 (Windows) is valid.

About tpp:

http://www.ncsa.illinois.e/UserInfo/Resources/Software/Intel/Compilers/9.0/main_for/mergedProjects/copts_for/common_options/option_tpp567_g567.htm

https://wiki.ke.e/display/SCSC/Compilers+and+Libraries

Intel Fortran Compiler Options: http://geco.mines.e/guide/ifort.html

Intel(R) Fortran Compiler Options: http://www.rcac.pure.e/userinfo/resources/common/compile/compilers/intel/man/ifort.txt

ifort编译器提供了非常多的优化参数

$ ifort --help | more 查看就可以
也可以定位到某个参数

$ifort --help | grep -5 '-mkl'
-5表示显示查找到的行及下面5行的内容。

3、Intel MKL数学库针对Intel系列处理器进行了专门的优化,主要包含的库有:

基本线形代数运算(BLAS)

向量与向量、向量与矩阵、矩阵与矩阵的运算

稀疏线形代数运算

快速傅立叶变换(单精度/双精度)

LAPACK(求解线形方程组、最小方差、特征值、Sylvester方程等)

向量数学库(VML)

向量统计学库(VSL)

高级离散傅立叶变换

编译:

icc multi.c -I/opt/intel/mkl/include –L/intel/mkl/lib –lmpi_ipf –o multi

4、MPI程序编译

消息传递接口(MPI)并行程序设计模型程序的编译命令。例,f.c

include<stdio.h>

#include<mpi.h>

main(argc,argv)

int argc;

char *argv[];

{

char name[BUFSIZ];

int length;

MPI_Init(&argc,&argv);

MPI_Get_processor_name(name, &length);

printf("%s: hello world\n", name);

MPI_Finalize();

}

编译与连接均使用mpicc,参数与mpicc中定义的编译器相同,这里与icc相同。

mpicc –c hello.c –o hello.o

mpicc hello.o –o hello

运行使用mpirun 命令,将运行需要的节点定义在文件中并在-machinfile中制定。

文件: nodelist

node1

node1

node2

node3

运行:

$mpirun –machefile nodelist –np 4 ./hello

node1: hello world

node1: hello world

node2: hello world

node3: hello world

5、32位向64位的移植

32位程序到64位移植中应注意的常见问题:

数据截断:

由于long类型变量的运算(赋值、比较、移位等)产生。long定义在x86上为32bits,而在ia64上为64bits.容易在与int型变量运算时出现异常。

处理方法:尽量避免不同类型变量间的运算,避免将长度较长的变量赋值到较短的变量中,统一变量长度可以解决这个问题。简单的对于32位转移到64位可以将所有long定义转换为int定义。

㈣ 已经安装了visual studio 和intel visual Fortran complier,为什么还是不能在cmd里面用ifort命令

  1. 在IVF安装目录找到ifort.exe

  2. 把找到的文件夹路径添加到 path 环境变量

  3. 命令行使用 ifort

阅读全文

与ifort编译命令相关的资料

热点内容
卡尔曼滤波算法书籍 浏览:769
安卓手机怎么用爱思助手传文件进苹果手机上 浏览:844
安卓怎么下载60秒生存 浏览:803
外向式文件夹 浏览:240
dospdf 浏览:431
怎么修改腾讯云服务器ip 浏览:392
pdftoeps 浏览:496
为什么鸿蒙那么像安卓 浏览:736
安卓手机怎么拍自媒体视频 浏览:186
单片机各个中断的初始化 浏览:724
python怎么集合元素 浏览:481
python逐条解读 浏览:833
基于单片机的湿度控制 浏览:499
ios如何使用安卓的帐号 浏览:883
程序员公园采访 浏览:812
程序员实战教程要多长时间 浏览:979
企业数据加密技巧 浏览:135
租云服务器开发 浏览:814
程序员告白妈妈不同意 浏览:337
攻城掠地怎么查看服务器 浏览:601