有人知道如何为oneAPI Fortran编译器编写构建系统吗?以前,我使用的是并行Studio,我设法使用解决方案here使它工作。
{
"cmd": ["cmd", "/e:on", "/v:on", "/k", "ipsxe-comp-vars intel64 vs2013 && ifort ${file}"],
"file_regex": "^.*\\\\([0-9A-Za-z_]+\\.[A-Za-z0-9]+)\\(([0-9]+)\\):[ ]+error[ ]+#([0-9]+):[ ]+(.*)$",
"working_dir":"${file_path}",
"selector":"source.f ,source.for ,source.ftn ,source.f90 ,source.fpp ,source.i ,source.i90",
"encoding":"cp936",
"path":"C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.4.210\\windows\\bin;${path}",
"variants":
[
{
"name": "Run",
"cmd": ["cmd", "/e:on", "/v:on", "/c", "ipsxe-comp-vars intel64 vs2013 && ifort ${file} && ${file_base_name}"]
}
]
}我试着把路改到新的路上,但这行不通。我得到以下错误:
"ipsxe-comp-vars" is not recognized as an internal or external command,
program o executable.发布于 2022-03-03 08:31:03
我找到了答案。请解释如下。在这里发布工作构建系统以提高可见性。
这应该是构建系统:
{
"cmd": ["cmd", "/e:on", "/v:on", "/S", "/k", "C:\\\"Program Files (x86)\"\\Intel\\oneAPI\\setvars.bat intel64 vs2022 && ifort ${file}"],
"file_regex": "^.*\\\\([0-9A-Za-z_]+\\.[A-Za-z0-9]+)\\(([0-9]+)\\):[ ]+error[ ]+#([0-9]+):[ ]+(.*)$",
"working_dir":"${file_path}",
"selector":"source.f ,source.for ,source.ftn ,source.f90 ,source.fpp ,source.i ,source.i90",
"encoding":"cp936",
"path":"C:\\Program Files (x86)\\Intel\\oneAPI\\compiler\\latest\\windows\\bin\\intel64;${path}",
"variants":
[
{
"name": "Run",
"cmd": ["cmd", "/e:on", "/v:on", "/s", "/c", "C:\\\"Program Files (x86)\"\\Intel\\oneAPI\\setvars.bat intel64 vs2022 && ifort ${file} && ${file_base_name}"]
}
]
}为什么会发生这个问题?
首先,ipsxe是一个批处理文件,在运行时设置执行英特尔编译器所需的环境变量。此文件特定于Intel (IPSXE)。现在,在安装IPSXE时,它会将这个批处理文件添加到您的路径中,这意味着您可以从任何目录调用ipsxe来设置所需的环境变量。
英特尔oneAPI有一个名字不同的文件,本质上是做同样的事情,叫做setvars.bat。此文件存储在:
C:\Program Files (x86)\Intel\oneAPI\setvars.bat因此,最初看来,调用ipsxe似乎失败了,因为文件的名称不同。但是,与的IPSXE不同,oneAPI不向PATH添加setvars,因此不能简单地调用setvars,必须使用完整的路径。
如何解决这个问题
使用IPSXE,您可以调用ipsxe vars,它将运行设置环境变量的批处理文件,但是使用oneAPI,可以将文件添加到路径中(因为它有一个泛型名称而不重新命名),或者在调用它时使用完整路径(与上面相同):
C:\Program Files (x86)\Intel\oneAPI\setvars.bat现在,因为您必须将其插入构建系统配置中,所以需要正确地格式化它。ST在cmd.exe中运行命令,因此您必须使用正确的选项,并以cmd可以理解的方式格式化路径: options (您可以通过打开cmd提示符、键入cmd /?并点击返回获得完整的列表):
- /e:on Enables command extensions
- /v:on Enables extension of environment variables
- /s Modifies how the string following a /c or /k is read
- /k Executes the string command and continuessetvars.bat文件的路径必须格式化如下:
C:\\\"Program Files (x86)\"\\Intel\\oneAPI\\setvars.bat以下选项是特定于setvars.bat文件的:
- intel64 specifies 64-bit configuration
- vs2022 specifies Visual Studio 2022 as the developer cmd or
powershell version to use最后,在当前文件上使用ifort ${file}调用ifort
此外,构建系统是用一个变体"Run“完成的。此变体在编译后运行输出文件(&& ${file_base_name}),并将在崇高文本3控制台中显示输出(不接受输入,如果有人知道如何为Fortran设置sublimeREPL,请告诉我)
https://stackoverflow.com/questions/70711948
复制相似问题