GithubHelp home page GithubHelp logo

fortran-lang / setup-fortran Goto Github PK

View Code? Open in Web Editor NEW
70.0 6.0 24.0 77 KB

GitHub action to setup Fortran compiler and toolchain

Home Page: https://github.com/marketplace/actions/setup-fortran

License: Apache License 2.0

Shell 96.55% Fortran 0.29% Batchfile 2.33% C 0.40% C++ 0.43%

setup-fortran's Introduction

Setup Fortran

Test Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub tag

Set up a Fortran compiler on Ubuntu, macOS and Windows runners.

Usage

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        toolchain:
          - {compiler: gcc, version: 13}
          - {compiler: intel, version: '2023.2'}
          - {compiler: intel-classic, version: '2021.10'}
          - {compiler: nvidia-hpc, version: '23.11'}
        include:
          - os: ubuntu-latest
            toolchain: {compiler: gcc, version: 12}
        exclude:
          - os: macos-latest
            toolchain: {compiler: intel, version: '2023.2'}
          - os: macos-latest
            toolchain: {compiler: nvidia-hpc, version: '23.11'}
          - os: windows-latest
            toolchain: {compiler: nvidia-hpc, version: '23.11'}

    steps:
      - uses: fortran-lang/setup-fortran@v1
        id: setup-fortran
        with:
          compiler: ${{ matrix.toolchain.compiler }}
          version: ${{ matrix.toolchain.version }}

      - run: |
          ${{ env.FC }} ... # environment vars FC, CC, and CXX are set
          ${{ steps.setup-fortran.outputs.fc }} ... # outputs work too

Options

  • compiler: Compiler toolchain to setup, available options are
    • gcc for gfortran
    • intel for ifx
    • intel-classic for ifort
    • lfortran for lfortran
    • nvidia-hpc for nvfortran
  • version: Version of the compiler toolchain. See runner compatibility charts below.

Outputs

The action sets the following outputs:

  • fc: Fortran compiler executable, e.g. gfortran
  • cc: C compiler executable, e.g. gcc
  • cxx: C++ compiler executable, e.g. g++

C/C++ compilers of the same toolchain/version are provided where available. If a standalone Fortran compiler is selected, the action will attempt to configure compatible C/C++ compilers (typically GCC, or MSVC on Windows), but this is not guaranteed — use at your own risk.

Environment variables

The same values are also set as environment variables:

  • FC
  • CC
  • CXX

Corresponding FPM environment variables are also set:

  • FPM_FC
  • FPM_CC
  • FPM_CXX

These are made available to subsequent workflow steps via the GITHUB_ENV environment file mechanism.

Runner compatibility

Toolchain support varies across GitHub-hosted runner images.

runner gcc 9 gcc 10 gcc 11 gcc 12 gcc 13 intel 2021.1 intel 2021.1.2 intel 2021.2 intel 2021.4 intel 2022.0 intel 2022.1 intel 2022.2 intel 2022.2.1 intel 2023.0 intel 2023.1 intel 2023.2 intel 2024.0 intel 2024.1 intel-classic 2021.1 intel-classic 2021.1.2 intel-classic 2021.2 intel-classic 2021.3 intel-classic 2021.4 intel-classic 2021.5 intel-classic 2021.6 intel-classic 2021.7 intel-classic 2021.7.1 intel-classic 2021.8 intel-classic 2021.9 intel-classic 2021.10 intel-classic 2021.11 intel-classic 2021.12 lfortran 0.31.0 lfortran 0.32.0 lfortran 0.33.0 nvidia-hpc 20.11 nvidia-hpc 21.11 nvidia-hpc 22.11 nvidia-hpc 23.3 nvidia-hpc 23.5 nvidia-hpc 23.7 nvidia-hpc 23.9 nvidia-hpc 23.11
macos-12
macos-13
macos-14
ubuntu-20.04
ubuntu-22.04
windows-2019
windows-2022

Note: Intel's ifx compiler is not supported on macOS, so the intel option redirects to intel-classic (ifort).

Note: LFortran is currently only discoverable by name with bash on Windows, see here for context.

License

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “as is” basis, without warranties or conditions of any kind, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

setup-fortran's People

Contributors

amontoison avatar awvwgk avatar gha3mi avatar github-actions[bot] avatar kohei-noda-qcrg avatar ludnic avatar minhqdao avatar nbelakovski avatar perazz avatar scharlton2 avatar wpbonelli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

setup-fortran's Issues

Add default/local option

The action is currently network-dependent. All three runner images come with gfortran (windows via mingw), it would be nice to have an option to use the pre-installed one. E.g. bool "local" overriding any compiler/version selection.

Support setting up Intel toolchain

Step for Intel on Linux:

    - name: Install Intel (Linux)
      if: ${{ contains(matrix.os, 'ubuntu') && contains(matrix.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }}
      run: |
        wget https://apt.repos.intel.com/intel-gpg-keys/${{ env.KEY }}
        sudo apt-key add ${{ env.KEY }}
        rm ${{ env.KEY }}
        echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
        sudo apt-get update
        sudo apt-get install ${{ env.PKG }}
      env:
        KEY: GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
        PKG: ${{ env.LINUX_INTEL_COMPONENTS }}

Step for Intel on MacOS:

    - name: Install Intel HPCKit (OSX)
      if: ${{ contains(matrix.os, 'macos') && contains(matrix.compiler, 'intel') && steps.cache-install.outputs.cache-hit != 'true' }}
      run: |
        curl --output ${{ env.OUT }} --url "$URL" --retry 5 --retry-delay 5
        hdiutil attach ${{ env.OUT }}
        if [ -z "$COMPONENTS" ]; then
          sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
          installer_exit_code=$?
        else
          sudo /Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
          installer_exit_code=$?
        fi
        hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
        exit $installer_exit_code
      env:
        OUT: webimage-hpc.dmg
        URL: ${{ env.MACOS_HPCKIT_URL }}
        COMPONENTS: all

Requires caching due to download size which is not available in composite actions. Also we can't set environment variables or update the path in composite actions.

Create a release

Hi,

Can you please create a release so that actions are not using @main:

uses: awvwgk/setup-fortran@main

Thanks.

add-apt-repository command stops when trying to test in local machine using nektos/act

I sometimes use nektos/act to test a program in a local environment and then push it, in order to reduce unnecessary testing of GitHub actions in a private repository.

I used this action to simplify the setup of gfortran, but when doing add-apt-repository I get the following message and have to press the keyboard to proceed.

More info: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.

Keyboard input during action execution is disabled in nektos/act, so to set up gfortran with this action,
I need to redirect as gh act > out etc.

To solve this problem we need to add the --yes option to the add-apt-repository command.
https://stackoverflow.com/questions/45548826/apt-get-how-to-bypass-pressing-enter#:~:text=This%20message%20stems%20from%20a%20call %20to%20add%2Dapt%2Drepository.

LAPACK and BLAS Support

Hi,
I am thinking on adding support for certain libraries to setup-fortran, especially LAPACK and BLAS. Do you think setup-fortran is the right place for this?

Support devcontainer

Hello! I have been using GitHub Codespaces (which uses the devcontainer under the hood) and just wondering if any plan to implemenet a devcontainer which contains the Fortran setup and tooling? Microsoft has an opensource repo for different types of devcontainers supporting different tech stacks, but there is no fortran atm. https://github.com/microsoft/vscode-dev-containers

Thank you!
Lu

Ordering of compatibility matrix columns

The compatibility matrix is currently ordered the following way:

intel-classic 2021.1.2 -> intel-classic 2021.10 -> ... -> intel-classic 2021.2

It would be great to have it ordered according to their numeric values:

intel-classic 2021.1.2 -> intel-classic 2021.2 -> ... -> intel-classic 2021.10

It would make it easier to find the latest release of a compiler.

Screenshot:

Screenshot 2024-07-28 at 15 16 41

Suggestion: support `version: latest`

Would it be possible to support version: latest, which will deploy the latest version of the compiler available under the platform? Thank you very much!

`ubuntu-latest` + `gcc` seems to be no longer working.

Hej,

I've using this action for a few weeks now and it worked perfectly until earlier today. Whenver I want to test my code with ubuntu-latest and gcc (whether it is 12 or 13), I get the following error:

Run fortran-lang/setup-fortran@main
Run action_path=$(echo '//home/runner/work/_actions/fortran-lang/setup-fortran/main' | sed -e 's/\\/\//g' -e 's/://')
+ compiler=gcc
++ uname -s
++ tr '[:upper:]' '[:lower:]'
+ platform=linux
+ [[ Linux == \m\a\c\O\S ]]
+ case $compiler in
+ version=12
+ install_gcc linux
+ local platform=linux
+ case $platform in
+ install_gcc_apt
++ apt show gcc
++ grep Version
++ cut -d: -f3
++ cut -d- -f1
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
+ cur=11.2.0
++ echo 11.2.0
++ cut -d. -f1
+ maj=11
+ '[' 11 == 12 ']'
+ sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
Traceback (most recent call last):
 File "/usr/bin/add-apt-repository", line 364, in <module>
   sys.exit(0 if addaptrepo.main() else 1)
 File "/usr/bin/add-apt-repository", line 347, in main
   shortcut = handler(source, **shortcut_params)
 File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
   return handler(shortcut, **kwargs)
 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 82, in __init__
   if self.lpppa.publish_debug_symbols:
 File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 120, in lpppa
   self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
 File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line [5](https://github.com/nekStab/LightKrylov/actions/runs/9599688291/job/26475970836#step:3:6)92, in __call__
   response, content = self.root._browser._request(
 File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 429, in _request
   raise error
lazr.restfulclient.errors.ServerError: HTTP Error [50](https://github.com/nekStab/LightKrylov/actions/runs/9599688291/job/26475970836#step:3:52)3: Service Unavailable
Response headers:
---
-content-encoding: gzip
connection: close
content-length: 2155
content-type: text/html
date: Thu, 20 Jun 2024 15:31:32 GMT
server: Apache/2.4.41 (Ubuntu)
status: 503
vary: Accept-Encoding
---
Response body:
---
b'<!DOCTYPE html>\n<html\n  xmlns="http://www.w3.org/1999/xhtml"\n  xml:lang="en"\n  lang="en"\n>\n<head>\n  <title>Launchpad is temporarily unavailable</title>\n  <link\n    type="text/css" rel="stylesheet" media="screen, print"\n    href="https://launchpad.net/+icing/basic-error.css" />\n</head>\n<body>\n  <div class="page-center-wrap">\n    <div class="page-center">\n      <div class="page-center-content">\n        <div id="header">\n          <div class="graphic">\n            :(\n          </div>\n          <div class="content">\n            <!-- Before editing, please see\n                https://bugs.launchpad.net/bugs/47[53](https://github.com/nekStab/LightKrylov/actions/runs/9599688291/job/26475970836#step:3:55)71, especially comment #2,\n                for details on this file. In particular, please maintain the\n                \\r\\n line endings, at least for the HTTP header lines. -->\n            <h1>Uh oh!</h1>\n            <h2>Something has gone wrong. We\'re sorry!</h2>\n            <p>\n              If we are in the middle of an update, Launchpad will be\n              back in a
---
Error: Process completed with exit code 1.

I suppose this is related to ubuntu-toolchain-r/test ppa being removed from Ubuntu images as discussed here.

Test build tool discovery

It may be worth CI testing whether commonly used build tools (e.g. fpm, meson, CMake) can discover ifx/ifort after install.

Issues known or suspected

compiler/version build tool platform
ifx 2023.2 Meson Ubuntu
ifx 2023.2, Meson, Ubuntu 22.04

Fails on meson setup with

...
Sanity testing Fortran compiler: ifx
Is cross compiler: False.
Sanity check compiler command line: ifx sanitycheckf.f90 /Fesanitycheckf.exe /link
Sanity check compile stdout:

-----
Sanity check compile stderr:
ifx: error #10236: File not found: '/Fesanitycheckf.exe'
ifx: error #10236: File not found: '/link'

-----

meson.build:1:0: ERROR: Compiler ifx can not compile programs.

undefined symbol: _intel_fast_memset

Traceback (most recent call last):
  File "/usr/share/miniconda3/envs/test_env/bin/exorad_opac_create", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/home/runner/work/exorad/exorad/exorad/exorad_opac/bin/exorad_opac_create", line 11, in <module>
    from exorad_opac import wrap_standard_preprocessing
  File "/home/runner/work/exorad/exorad/exorad/exorad_opac/exorad_opac/__init__.py", line 2, in <module>
    from .preprocessing import PRTPreprocessingWrapper, PreprocessingWrapper
  File "/home/runner/work/exorad/exorad/exorad/exorad_opac/exorad_opac/preprocessing.py", line 4, in <module>
    from .chemistry import calc_eq_abunds
  File "/home/runner/work/exorad/exorad/exorad/exorad_opac/exorad_opac/chemistry.py", line 4, in <module>
    from petitRADTRANS.poor_mans_nonequ_chem import interpol_abundances
  File "/usr/share/miniconda3/envs/test_env/lib/python3.10/site-packages/petitRADTRANS/__init__.py", line 18, in <module>
    from petitRADTRANS.radtrans import Radtrans
  File "/usr/share/miniconda3/envs/test_env/lib/python3.10/site-packages/petitRADTRANS/radtrans.py", line 14, in <module>
    from petitRADTRANS import _read_opacities
  File "/usr/share/miniconda3/envs/test_env/lib/python3.10/site-packages/petitRADTRANS/_read_opacities.py", line 9, in <module>
    from petitRADTRANS import fort_input as fi
ImportError: /usr/share/miniconda3/envs/test_env/lib/python3.10/site-packages/petitRADTRANS/fort_input.cpython-[31](https://github.com/exorad/exorad/actions/runs/6666744607/job/18118863964?pr=45#step:15:32)0-x86_64-linux-gnu.so: undefined symbol: _intel_fast_memset

I am trying to use this actions for one of my fortran codes. In this action, I have a pip install that installs a python code with interface to a fortran code (compiled with f2py).

All of that works fine, but executing the compiled binary raises the error undefined symbol: _intel_fast_memset.

This is how I set up the intel compilers:

      - name: Setup intel compilers
        uses: fortran-lang/setup-fortran@v1
        id: setup-ifort
        with:
          compiler: 'intel'
          version: '2023.2'
        if: ${{ matrix.use_ifort }}

Switch to javascript action

Required for using caching and setting of environment variables (updating PATH, CPATH, LIBRARY_PATH, ...).

cmake No CMAKE_Fortran_COMPILER could be found.

(Sorry for spamming with issues)

CMakeLists.txt header:

cmake_minimum_required(VERSION 2.6)
project(packmol Fortran)

Step example:

 - name: Compile using cmake
      if: matrix.compiler == 'cmake'
      run: |
        cmake ./ && cmake --build ./
      shell: bash

Error:

-- The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_Fortran_COMPILER could be found.

See repo: https://github.com/afonari/packmol/

Sometimes failed CI workflows

A scheduled CI workflow has been set up for this repository. However, the CI workflow sometimes fails. This is because the Report compatibility job automatically returns an error because the test job continues to run for more than a day without the Report compatibility job running.

According to the test of my forked repository, the total duration of this repository's CI is about 13 minutes.
https://github.com/kohei-noda-qcrg/setup-fortran/actions/runs/5577205876
(This CI is just trying to automatically create a pull request to awvwgk/setup-fortran and failing, so don't worry about Report Compatibility failing!)

However, the total duration time of CI in this repository is significantly longer after this scheduled CI, and the probability of test failure has also increased!

The problem reported by @w-bonelli in the following comment seems to be related to this issue.
#16 (comment)

But I am not sure how to resolve this problem.
@awvwgk
Do you have any opinions or solutions?

Supporting gfortran 13

Hello @awvwgk !

First of all, thank the team for this wonderful work! I use this action multiple times each and every day for the PRIMA project. It is life-changing that Fortran compilers are made available on GitHub Actions so that I can automate the test and verification of my code, which are impossible on my local machines given the large amount and high frequency of the randomized experiments.

Now that gfortran-13 has been released, I am eager to test my project using this new version of the compiler. I understand that it takes time to support gfortran-13, and I look forward to seeing it implemented.

Many thanks and best regards,
Zaikun

feat: Add ability to cache compilers between runs

It would be extremely useful if the Action had a key option cache, similar to setup-python that could enable/disable caching the downloaded compilers and the setup.

Suggestion

    - uses: fortran-lang/[email protected]
      id: setup-fortran
      with:
        compiler: ${{ matrix.toolchain.compiler }}
        version: ${{ matrix.toolchain.version }}
        cache: true  # optional, default is false

intel + windows + fpm issue

Hi,
I have a compile problem with the setup currently with the combo intel (ifort/ifx) + windows that I don't manage to see where it comes from:
https://github.com/jalvesz/fast_math/actions/runs/7534919393/job/20510066540

Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.10.0 Build 20230609_000000
<ERROR> Compilation failed for object " test_fast_math.exe "
Copyright (C) 1985-2023 Intel Corporation.  All rights reserved.

ifort: command line warning #10006: ignoring unknown option '/xhost'
ifort: command line warning #10161: unrecognized source type 'build\ifort_5B04FF2A4A1[58](https://github.com/jalvesz/fast_math/actions/runs/7534919393/job/20510066540#step:6:59)0B5\fast_math\test_test_fast_math.f90.o'; object file assumed
link: unknown option -- s
Try 'link --help' for more information.
<ERROR> stopping due to failed compilation
STOP 1
Error: Process completed with exit code 1.

I have a windows machine locally and I can't reproduce this pb. does it ring any bells?

Thanks for any advice,

Set up `ifort` *without* C/C++ compiler?

I currently have a project which uses Fortran and C++. The problem is that I want to compile the C++ code with MSVC and this action makes the Intel compiler the default for C++ and I can't find a way to unset it.

Any ideas?

`setup-fortran` stops working for `[macOS, gcc-13]`?

See

https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045

Error log:

Run fortran-lang/setup-fortran@main
  with:
    compiler: gcc
    version: 13
  env:
    ROOT_DIR: /Users/runner/work/prima/prima
    TEST_DIR: /tmp/gittest_1715609463_386[2](https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045#step:7:2)75360
    SEDI: sed -i ""
    GFORTRAN_VERSION: 1[3](https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045#step:7:3)
Run action_path=$(echo '//Users/runner/work/_actions/fortran-lang/setup-fortran/main' | sed -e 's/\\/\//g' -e 's/://')
  action_path=$(echo '//Users/runner/work/_actions/fortran-lang/setup-fortran/main' | sed -e 's/\\/\//g' -e 's/://')
  source "$action_path/setup-fortran.sh"
  
  compiler=${COMPILER:-gcc}
  platform=$(uname -s | tr '[:upper:]' '[:lower:]')
  
  if [[ "$RUNNER_OS" == "macOS" ]] && [[ "$compiler" == "intel" ]]; then
    echo "Compiler 'intel' not supported on macOS, falling back to 'intel-classic'"
    compiler="intel-classic"
  fi
  
  case $compiler in
    gcc)
      version=${VERSION:-13}
      install_gcc $platform
      ;;
    intel-classic)
      version=${VERSION:-2023.2.0}
      install_intel $platform true
      ;;
    intel)
      version=${VERSION:-202[4](https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045#step:7:4).1}
      install_intel $platform false
      ;;
    nvidia-hpc)
      version=${VERSION:-23.11}
      install_nvidiahpc $platform
      ;;
    lfortran)
      version=${VERSION:-0.33.0}
      install_lfortran $platform
      ;;
    *)
      exit 1
      ;;
  esac
  
  echo "FC=${FC}" >> $GITHUB_ENV
  echo "CC=${CC}" >> $GITHUB_ENV
  echo "CXX=${CXX}" >> $GITHUB_ENV
  shell: /bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    ROOT_DIR: /Users/runner/work/prima/prima
    TEST_DIR: /tmp/gittest_171[5](https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045#step:7:5)609463_38[6](https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045#step:7:6)275360
    SEDI: sed -i ""
    GFORTRAN_VERSION: 13
    COMPILER: gcc
    VERSION: 13
+ compiler=gcc
++ uname -s
++ tr '[:upper:]' '[:lower:]'
+ platform=darwin
+ [[ macOS == \m\a\c\O\S ]]
+ [[ gcc == \i\n\t\e\l ]]
+ case $compiler in
+ version=13
+ install_gcc darwin
+ local platform=darwin
+ case $platform in
+ install_gcc_brew
++ brew list --versions gcc
++ cut '-d ' -f2
+ current=13.2.0
++ echo [13](https://github.com/s-prima/prima/actions/runs/9052615000/job/24870501045#step:7:14).2.0
++ cut -d. -f1
+ current_major=13
GCC 13 already installed
+ '[' 13 == 13 ']'
+ echo 'GCC 13 already installed'
+ brew unlink gcc
Unlinking /usr/local/Cellar/gcc/13.2.0... 34 symlinks removed.
+ brew unlink gcc@13
Error: No such keg: /usr/local/Cellar/gcc@13
Error: Process completed with exit code 1.

Thank you for taking a look.

`intel` compiler not found in Windows `cmake` project build

Summary

This is for a Windows fortran project that uses cmake to build and test and uses Visual Studio 17 2022 as the generator. I need to install the intel-classic compiler, preferably the latest version, which is 2021.10. The compiler seemingly installs, but then cmake does not know the Fortran compiler identification and the build fails.

Details

My CI script (relevant parts):

jobs:
  CI_Windows:
    runs-on: [windows-latest]
    strategy:
      fail-fast: true

    - name: Setup Fortran
      uses: fortran-lang/setup-fortran@v1
      with:
        compiler: intel-classic
        version: '2021.10'

    - name: Check Compilers and Versions
      run: |
        echo $env:FC
        cmake --version
        python --version

    - name: Build and Test
      run: |
        .\build_and_test.bat

My build_and_test.bat script is as follows:

cmake -S . -B build
cmake --build build --config Debug -j %NUMBER_OF_PROCESSORS%

The output/error in the GitHub CI is:

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 6.2.9200.
-- The Fortran compiler identification is unknown
-- The C compiler identification is MSVC 19.35.32217.1
-- The CXX compiler identification is MSVC 19.35.32217.1
CMake Error at CMakeLists.txt:96 (project):
  No CMAKE_Fortran_COMPILER could be found.

I tried other GitHub Actions and the modflowpy/install-intelfortran-action@v1 action works for my project by takes a very long time. It appears this action is an ancestor of the current fortran-lang/setup-fortran action, so I'm hoping there is something in that older action that could be added to the current action to properly set environment variables such that cmake can correctly detect the Fortran compiler.

For information, here is the output of my successful CI when using the older Action:

-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 6.2.9200.
-- The Fortran compiler identification is Intel 2021.7.0.20220726
-- The C compiler identification is MSVC 19.35.32217.1
-- The CXX compiler identification is MSVC 19.35.32217.1

Thanks for helping and for creating these great tools!

Intel 2023.1.0 option: typo in URL address

It works anyways in the CI, but I believe this is a typo in the following URL:

MACOS_BASEKIT_URL=https:/registrationcenter-download.intel.com/akdlm/IRC_NAS/2516a0a0-de4d-4f3d-9e83-545b32127dbb/m_BaseKit_p_2023.1.0.45568.dmg
MACOS_HPCKIT_URL=https:/registrationcenter-download.intel.com/akdlm/IRC_NAS/a99cb1c5-5af6-4824-9811-ae172d24e594/m_HPCKit_p_2023.1.0.44543.dmg

My proposed fix is at PR #76.

Thank you @fortran-lang/admins @wpbonelli

Failing to install `intel-classic` on Windows runner with latest tag

I get the following output:

Unsupported platform: mingw64_nt-10.0-20348
+ case $compiler in
+ version=2021.10
+ install_intel mingw64_nt-10.0-20348 true
+ local platform=mingw64_nt-10.0-20348
+ local classic=true
+ case $platform in
+ echo 'Unsupported platform: mingw64_nt-10.0-20348'
+ exit 1

The latest version on main seems to work, though. Would you mind issuing a new release?

Set up MPI wrappers

It would be great if this could also set up the mpifort/mpif90/mpif77 wrappers for compiling MPI codes

`lfortran` not recognized on `windows-latest`

Tried running fpm test with the configuration windows-latest + lfortran + 0.33.0 and got:

 + mkdir build\dependencies
[  0%]                      run_f.f90
[ 12%]                      run_f.f90  done.

'lfortran' is not recognized as an internal or external command,
<ERROR> Compilation failed for object " src_run_f.f90.o "
operable program or batch file.
<ERROR> stopping due to failed compilation
STOP 1
Error: Process completed with exit code 1.

Problem on macOS with gfortran

Thanks for the project.

There is a problem with the mac operating system. It appears that it only works with gfortran version 10.

When running a simple fpm test on mac using gfortran, I encountered this error:

 dyld[2196]: Library not loaded: '/usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib'
  Referenced from: '/Users/runner/work/_temp/fpm'
  Reason: tried: '/usr/local/opt/gcc@10/lib/gcc/10/libgfortran.5.dylib' (no such file), '/usr/local/lib/libgfortran.5.dylib' (no such file), '/usr/lib/libgfortran.5.dylib' (no such file)
/Users/runner/work/_temp/378df7c3-1bf9-413a-8a60-858cb91f887e.sh: line 1:  2196 Abort trap: 6           fpm test
Error: Process completed with exit code 134.

To temporarily solve the problem, I used the following steps:

    - name: Setup Fortran on Windows
      if: contains( matrix.os, 'windows')
      uses: awvwgk/setup-fortran@v1
      with:
        compiler: ${{ matrix.toolchain.compiler }}
        version: ${{ matrix.toolchain.version }}

    - name: Setup Fortran on MacOS
      if: contains( matrix.os, 'macos')
      run: |
        brew reinstall gcc@12
        ln -s /usr/local/lib/gcc/current/libgfortran.5.dylib /usr/local/lib/
        ln -s /usr/local/lib/gcc/current/libquadmath.0.dylib /usr/local/lib/
        ln -s /usr/local/Cellar/gcc/13.1.0/bin/gfortran /usr/local/bin/gfortran
        # ln -s /usr/local/lib/gcc/current/bin/gfortran /usr/local/bin/gfortran

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.