I still do not understand the steps to use fpm with intel. I want to use it for windows 10. What I mean is perhaps where I should replace gfortran with ifx or whatever I need to modify. I do not see any relevant info here How-To guides — Fortran Package Manager (fortran-lang.org)
Yes. Note all the environment variables and command keywords related to compiling and linking options are described in the built-in help text, so “fpm help build” provides some descriptions.
All the help text can be placed in a text file with a single command
fpm manual >fpm.txt
which describes using a response file as well.
For example, in the same directory as the fpm.toml manifest file create a file called “fpm.rsp” with lines like
Using ifx on windows requires properly settings a lot of paths and environmental variables.
The simplest is usually to use the intel console shipped with the compiler. It’s the classical cmd in which the required variables are properly set.
Then, you can just proceed as @ivanpribec said. And if you are using response file as @urbanjost suggested, just do not do it from a powershell terminal (@ character is not properly interpreted)
You haven’t set all the environment varaibles that are needed for the compiler to work.
If you are using the Intel oneApi toolkit, you should find a .bat file, that will set up everything for you. You should find it here:
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
So run it in the terminal, then you should be able to find the ifort command (the ifx compiler should be available for you now too)
If you do not use the oneApi command prompt (that simply run the setvars mentioned above) that will be a lot trickier. In addition, since you are using the msys2 terminal, the variables need to be set in your mingw environment, not on windows.
default intel terminal which I usually use to run the code with intel compiler (It comes with intel).
windows terminal.
Msys2 terminal for fmp.
So now the relevant options are 1) and 3).
Now I wanna know which command I should use for setting environment variable in the Msys2 terminal? and how about the path? path is the same as environment variable? I think they are different!
From my personal experience, only option 1 is straightforward and with option 3 you will face many issues starting with incompatible paths between Windows and the Unix kinds used by msys2.
The simplest for you is to use option 1 and make sure that fpm is in the Windows Path. If you installed fpm with msys2, just add the installation folder into your path environmental variables. On my computer, fpm is installed under “C:\msys64\mingw64\bin”. Once done, just start the intel terminal and type fpm --help to make sure it is accessible.
From there, you should be good to go.
By the way, if you are using VSCode you can add the intel terminal to your default terminals.
Simply create a script named intel.cmd with the following command
just make sure that the paths and arguments are correct for you. I usually place that file in the .vscode folder.
Then, in your *.code-workspace (alternatively, in the settings.json), paste the following
@davidpfister what if Windows had a shell that would be a strict subset of Bash/Zsh, but unlike git-bash/msys2 without any weird/confusing Linux like path overlay, so it would handle Windows paths directly? I would think a lot of the native Windows command-line programs might work better, and as a bonus one could write exactly the same script to build a project (or do other things) and it would run unmodified on Linux, macOS and Windows, which would be very handy for end users and at a CI, etc.
It would sound like Christmas to me . You also have to consider that the rules for specifying the root is different, the max path length is different… and allowed characters and spaces. In the example mentioned above with vscode I could not get it to work without using a script because of the space between ‘Program’ and ‘Files’ and because vscode does not support double quoting the arguments.
From what I saw Cygwin is shipped with some utility program (cygpath) that can do the path conversion.
@davidpfister excellent. I have not fully figured out all cases yet, but I’ve noticed PowerShell just automatically quotes Windows paths with spaces. So that’s how the interactive Bash like shell can behave too. Instead of:
It needs to work with most .bat files, I am hoping that if one can check what environment variables changed, the Bash-like shell can figure it out and bring it to the current environment.
If that helps, upon installation, oneapi installer creates the env. var. ONEAPI_ROOT that should correspond to “C:\Program Files (x86)\Intel\oneAPI”. It still needs to be double-quoted though.
As for powershell, despite the disturbing syntax, it’s a pretty cool shell. Too bad it does not handle response files very well as mentionned above.
Sorry if I was not clear. I assumed that you used msys2 to install fpm and because of this, fpm will not be automatically present in the Windows path.
So you can proceed as follows:
check the installation folder of fpm:
- if you used msys2, the path should be “C:\msys64\mingw64\bin”
- if you used winget, the path should be %LOCALAPPDATA%\Microsoft\WinGet\Packages
- if you build fpm from source, then if could be whatever
C:\Program Files (x86)\Intel\oneAPI>cd /d C:\Users\owner\Desktop\fpm_test
C:\Users\owner\Desktop\fpm_test>fpm build --compiler ifx
‘fpm’ is not recognized as an internal or external command,
operable program or batch file.
After revisiting this (not an MSWindows/powershell user so not positive) but it looks like @ is only special at the beginning of a simple name so allowing an @ at the end to be treated as equivalent to an @ at the beginning of the word seems more appealing than double-quoting or creating responses with a dash in the name. I am not sure how much interest in that there is but I can put in a PR for that if it seems like a solution anyone would use/need.