Yes it does
Interesting, not even MS-MPI?
Unfortunately MS-MPI only supports a subset of MPI 3 features. I’m not sure which MPI 3 features OpenCoarrays needs, but my attempt to compile it against MS-MPI was failing about 30% of the included testsuite.
Intel MPI supports MPI 3.1 on Windows. It is free (part of the Intel oneAPI HPC Toolkit, along with the Intel Fortran compiler.)
I have installed stdlib using setup-stdlib
command.
Now how to use it in my projects with fpm ?
I have started using fpm using these steps.
Now how can I use stdlib modules inside my first_steps\app\main.f90
file and use fpm run
?
You can use any module from here:
https://stdlib.fortran-lang.org/
But it would be nice to document exactly how you add it as a dependency into fpm.toml
and show some examples of usage.
@Ashok after you figure out the details, would you mind submitting a PR against the stdlib documentation to document it please?
Hi @Ashok,
You have two choices for using stdlib
with fpm in the quickstart-fortran environment:
1. Use stdlib
as a fpm dependency (recommended)
Add the following to your fpm.toml
file:
[dependencies]
stdlib = { git="https://github.com/fortran-lang/stdlib", branch="stdlib-fpm" }
and you can immediately start using any stdlib
module in your package.
This option will build stdlib
for each fpm project you start which has a few advantages:
- It allows specifying a particular version of
stdlib
; - It allows you to use multiple compilers
(Building stdlib
is a bit slow, but you only have to do it once for each fpm project!)
2. Use the globally-installed stdlib
The setup-stdlib
script is provided for those who want a global installation of stdlib
, such as for use with other build systems. (This also means you only have to build stdlib
once.)
If you want to use this with fpm, add the following to your fpm.toml
file:
[build]
link = "stdlib"
external-modules = ["stdlib_sorting", "stdlib_logger"] # Your used modules here
where you need to add any stdlib
modules that you use to the external-modules
field.
If you install stdlib
globally, it will only work with the gfortran
installation that comes with quickstart-fortran, and not with any other compiler like Intel OneAPI.
Thanks for testing the new docs. I’m currently writing the second tutorial for using dependencies, like stdlib, with fpm. If you have further suggestion, for any tutorials we should write and include in fpm’s documentation, feel free to post them here:
Thanks a lot.
1 worked. 2 is not working for me.
I’ve now updated the Quickstart Fortran installer to install fpm with parallel builds enabled. This will speedup builds on multicore machines when using big dependencies like stdlib
.
What was the error when you tried this?
Thank you so much for writing that documentation.
The first tutorial is great. It would be nice to demonstrate similarly (short tutorials) how to use custom directories for fpm. Right now there are src, app and build directories. But how we can have our own directory names for - where we want the modules to be, where we want the i/o files to be…
Right now I think you have already put than in the reference section, some tutorials on that may help. As I use more I will let you know.
/usr/lib/gcc/x86_64-pc-cygwin/11/…/…/…/…/x86_64-pc-cygwin/bin/ld: cannot find -lstdlib
collect2: error: ld returned 1 exit status
Compilation failed for object " first_steps.exe "
stopping due to failed compilation
STOP 1
Ah okay thanks; it looks like that is a different compiler installation (cygwin?) to the one provided with the quickstart installer. (The setup-stdlib
script only installs stdlib
for the gcc/gfortran that comes with the quickstart installer).
Glad the first method is working for you — this is the preferred approach since it doesn’t have these limitations.
Yeah, I have previously installed cygwin.
Thank you.
This installer is great! However, I am running into a permissions issue. When I try to run executables, I get an error message
W:\nsha\Documents\milne> fpm run --example ex1
Access is denied.
<ERROR> Execution failed for object " ex1.exe "
<ERROR>*cmd_run*:stopping due to failed executions
STOP 1
I am not very Windows-literate, but is there some configuration that I missed? A relevant detail may be that this is a managed machine, not a personal one.
Edit: And now I can run executables, with no apparent intervention on my part. Very odd, Windows…
Edit2: And now I’m being blocked again. Maybe this is a question for my sysadmin…
Thanks for the feedback @nshaffer - I’ve not come across this issue before.
I’ve been able to reproduce the same error when running fpm on a network drive. I think this may be a Windows permissions problem with executing code off network shares. Have you tried running the executable from Windows explorer? (it should be in build/gfortran_*/example
or similar ).
Thanks for confirming. I don’t fully understand what’s going on, but it’s definitely related to the network drive (running from File Explorer doesn’t help). If I move the whole project to a local folder on my C: drive, everything “just works”. So maybe that’s the workaround going forward.
Cool! @lkedward , is it possible to include mpich or openmpi in this installer too?
I mean, on linux one only need
sudo apt install gfortran mpich
Then gfortran and mpi automatically installed, and mpif90 will immediately work.
In windows I always wish there is a similar thing. If after installing this on windows, gfortran + mpi can work it will be really nice!
For my personal research it does not matter, I can always install Intel OneAPI or gfortran and mpi. But if I were to use Fortran + MPI to develop a package and let user to use it, then having gfortran + mpi easily already configured on the users’ windows computer would be very nice:)
It would be great if this Quickstart Fortran could be bundled to Code::Blocks for Fortran. That will make it something similar to Matlab, a one-stop software solution.
I’d like to share a pitfall I fell when I switched to Quickstart Fortran from another gfortran environment.
I used to use TDM-GCC-64 and switched to Quickstart Fortran.
After switching, when executed binaries built using TDM-GCC-64, an error occurred. The error dialog said libgfortran_64-5.dll is not found. It exists in TDM-GCC-64, but it does not in MinGW-w64 bundled with Quickstart Fortran.
I had to rebuild binaries and libraries I had built using TDM-GCC-64 to fix this error.