- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I used to have ifort from Parallel Studio XE
When the licensed expired, I started using oneAPI
In addition to Visual Studio, some members of my team use the Sublime Text 3 IDE.
With Parallel Studio, there was a custom build system which could compile Fortran code using ifort:
{
"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}"]
}
]
}
Now, ipsxe-comp-vars is no longer included with oneAPI
I've tried to replicate this using the "setvars" files, but I get a "setvars is not recognized" error:
{
"cmd": ["cmd", "/e:on", "/v:on", "/k", "setvars 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\\2022.0.0\\windows\\bin\\intel64;${path}",
"variants":
[
{
"name": "Run",
"cmd": ["cmd", "/e:on", "/v:on", "/c", "setvars intel64 vs2022 && ifort ${file} && ${file_base_name}"]
}
]
}
But when i attempt to build any source file I get:
"setvars" is not recognized as an internal or external command, operable program or batch file
This is my system PATH:
How do I make this work?
As additional information, I tried to debug this a bit. If I open a cmd prompt, run setvars.bat and then invoke ifort, it works:
However if I try to do the same thing using PowerShell v7.2, I get the follwing:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps because the path to setvars.bat is C:\Program Files (x86)\Intel\oneAPI , which is not in your PATH (nor should it be.) Nor is it the folder listed in that custom build configuration.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The problem is that the changes that the setvars.bat does don't stick in PowerShell. The easiest way I found to deal with this is to establish the environment in the command shell (the new Windows Terminal works too), and then invoke PowerShell
:: initializing oneAPI environment...
Initializing Visual Studio command-line environment...
Visual Studio version 16.11.9 environment configured.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\"
Visual Studio command-line environment initialized for: 'x64'
: compiler -- latest
: debugger -- latest
: dev-utilities -- latest
: inspector -- latest
: mkl -- latest
: mpi -- latest
: tbb -- latest
:: oneAPI environment initialized ::
D:\Projects>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS D:\Projects> ifort -c
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.5.0 Build 20211109_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply Steve,
While your answer sheds light on the PowerShell issue and allows me to not switch to cmd when I want to invoke ifort using cli, the main issue is not addressed, i.e. why is setvars not in path/not detected while ipsxe-comp-vars was?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps because the path to setvars.bat is C:\Program Files (x86)\Intel\oneAPI , which is not in your PATH (nor should it be.) Nor is it the folder listed in that custom build configuration.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you again Steve.
For some reason I either overlooked that folder not being in my system PATH or assumed that the directories already in the PATH had a setvars.bat file as well.
I managed to solve my issue. Posting the build system config in case anyone arrives at this question in the future:
{
"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}"]
}
]
}
However, I still have one question. How come ipsxe-comp-var was in PATH and setvars isn't?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The folder containing the PSXE .bat file would not be in PATH unless you added it yourself (which your script did.) Once you execute ipsxe-comp-vars.bat, then one of the folders containing the compiler would be added to PATH, but there's no reason for the higher-level folder to be there since there's nothing there that would be searched for with just a name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The folder containing ipsxe-comp-varrs.bat was already in my PATH. The script I posted starts a cmd shell, executes ipsxe-comp-vars with 64 bits and visual studio 15 options, then invokes ifort on the currently opened file.
I honestly don't recall adding it to my PATH at any point, the build system config for the Parallel Studio ifort was found online, and it was a plug and play script for all the computers I tried it on

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page