From 468f7014338990871e76993b6d27b74c70970b00 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 06:46:33 -0500 Subject: [PATCH 01/25] Add example that is reported to be failing --- example/gaussian_scalar_multivar.f90 | 31 ++++++++++++++++++++++++++++ fpm.toml | 5 +++++ 2 files changed, 36 insertions(+) create mode 100644 example/gaussian_scalar_multivar.f90 diff --git a/example/gaussian_scalar_multivar.f90 b/example/gaussian_scalar_multivar.f90 new file mode 100644 index 0000000..afe493a --- /dev/null +++ b/example/gaussian_scalar_multivar.f90 @@ -0,0 +1,31 @@ +program gaussian_scalar_multivar + + use FEQParse + + implicit none + type(EquationParser) :: f + character(LEN=1),dimension(2) :: independentVars + character(LEN=30) :: eqChar + real :: x(2) + + ! Specify the independent variables + independentVars = (/'x', 'a'/) + + ! Specify an equation string that we want to evaluate + eqChar = 'f = \exp( -(x^2) ) - a' + ! eqChar = 'f = \exp( -(x^2) - a )' + ! eqChar = 'f = (x - a)^2 )' + + ! Create the EquationParser object + f = EquationParser(eqChar,independentVars) + + ! Evaluate the equation + x(1) = 1.0 + x(2) = 1.0 + print*, f % evaluate(x) + print*, exp(-1.0) -1.0 + + ! Clean up memory + call f % Destruct() + + end program gaussian_scalar_multivar \ No newline at end of file diff --git a/fpm.toml b/fpm.toml index 9f61e98..29a62e0 100644 --- a/fpm.toml +++ b/fpm.toml @@ -36,3 +36,8 @@ main = "scalar_with_scalar_eval.f90" name = "scalar_function_product" source-dir = "example" main = "scalar_function_product.f90" + +[[example]] +name = "gaussian_scalar_multivar" +source-dir = "example" +main = "gaussian_scalar_multivar.f90" From 67d965298861ffd7aef0cc8c9db11f523d7dc52c Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 06:53:48 -0500 Subject: [PATCH 02/25] Add ifort and windows to ci --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e83278f..a963125 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,6 +45,17 @@ jobs: compiler: gfortran-10 shell: bash build_type: fpm + - os: ubuntu-22.04 + os_name: linux + compiler: ifort + shell: bash + build_type: debug + # Windows + - os: windows-latest + os_name: windows + compiler: gfortran + shell: 'msys2 {0}' + test_type: debug defaults: run: shell: ${{ matrix.shell }} @@ -60,6 +71,35 @@ jobs: update: true install: git base-devel mingw-w64-x86_64-toolchain + - uses: actions/cache@v3 + id: cache + with: + path: /opt/intel/oneapi + key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ env.INTEL_ONEAPI_VERSION }} + - name: Install Intel oneAPI Fortran compiler + if: matrix.compiler == 'ifort' && steps.cache.outputs.cache-hit != 'true' + run: | + # download the key to system keyring + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + + # add signed entry to apt sources and configure the APT client to use Intel repository: + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + + # update package index and install Fortran compiler + sudo apt update + sudo apt-get install intel-oneapi-compiler-fortran-$INTEL_ONEAPI_VERSION + + # set environment variables and make them persistent across steps + . /opt/intel/oneapi/setvars.sh + env | grep oneapi >> $GITHUB_ENV + - name: Use existing Intel oneAPI Fortran compiler + if: matrix.compiler == 'ifort' && steps.cache.outputs.cache-hit == 'true' + run: | + # set environment variables and make them persistent across steps + . /opt/intel/oneapi/setvars.sh + env | grep oneapi >> $GITHUB_ENV + - name: Show version information run: | ${{ matrix.compiler }} --version From 62a08cf61091acbd3708804ac2d158ce9f3dfd8d Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 07:36:08 -0500 Subject: [PATCH 03/25] Add intel oneapi version env --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a963125..487a2e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,11 @@ on: - 'AUTHORS.md' - 'LICENSE.md' - 'README.md' - +env: + # Modify this variable to change the ifort compiler version - do NOT hardcode the version + # anywhere else! + INTEL_ONEAPI_VERSION: 2023.2.1 + jobs: test: if: "!contains(github.event.head_commit.message, 'skip ci')" From a696ae5b2f9fa4e7054a28f1f310eeef657f8607 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 12:53:15 -0500 Subject: [PATCH 04/25] Remove FortranCInterface requirement; add cmake install for windows * For the moment, the FortranCInterface requirement is not needed. --- .github/workflows/ci.yml | 4 ++-- CMakeLists.txt | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 487a2e1..380d563 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ env: # Modify this variable to change the ifort compiler version - do NOT hardcode the version # anywhere else! INTEL_ONEAPI_VERSION: 2023.2.1 - + jobs: test: if: "!contains(github.event.head_commit.message, 'skip ci')" @@ -73,7 +73,7 @@ jobs: if: ${{ matrix.os == 'windows-latest' }} with: update: true - install: git base-devel mingw-w64-x86_64-toolchain + install: git base-devel mingw-w64-x86_64-toolchain cmake - uses: actions/cache@v3 id: cache diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb812a..3917d19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ set(CMAKE_VERBOSE_MAKEFILE ON) PROJECT(feqparse Fortran C) SET(VERSION 0.0.0) -INCLUDE(FortranCInterface) -FortranCInterface_VERIFY() -IF(NOT FortranCInterface_VERIFIED_C) - MESSAGE(FATAL_ERROR "Fortran compiler must support C Interface") -ENDIF(NOT FortranCInterface_VERIFIED_C) +# INCLUDE(FortranCInterface) +# FortranCInterface_VERIFY() +# IF(NOT FortranCInterface_VERIFIED_C) +# MESSAGE(FATAL_ERROR "Fortran compiler must support C Interface") +# ENDIF(NOT FortranCInterface_VERIFIED_C) IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") From a624e568ed87676085f3cd198714d924a56cf0bb Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 12:58:08 -0500 Subject: [PATCH 05/25] FortranCInterface needed for testsuite --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3917d19..6bb812a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,11 @@ set(CMAKE_VERBOSE_MAKEFILE ON) PROJECT(feqparse Fortran C) SET(VERSION 0.0.0) -# INCLUDE(FortranCInterface) -# FortranCInterface_VERIFY() -# IF(NOT FortranCInterface_VERIFIED_C) -# MESSAGE(FATAL_ERROR "Fortran compiler must support C Interface") -# ENDIF(NOT FortranCInterface_VERIFIED_C) +INCLUDE(FortranCInterface) +FortranCInterface_VERIFY() +IF(NOT FortranCInterface_VERIFIED_C) + MESSAGE(FATAL_ERROR "Fortran compiler must support C Interface") +ENDIF(NOT FortranCInterface_VERIFIED_C) IF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) MESSAGE(FATAL_ERROR "Fortran compiler does not support F90") From de33587c729e168abde20522a3787967660a12d9 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 15:27:02 -0500 Subject: [PATCH 06/25] Add intel c compiler installation Add ccompiler matrix build variable --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 380d563..aebc8b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,12 @@ on: env: # Modify this variable to change the ifort compiler version - do NOT hardcode the version # anywhere else! - INTEL_ONEAPI_VERSION: 2023.2.1 + INTEL_ONEAPI_VERSION: 2024.0 jobs: test: if: "!contains(github.event.head_commit.message, 'skip ci')" - name: ${{ matrix.os_name }} - ${{ matrix.compiler }} - ${{ matrix.build_type }} - ${{ github.event_name }} + name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -31,33 +31,39 @@ jobs: # Linux - os: ubuntu-22.04 os_name: linux - compiler: gfortran-9 + fcompiler: gfortran-9 + ccompiler: gcc-9 shell: bash build_type: coverage - os: ubuntu-22.04 os_name: linux - compiler: gfortran-10 + fcompiler: gfortran-10 + ccompiler: gcc-10 shell: bash build_type: debug - os: ubuntu-22.04 os_name: linux - compiler: gfortran-11 + fcompiler: gfortran-11 + ccompiler: gcc-11 shell: bash build_type: debug - os: ubuntu-22.04 os_name: linux - compiler: gfortran-10 + fcompiler: gfortran-10 + ccompiler: gcc-10 shell: bash build_type: fpm - os: ubuntu-22.04 os_name: linux - compiler: ifort + fcompiler: ifx + ccompiler: icx-cc shell: bash build_type: debug # Windows - os: windows-latest os_name: windows - compiler: gfortran + fcompiler: gfortran + ccompiler: gcc shell: 'msys2 {0}' test_type: debug defaults: @@ -79,9 +85,9 @@ jobs: id: cache with: path: /opt/intel/oneapi - key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ env.INTEL_ONEAPI_VERSION }} + key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }} - name: Install Intel oneAPI Fortran compiler - if: matrix.compiler == 'ifort' && steps.cache.outputs.cache-hit != 'true' + if: matrix.fcompiler == 'ifx' && steps.cache.outputs.cache-hit != 'true' run: | # download the key to system keyring wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ @@ -91,14 +97,15 @@ jobs: echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list # update package index and install Fortran compiler - sudo apt update - sudo apt-get install intel-oneapi-compiler-fortran-$INTEL_ONEAPI_VERSION + sudo apt update -y + sudo apt-get -y install intel-oneapi-compiler-fortran-$INTEL_ONEAPI_VERSION intel-oneapi-dpcpp-cpp-$INTEL_ONEAPI_VERSION # set environment variables and make them persistent across steps . /opt/intel/oneapi/setvars.sh env | grep oneapi >> $GITHUB_ENV + - name: Use existing Intel oneAPI Fortran compiler - if: matrix.compiler == 'ifort' && steps.cache.outputs.cache-hit == 'true' + if: matrix.fcompiler == 'ifx' && steps.cache.outputs.cache-hit == 'true' run: | # set environment variables and make them persistent across steps . /opt/intel/oneapi/setvars.sh @@ -106,13 +113,14 @@ jobs: - name: Show version information run: | - ${{ matrix.compiler }} --version + ${{ matrix.fcompiler }} --version + ${{ matrix.ccompiler }} --version - name: Build with Cmake if: ${{ matrix.build_type != 'fpm' }} run: | cd build - FC=${{ matrix.compiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../ + FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../ make VERBOSE=1 - name: fpm tests @@ -120,7 +128,7 @@ jobs: run: | wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64 chmod +x ./fpm-0.9.0-linux-x86_64 && mv ./fpm-0.9.0-linux-x86_64 fpm - ./fpm install + ./fpm install --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} ./fpm test ./fpm run --example "*" From 006ec7af0be38d62946db9c1fdf5a93cb86d0969 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 15:30:37 -0500 Subject: [PATCH 07/25] Change intel version to 2023.2.1 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aebc8b7..4dc1f64 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ on: env: # Modify this variable to change the ifort compiler version - do NOT hardcode the version # anywhere else! - INTEL_ONEAPI_VERSION: 2024.0 + INTEL_ONEAPI_VERSION: 2023.2.1 jobs: test: From 7aa37fac4bd605cf3ce421841d8359138cb1ba00 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 15:37:13 -0500 Subject: [PATCH 08/25] Add compiler options to fpm test and run --- .github/workflows/ci.yml | 4 ++-- build/.gitkeep | 0 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 build/.gitkeep diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dc1f64..97ae0e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,8 +129,8 @@ jobs: wget https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0-linux-x86_64 chmod +x ./fpm-0.9.0-linux-x86_64 && mv ./fpm-0.9.0-linux-x86_64 fpm ./fpm install --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} - ./fpm test - ./fpm run --example "*" + ./fpm test --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} + ./fpm run --compiler ${{ matrix.fcompiler }} --c-compiler ${{ matrix.ccompiler }} --example "*" - name: Initialize coverage counters if: ${{ matrix.build_type == 'coverage' }} diff --git a/build/.gitkeep b/build/.gitkeep deleted file mode 100644 index e69de29..0000000 From 9e975f03bf07960695777a49e9952a1f0b806c74 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 15:38:45 -0500 Subject: [PATCH 09/25] create build directory for cmake --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97ae0e0..92f7f57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,6 +119,7 @@ jobs: - name: Build with Cmake if: ${{ matrix.build_type != 'fpm' }} run: | + mkdir build cd build FC=${{ matrix.fcompiler }} CC=${{ matrix.ccompiler }} cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ../ make VERBOSE=1 From 3507071b870547be1f4a34c09a65a34e78cec1b8 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 16:20:43 -0500 Subject: [PATCH 10/25] Add intel compiler flags; add ci timeout --- .github/workflows/ci.yml | 1 + CMakeLists.txt | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92f7f57..da786c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ env: jobs: test: + timeout-minutes: 10 if: "!contains(github.event.head_commit.message, 'skip ci')" name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb812a..359730e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,15 +17,30 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) # Default Fortran compiler flags # Fortran compiler flags + if( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" ) set( CMAKE_Fortran_FLAGS "-cpp -ffree-line-length-512" ) set( CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -C -Wall -fbounds-check -fbacktrace -ffpe-trap=invalid,zero,overflow" ) set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG} --coverage") set( CMAKE_Fortran_FLAGS_PROFILE "-pg -O3") set( CMAKE_Fortran_FLAGS_RELEASE "-O3" ) - set( CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage") +elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel" ) + set( CMAKE_Fortran_FLAGS "-fpp" ) + set( CMAKE_Fortran_FLAGS_DEBUG "-debug all" ) + set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG} -prof-gen=srcpos") + set( CMAKE_Fortran_FLAGS_PROFILE "-O3") + set( CMAKE_Fortran_FLAGS_RELEASE "-O3" ) + set( CMAKE_C_FLAGS_COVERAGE "-g -O0") + +elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "IntelLLVM" ) + set( CMAKE_Fortran_FLAGS "-fpp" ) + set( CMAKE_Fortran_FLAGS_DEBUG "-debug all" ) + set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG}") # Code coverage not available with ifx + set( CMAKE_Fortran_FLAGS_PROFILE "-O3") + set( CMAKE_Fortran_FLAGS_RELEASE "-O3" ) + set( CMAKE_C_FLAGS_COVERAGE "-g -O0") endif() ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/src) From a15e8dae5d8a25b7f8370c09dd0e24844da6c08d Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 16:22:46 -0500 Subject: [PATCH 11/25] print difference on failure --- test/asin_r4fp32.f90 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/asin_r4fp32.f90 b/test/asin_r4fp32.f90 index 4523417..c23bcfd 100644 --- a/test/asin_r4fp32.f90 +++ b/test/asin_r4fp32.f90 @@ -52,6 +52,7 @@ integer function asin_r4fp32() result(r) if (maxval(abs(feval - fexact)) <= epsilon(1.0_real32)) then r = 0 else + print*, maxval(abs(feval - fexact)),epsilon(1.0_real32) r = 1 end if From c1ba2c5aac0e47d09bd201358ca727f66b939c3e Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 16:27:02 -0500 Subject: [PATCH 12/25] Use relative error --- test/asin_r4fp32.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/asin_r4fp32.f90 b/test/asin_r4fp32.f90 index c23bcfd..8bdcbec 100644 --- a/test/asin_r4fp32.f90 +++ b/test/asin_r4fp32.f90 @@ -49,10 +49,10 @@ integer function asin_r4fp32() result(r) end do ! Evaluate the equation feval = f % evaluate(x) - if (maxval(abs(feval - fexact)) <= epsilon(1.0_real32)) then + if (maxval(abs(feval - fexact)) <= maxval(abs(fexact))*epsilon(1.0_real32)) then r = 0 else - print*, maxval(abs(feval - fexact)),epsilon(1.0_real32) + print*, maxval(abs(feval - fexact)),maxval(abs(fexact))*epsilon(1.0_real32) r = 1 end if From 54c8f5b0ba5b33732c255db13ad9e4883531f9db Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 16:32:15 -0500 Subject: [PATCH 13/25] Add valgrind check to debug builds --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da786c3..66a2dd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,8 @@ jobs: ccompiler: gcc-11 shell: bash build_type: debug + + - os: ubuntu-22.04 os_name: linux fcompiler: gfortran-10 @@ -168,7 +170,7 @@ jobs: flags: ctests - name: Run memory checks with Valgrind (only Linux) - if: ${{ matrix.os_name == 'linux' && matrix.test_type == 'valgrind' }} + if: ${{ matrix.os_name == 'linux' && matrix.test_type == 'debug' }} run: | sudo apt-get install -y valgrind - valgrind --error-exitcode=1 -s ./test/testsuite -A \ No newline at end of file + valgrind --error-exitcode=1 -s ./build/test/testsuite -A \ No newline at end of file From 6c7f3477362cb2e875ad8dd4c4fe30a14320d16c Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 16:36:46 -0500 Subject: [PATCH 14/25] Lower build timeout to 5 minutes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 66a2dd8..5fc87f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ env: jobs: test: - timeout-minutes: 10 + timeout-minutes: 5 if: "!contains(github.event.head_commit.message, 'skip ci')" name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} From af21f9d4245eaee5884c6c0a963d9a7c7e712508 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 1 Dec 2023 16:40:14 -0500 Subject: [PATCH 15/25] Now have gnu-9 through gnu-12 and intel debug and fpm builds --- .github/workflows/ci.yml | 49 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5fc87f9..c58cc73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,12 +36,21 @@ jobs: ccompiler: gcc-9 shell: bash build_type: coverage + + - os: ubuntu-22.04 + os_name: linux + fcompiler: gfortran-9 + ccompiler: gcc-9 + shell: bash + build_type: debug + - os: ubuntu-22.04 os_name: linux fcompiler: gfortran-10 ccompiler: gcc-10 shell: bash build_type: debug + - os: ubuntu-22.04 os_name: linux fcompiler: gfortran-11 @@ -49,6 +58,26 @@ jobs: shell: bash build_type: debug + - os: ubuntu-22.04 + os_name: linux + fcompiler: gfortran-12 + ccompiler: gcc-12 + shell: bash + build_type: debug + + - os: ubuntu-22.04 + os_name: linux + fcompiler: ifx + ccompiler: icx-cc + shell: bash + build_type: debug + + - os: ubuntu-22.04 + os_name: linux + fcompiler: gfortran-9 + ccompiler: gcc-9 + shell: bash + build_type: fpm - os: ubuntu-22.04 os_name: linux @@ -56,12 +85,29 @@ jobs: ccompiler: gcc-10 shell: bash build_type: fpm + + - os: ubuntu-22.04 + os_name: linux + fcompiler: gfortran-11 + ccompiler: gcc-11 + shell: bash + build_type: fpm + + - os: ubuntu-22.04 + os_name: linux + fcompiler: gfortran-12 + ccompiler: gcc-12 + shell: bash + build_type: fpm + - os: ubuntu-22.04 os_name: linux fcompiler: ifx ccompiler: icx-cc shell: bash - build_type: debug + build_type: fpm + + # Windows - os: windows-latest os_name: windows @@ -69,6 +115,7 @@ jobs: ccompiler: gcc shell: 'msys2 {0}' test_type: debug + defaults: run: shell: ${{ matrix.shell }} From f2a52a4fc9d6b3344dbc1ee1148c580907019cc8 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 4 Dec 2023 06:07:19 -0500 Subject: [PATCH 16/25] Resolve linking issue for windows builds (issue #14) Thanks @arjenmarkus for finding this! --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 55766f4..1438684 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,7 +39,7 @@ function (add_fortran_test_executable TARGET) add_executable (${TARGET} main.c) target_link_libraries (${TARGET} ${TARGET}_fortran) target_include_directories (${TARGET} PUBLIC ${TARGET}_fortran) - target_link_libraries (${TARGET} ${CMAKE_BINARY_DIR}/src/libfeqparse-static.a) + target_link_libraries (${TARGET} ${TARGET}_fortran feqparse-static) target_include_directories(${TARGET} PUBLIC ${CMAKE_BINARY_DIR}/include) set (INDEX 0) From 6c2f8761b3b6a57c29d59591130a85c9e7dd30b9 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 4 Dec 2023 13:35:53 -0500 Subject: [PATCH 17/25] Change arrays to allocatable The large bss size causes valgrind to fail the testsuite on some systems --- test/abs_r2fp32.f90 | 12 +++++++++--- test/abs_r2fp64.f90 | 11 ++++++++--- test/acos_r2fp32.f90 | 11 ++++++++--- test/acos_r2fp64.f90 | 11 ++++++++--- test/asin_r2fp32.f90 | 11 ++++++++--- test/asin_r2fp64.f90 | 11 ++++++++--- test/atan_r2fp32.f90 | 11 ++++++++--- test/atan_r2fp64.f90 | 11 ++++++++--- test/cos_r2fp32.f90 | 11 ++++++++--- test/cos_r2fp64.f90 | 11 ++++++++--- test/division_r2fp32.f90 | 11 ++++++++--- test/division_r2fp64.f90 | 11 ++++++++--- test/gaussian3d_r2fp32.f90 | 11 ++++++++--- test/gaussian3d_r2fp64.f90 | 11 ++++++++--- test/linear_r2fp32.f90 | 11 ++++++++--- test/linear_r2fp64.f90 | 11 ++++++++--- test/log10_r2fp32.f90 | 11 ++++++++--- test/log10_r2fp64.f90 | 11 ++++++++--- test/log_r2fp32.f90 | 11 ++++++++--- test/log_r2fp64.f90 | 11 ++++++++--- test/monadic_r2fp32.f90 | 11 ++++++++--- test/monadic_r2fp64.f90 | 11 ++++++++--- test/random_r2fp32.f90 | 8 ++++++-- test/random_r2fp64.f90 | 8 ++++++-- test/sech_r2fp32.f90 | 11 ++++++++--- test/sech_r2fp64.f90 | 11 ++++++++--- test/sin_r2fp32.f90 | 11 ++++++++--- test/sin_r2fp64.f90 | 11 ++++++++--- test/sqrt_r2fp32.f90 | 11 ++++++++--- test/sqrt_r2fp64.f90 | 11 ++++++++--- test/tan_r2fp32.f90 | 11 ++++++++--- test/tan_r2fp64.f90 | 11 ++++++++--- test/tanh_r2fp32.f90 | 11 ++++++++--- test/tanh_r2fp64.f90 | 11 ++++++++--- test/test.f90 | 2 +- 35 files changed, 270 insertions(+), 101 deletions(-) diff --git a/test/abs_r2fp32.f90 b/test/abs_r2fp32.f90 index dee1203..a0761cc 100644 --- a/test/abs_r2fp32.f90 +++ b/test/abs_r2fp32.f90 @@ -7,11 +7,15 @@ integer function abs_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,7 @@ integer function abs_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) + end function abs_r2fp32 diff --git a/test/abs_r2fp64.f90 b/test/abs_r2fp64.f90 index b41c720..0cc84d0 100644 --- a/test/abs_r2fp64.f90 +++ b/test/abs_r2fp64.f90 @@ -7,11 +7,15 @@ integer function abs_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function abs_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function abs_r2fp64 diff --git a/test/acos_r2fp32.f90 b/test/acos_r2fp32.f90 index 62e0f31..16eaa3e 100644 --- a/test/acos_r2fp32.f90 +++ b/test/acos_r2fp32.f90 @@ -7,11 +7,15 @@ integer function acos_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function acos_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function acos_r2fp32 diff --git a/test/acos_r2fp64.f90 b/test/acos_r2fp64.f90 index 88e42f5..e3f8e2f 100644 --- a/test/acos_r2fp64.f90 +++ b/test/acos_r2fp64.f90 @@ -7,11 +7,15 @@ integer function acos_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function acos_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function acos_r2fp64 diff --git a/test/asin_r2fp32.f90 b/test/asin_r2fp32.f90 index 50ac75e..c60d110 100644 --- a/test/asin_r2fp32.f90 +++ b/test/asin_r2fp32.f90 @@ -7,11 +7,15 @@ integer function asin_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function asin_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function asin_r2fp32 diff --git a/test/asin_r2fp64.f90 b/test/asin_r2fp64.f90 index ee3c0d7..8ef1f94 100644 --- a/test/asin_r2fp64.f90 +++ b/test/asin_r2fp64.f90 @@ -7,11 +7,15 @@ integer function asin_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function asin_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function asin_r2fp64 diff --git a/test/atan_r2fp32.f90 b/test/atan_r2fp32.f90 index 58e490d..6f3a685 100644 --- a/test/atan_r2fp32.f90 +++ b/test/atan_r2fp32.f90 @@ -7,11 +7,15 @@ integer function atan_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function atan_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function atan_r2fp32 diff --git a/test/atan_r2fp64.f90 b/test/atan_r2fp64.f90 index fff41b6..290037d 100644 --- a/test/atan_r2fp64.f90 +++ b/test/atan_r2fp64.f90 @@ -7,11 +7,15 @@ integer function atan_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function atan_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function atan_r2fp64 diff --git a/test/cos_r2fp32.f90 b/test/cos_r2fp32.f90 index af62faa..9e93887 100644 --- a/test/cos_r2fp32.f90 +++ b/test/cos_r2fp32.f90 @@ -8,11 +8,15 @@ integer function cos_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function cos_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function cos_r2fp32 diff --git a/test/cos_r2fp64.f90 b/test/cos_r2fp64.f90 index ffa62c7..3205c31 100644 --- a/test/cos_r2fp64.f90 +++ b/test/cos_r2fp64.f90 @@ -8,11 +8,15 @@ integer function cos_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function cos_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function cos_r2fp64 diff --git a/test/division_r2fp32.f90 b/test/division_r2fp32.f90 index d32a0ab..6eac733 100644 --- a/test/division_r2fp32.f90 +++ b/test/division_r2fp32.f90 @@ -9,11 +9,15 @@ integer function division_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -42,5 +46,6 @@ integer function division_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function division_r2fp32 diff --git a/test/division_r2fp64.f90 b/test/division_r2fp64.f90 index 0fc4e37..a2be1779 100644 --- a/test/division_r2fp64.f90 +++ b/test/division_r2fp64.f90 @@ -7,11 +7,15 @@ integer function division_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function division_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function division_r2fp64 diff --git a/test/gaussian3d_r2fp32.f90 b/test/gaussian3d_r2fp32.f90 index 02d6c65..fe35a8f 100644 --- a/test/gaussian3d_r2fp32.f90 +++ b/test/gaussian3d_r2fp32.f90 @@ -7,11 +7,15 @@ integer function gaussian3d_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function gaussian3d_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function gaussian3d_r2fp32 diff --git a/test/gaussian3d_r2fp64.f90 b/test/gaussian3d_r2fp64.f90 index 416efe8..313128c 100644 --- a/test/gaussian3d_r2fp64.f90 +++ b/test/gaussian3d_r2fp64.f90 @@ -7,11 +7,15 @@ integer function gaussian3d_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function gaussian3d_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function gaussian3d_r2fp64 diff --git a/test/linear_r2fp32.f90 b/test/linear_r2fp32.f90 index bc60841..1bc5977 100644 --- a/test/linear_r2fp32.f90 +++ b/test/linear_r2fp32.f90 @@ -9,11 +9,15 @@ integer function linear_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -42,5 +46,6 @@ integer function linear_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function linear_r2fp32 diff --git a/test/linear_r2fp64.f90 b/test/linear_r2fp64.f90 index 5b8ad44..078b56e 100644 --- a/test/linear_r2fp64.f90 +++ b/test/linear_r2fp64.f90 @@ -7,11 +7,15 @@ integer function linear_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function linear_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function linear_r2fp64 diff --git a/test/log10_r2fp32.f90 b/test/log10_r2fp32.f90 index e0d109c..f8e6855 100644 --- a/test/log10_r2fp32.f90 +++ b/test/log10_r2fp32.f90 @@ -7,11 +7,15 @@ integer function log10_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function log10_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function log10_r2fp32 diff --git a/test/log10_r2fp64.f90 b/test/log10_r2fp64.f90 index 7f1dab3..9f28215 100644 --- a/test/log10_r2fp64.f90 +++ b/test/log10_r2fp64.f90 @@ -7,11 +7,15 @@ integer function log10_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function log10_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function log10_r2fp64 diff --git a/test/log_r2fp32.f90 b/test/log_r2fp32.f90 index 7a56f70..61c87b7 100644 --- a/test/log_r2fp32.f90 +++ b/test/log_r2fp32.f90 @@ -7,11 +7,15 @@ integer function log_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function log_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function log_r2fp32 diff --git a/test/log_r2fp64.f90 b/test/log_r2fp64.f90 index 632edc3..3061694 100644 --- a/test/log_r2fp64.f90 +++ b/test/log_r2fp64.f90 @@ -7,11 +7,15 @@ integer function log_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function log_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function log_r2fp64 diff --git a/test/monadic_r2fp32.f90 b/test/monadic_r2fp32.f90 index 65897ac..71a08b5 100644 --- a/test/monadic_r2fp32.f90 +++ b/test/monadic_r2fp32.f90 @@ -9,11 +9,15 @@ integer function monadic_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -42,5 +46,6 @@ integer function monadic_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function monadic_r2fp32 diff --git a/test/monadic_r2fp64.f90 b/test/monadic_r2fp64.f90 index e415b6e..3fd067c 100644 --- a/test/monadic_r2fp64.f90 +++ b/test/monadic_r2fp64.f90 @@ -7,11 +7,15 @@ integer function monadic_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function monadic_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function monadic_r2fp64 diff --git a/test/random_r2fp32.f90 b/test/random_r2fp32.f90 index b5612e6..c9046e8 100644 --- a/test/random_r2fp32.f90 +++ b/test/random_r2fp32.f90 @@ -7,10 +7,13 @@ integer function random_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -38,5 +41,6 @@ integer function random_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval) end function random_r2fp32 diff --git a/test/random_r2fp64.f90 b/test/random_r2fp64.f90 index 4336838..6056289 100644 --- a/test/random_r2fp64.f90 +++ b/test/random_r2fp64.f90 @@ -7,10 +7,13 @@ integer function random_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -38,5 +41,6 @@ integer function random_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval) end function random_r2fp64 diff --git a/test/sech_r2fp32.f90 b/test/sech_r2fp32.f90 index c3a9e0c..dae7f21 100644 --- a/test/sech_r2fp32.f90 +++ b/test/sech_r2fp32.f90 @@ -7,11 +7,15 @@ integer function sech_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function sech_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function sech_r2fp32 diff --git a/test/sech_r2fp64.f90 b/test/sech_r2fp64.f90 index 6760b65..a610087 100644 --- a/test/sech_r2fp64.f90 +++ b/test/sech_r2fp64.f90 @@ -7,11 +7,15 @@ integer function sech_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function sech_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function sech_r2fp64 diff --git a/test/sin_r2fp32.f90 b/test/sin_r2fp32.f90 index ee1c3fb..36036dc 100644 --- a/test/sin_r2fp32.f90 +++ b/test/sin_r2fp32.f90 @@ -8,11 +8,15 @@ integer function sin_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function sin_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function sin_r2fp32 diff --git a/test/sin_r2fp64.f90 b/test/sin_r2fp64.f90 index adc2c81..6a3fce9 100644 --- a/test/sin_r2fp64.f90 +++ b/test/sin_r2fp64.f90 @@ -8,11 +8,15 @@ integer function sin_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function sin_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function sin_r2fp64 diff --git a/test/sqrt_r2fp32.f90 b/test/sqrt_r2fp32.f90 index fb95ca9..8f33d63 100644 --- a/test/sqrt_r2fp32.f90 +++ b/test/sqrt_r2fp32.f90 @@ -7,11 +7,15 @@ integer function sqrt_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function sqrt_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function sqrt_r2fp32 diff --git a/test/sqrt_r2fp64.f90 b/test/sqrt_r2fp64.f90 index 0f02ab6..e5efb3a 100644 --- a/test/sqrt_r2fp64.f90 +++ b/test/sqrt_r2fp64.f90 @@ -7,11 +7,15 @@ integer function sqrt_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function sqrt_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function sqrt_r2fp64 diff --git a/test/tan_r2fp32.f90 b/test/tan_r2fp32.f90 index fb0730c..36feb13 100644 --- a/test/tan_r2fp32.f90 +++ b/test/tan_r2fp32.f90 @@ -8,11 +8,15 @@ integer function tan_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=60) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function tan_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function tan_r2fp32 diff --git a/test/tan_r2fp64.f90 b/test/tan_r2fp64.f90 index 4bcfe5e..0adbe06 100644 --- a/test/tan_r2fp64.f90 +++ b/test/tan_r2fp64.f90 @@ -8,11 +8,15 @@ integer function tan_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=60) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -41,5 +45,6 @@ integer function tan_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function tan_r2fp64 diff --git a/test/tanh_r2fp32.f90 b/test/tanh_r2fp32.f90 index 88ea782..585440e 100644 --- a/test/tanh_r2fp32.f90 +++ b/test/tanh_r2fp32.f90 @@ -7,11 +7,15 @@ integer function tanh_r2fp32() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real32) :: x(1:N,1:N,1:3) - real(real32) :: feval(1:N,1:N) - real(real32) :: fexact(1:N,1:N) + real(real32),allocatable :: x(:,:,:) + real(real32),allocatable :: feval(:,:) + real(real32),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function tanh_r2fp32() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function tanh_r2fp32 diff --git a/test/tanh_r2fp64.f90 b/test/tanh_r2fp64.f90 index c8e1732..0435e47 100644 --- a/test/tanh_r2fp64.f90 +++ b/test/tanh_r2fp64.f90 @@ -7,11 +7,15 @@ integer function tanh_r2fp64() result(r) type(EquationParser) :: f character(LEN=1),dimension(1:3) :: independentVars character(LEN=1024) :: eqChar - real(real64) :: x(1:N,1:N,1:3) - real(real64) :: feval(1:N,1:N) - real(real64) :: fexact(1:N,1:N) + real(real64),allocatable :: x(:,:,:) + real(real64),allocatable :: feval(:,:) + real(real64),allocatable :: fexact(:,:) integer :: i,j + allocate (x(1:N,1:N,1:3), & + feval(1:N,1:N), & + fexact(1:N,1:N)) + ! Specify the independent variables independentVars = (/'x','y','z'/) @@ -40,5 +44,6 @@ integer function tanh_r2fp64() result(r) ! Clean up memory call f % Destruct() + deallocate (x,feval,fexact) end function tanh_r2fp64 diff --git a/test/test.f90 b/test/test.f90 index 803d46c..1323cb6 100644 --- a/test/test.f90 +++ b/test/test.f90 @@ -2,7 +2,7 @@ program test !! a main program to include the test case, so it !! can be compiled with FPM. - + use FEQParse implicit none write(*,*) "abs_r1fp32()", abs_r1fp32() From 0425af27f753e3ca43aefd51c4b082f120e331c4 Mon Sep 17 00:00:00 2001 From: Joe Date: Mon, 4 Dec 2023 14:08:03 -0500 Subject: [PATCH 18/25] Force dependency of fortran test objs on feqparse-static I suspect that the issue with the windows CMake build is that some versions of CMake will think its safe to build the ${TARGET}_fortran library before building all of feqparse-static, since there is no explicit dependency of these targets on the feqparse-static library. This, I think could cause the ${TARGET}_fortran target to start building before all of the necessary .mod files have been created --- test/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1438684..c9423a6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,12 +35,15 @@ function (add_fortran_test_executable TARGET) create_test_sourcelist (_ main.c ${TEST_FILES_MANGLED}) add_library (${TARGET}_fortran ${TEST_FILES}) - target_include_directories(${TARGET}_fortran PUBLIC ${CMAKE_BINARY_DIR}/include) + add_dependencies(${TARGET}_fortran feqparse-static) add_executable (${TARGET} main.c) + target_link_libraries (${TARGET} ${TARGET}_fortran) - target_include_directories (${TARGET} PUBLIC ${TARGET}_fortran) target_link_libraries (${TARGET} ${TARGET}_fortran feqparse-static) - target_include_directories(${TARGET} PUBLIC ${CMAKE_BINARY_DIR}/include) + + target_include_directories(${TARGET}_fortran PUBLIC ${CMAKE_Fortran_MODULE_DIRECTORY}/) + target_include_directories (${TARGET} PUBLIC ${TARGET}_fortran) + target_include_directories(${TARGET} PUBLIC ${CMAKE_Fortran_MODULE_DIRECTORY}/) set (INDEX 0) list (LENGTH TEST_FILES LEN) From 365ae6c71d6adade82cd80e29ebd3aa3b342e4c8 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 12:01:42 -0500 Subject: [PATCH 19/25] Fix segmentation fault for ifort and ifx compilers --- CMakeLists.txt | 2 +- src/FEQParse.F90 | 230 ++++++++++++++++++++--------------- src/FEQParse_FloatStacks.F90 | 2 +- 3 files changed, 136 insertions(+), 98 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 359730e..27368f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ if( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" ) elseif( "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "Intel" ) set( CMAKE_Fortran_FLAGS "-fpp" ) - set( CMAKE_Fortran_FLAGS_DEBUG "-debug all" ) + set( CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -debug all -check all -traceback" ) set( CMAKE_Fortran_FLAGS_COVERAGE "${CMAKE_Fortran_FLAGS_DEBUG} -prof-gen=srcpos") set( CMAKE_Fortran_FLAGS_PROFILE "-O3") set( CMAKE_Fortran_FLAGS_RELEASE "-O3" ) diff --git a/src/FEQParse.F90 b/src/FEQParse.F90 index e710114..f5773fc 100644 --- a/src/FEQParse.F90 +++ b/src/FEQParse.F90 @@ -270,7 +270,7 @@ subroutine Tokenize(parser,tokenized,errorMsg) i = i + 1 - elseif (IsFunction(parser % inFixFormula(i:i))) then + elseif (parser % infixFormula(i:i) == "\") then parser % inFix % top_index = parser % inFix % top_index + 1 parser % inFix % tokens(parser % inFix % top_index) % tokenString = '' @@ -324,7 +324,7 @@ subroutine ConvertToPostFix(parser) character(Error_Message_Length) :: errorMsg type(TokenStack) :: operator_stack type(Token) :: tok - integer :: i + integer :: i !success = .FALSE. @@ -332,7 +332,7 @@ subroutine ConvertToPostFix(parser) call operator_stack % Construct(Stack_Length) do i = 1,parser % infix % top_index - + !print*, parser % inFix % tokens(i) % tokenString if (parser % inFix % tokens(i) % tokenType == Variable_Token .or. & parser % inFix % tokens(i) % tokenType == Number_Token) then @@ -348,10 +348,12 @@ subroutine ConvertToPostFix(parser) if (.not. operator_stack % IsEmpty()) then tok = operator_stack % TopToken() + ! print*, "tok : "//tok % tokenString + ! print*, "token(i) : "//parser % inFix % tokens(i) % tokenString do while (trim(tok % tokenString) /= "(" .and. & - parser % Priority(trim(tok % tokenString)) > & - parser % Priority(trim(parser % inFix % tokens(i) % tokenString))) + parser % Priority(tok % tokenString) > & + parser % Priority(parser % inFix % tokens(i) % tokenString)) call parser % postFix % push(tok) call operator_stack % pop(tok) @@ -607,11 +609,16 @@ function Evaluate_r1fp32(parser,x) result(f) type(Token) :: t type(r1fp32Stack) :: stack real(real32) :: vnumber - real(real32) :: v(lbound(x,1):ubound(x,1)) - real(real32) :: a(lbound(x,1):ubound(x,1)) - real(real32) :: b(lbound(x,1):ubound(x,1)) - real(real32) :: c(lbound(x,1):ubound(x,1)) - + real(real32), allocatable :: v(:) + real(real32), allocatable :: a(:) + real(real32), allocatable :: b(:) + real(real32), allocatable :: c(:) + + allocate( v(lbound(x,1):ubound(x,1)), & + a(lbound(x,1):ubound(x,1)), & + b(lbound(x,1):ubound(x,1)), & + c(lbound(x,1):ubound(x,1)) ) + call stack % Construct(Stack_Length,v) do k = 1,parser % postfix % top_index @@ -699,6 +706,7 @@ function Evaluate_r1fp32(parser,x) result(f) f = a call stack % Destruct() + deallocate( v, a, b, c ) end function Evaluate_r1fp32 @@ -711,10 +719,15 @@ function Evaluate_r1fp64(parser,x) result(f) type(Token) :: t type(r1fp64Stack) :: stack real(real64) :: vnumber - real(real64) :: v(lbound(x,1):ubound(x,1)) - real(real64) :: a(lbound(x,1):ubound(x,1)) - real(real64) :: b(lbound(x,1):ubound(x,1)) - real(real64) :: c(lbound(x,1):ubound(x,1)) + real(real64), allocatable :: v(:) + real(real64), allocatable :: a(:) + real(real64), allocatable :: b(:) + real(real64), allocatable :: c(:) + + allocate( v(lbound(x,1):ubound(x,1)), & + a(lbound(x,1):ubound(x,1)), & + b(lbound(x,1):ubound(x,1)), & + c(lbound(x,1):ubound(x,1)) ) call stack % Construct(Stack_Length,v) @@ -804,6 +817,7 @@ function Evaluate_r1fp64(parser,x) result(f) f = a call stack % Destruct() + deallocate( v, a, b, c ) end function Evaluate_r1fp64 @@ -817,14 +831,20 @@ function Evaluate_r2fp32(parser,x) result(f) type(Token) :: t type(r2fp32Stack) :: stack real(real32) :: vnumber - real(real32) :: v(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) - real(real32) :: a(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) - real(real32) :: b(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) - real(real32) :: c(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) + real(real32), allocatable :: v(:,:) + real(real32), allocatable :: a(:,:) + real(real32), allocatable :: b(:,:) + real(real32), allocatable :: c(:,:) + integer :: l1, l2, u1, u2 + + l1 = lbound(x,1) + l2 = lbound(x,2) + u1 = ubound(x,1) + u2 = ubound(x,2) + allocate( v(l1:u1,l2:u2),& + a(l1:u1,l2:u2),& + b(l1:u1,l2:u2),& + c(l1:u1,l2:u2) ) call stack % Construct(Stack_Length,v) @@ -913,6 +933,7 @@ function Evaluate_r2fp32(parser,x) result(f) f = a call stack % Destruct() + deallocate( v, a, b, c ) end function Evaluate_r2fp32 @@ -926,14 +947,20 @@ function Evaluate_r2fp64(parser,x) result(f) type(Token) :: t type(r2fp64Stack) :: stack real(real64) :: vnumber - real(real64) :: v(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) - real(real64) :: a(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) - real(real64) :: b(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) - real(real64) :: c(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2)) + real(real64), allocatable :: v(:,:) + real(real64), allocatable :: a(:,:) + real(real64), allocatable :: b(:,:) + real(real64), allocatable :: c(:,:) + integer :: l1, l2, u1, u2 + + l1 = lbound(x,1) + l2 = lbound(x,2) + u1 = ubound(x,1) + u2 = ubound(x,2) + allocate( v(l1:u1,l2:u2),& + a(l1:u1,l2:u2),& + b(l1:u1,l2:u2),& + c(l1:u1,l2:u2) ) call stack % Construct(Stack_Length,v) @@ -1023,6 +1050,7 @@ function Evaluate_r2fp64(parser,x) result(f) f = a call stack % Destruct() + deallocate(v,a,b,c) end function Evaluate_r2fp64 @@ -1037,18 +1065,22 @@ function Evaluate_r3fp32(parser,x) result(f) type(Token) :: t type(r3fp32Stack) :: stack real(real32) :: vnumber - real(real32) :: v(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) - real(real32) :: a(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) - real(real32) :: b(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) - real(real32) :: c(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) + real(real32), allocatable :: v(:,:,:) + real(real32), allocatable :: a(:,:,:) + real(real32), allocatable :: b(:,:,:) + real(real32), allocatable :: c(:,:,:) + integer :: l1, l2, l3, u1, u2, u3 + + l1 = lbound(x,1) + l2 = lbound(x,2) + l3 = lbound(x,3) + u1 = ubound(x,1) + u2 = ubound(x,2) + u3 = ubound(x,3) + allocate( v(l1:u1,l2:u2,l3:u3),& + a(l1:u1,l2:u2,l3:u3),& + b(l1:u1,l2:u2,l3:u3),& + c(l1:u1,l2:u2,l3:u3) ) call stack % Construct(Stack_Length,v) @@ -1137,6 +1169,7 @@ function Evaluate_r3fp32(parser,x) result(f) f = a call stack % Destruct() + deallocate( v, a, b, c ) end function Evaluate_r3fp32 @@ -1151,18 +1184,22 @@ function Evaluate_r3fp64(parser,x) result(f) type(Token) :: t type(r3fp64Stack) :: stack real(real64) :: vnumber - real(real64) :: v(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) - real(real64) :: a(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) - real(real64) :: b(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) - real(real64) :: c(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3)) + real(real64), allocatable :: v(:,:,:) + real(real64), allocatable :: a(:,:,:) + real(real64), allocatable :: b(:,:,:) + real(real64), allocatable :: c(:,:,:) + integer :: l1, l2, l3, u1, u2, u3 + + l1 = lbound(x,1) + l2 = lbound(x,2) + l3 = lbound(x,3) + u1 = ubound(x,1) + u2 = ubound(x,2) + u3 = ubound(x,3) + allocate( v(l1:u1,l2:u2,l3:u3),& + a(l1:u1,l2:u2,l3:u3),& + b(l1:u1,l2:u2,l3:u3),& + c(l1:u1,l2:u2,l3:u3) ) call stack % Construct(Stack_Length,v) @@ -1253,6 +1290,8 @@ function Evaluate_r3fp64(parser,x) result(f) call stack % Destruct() + deallocate( v, a, b, c ) + end function Evaluate_r3fp64 function Evaluate_r4fp32(parser,x) result(f) @@ -1267,22 +1306,24 @@ function Evaluate_r4fp32(parser,x) result(f) type(Token) :: t type(r4fp32Stack) :: stack real(real32) :: vnumber - real(real32) :: v(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) - real(real32) :: a(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) - real(real32) :: b(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) - real(real32) :: c(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) + real(real32), allocatable :: v(:,:,:,:) + real(real32), allocatable :: a(:,:,:,:) + real(real32), allocatable :: b(:,:,:,:) + real(real32), allocatable :: c(:,:,:,:) + integer :: l1, l2, l3, l4, u1, u2, u3, u4 + + l1 = lbound(x,1) + l2 = lbound(x,2) + l3 = lbound(x,3) + l4 = lbound(x,3) + u1 = ubound(x,1) + u2 = ubound(x,2) + u3 = ubound(x,3) + u4 = ubound(x,4) + allocate( v(l1:u1,l2:u2,l3:u3,l4:u4),& + a(l1:u1,l2:u2,l3:u3,l4:u4),& + b(l1:u1,l2:u2,l3:u3,l4:u4),& + c(l1:u1,l2:u2,l3:u3,l4:u4) ) call stack % Construct(Stack_Length,v) @@ -1372,6 +1413,8 @@ function Evaluate_r4fp32(parser,x) result(f) call stack % Destruct() + deallocate( v, a, b, c ) + end function Evaluate_r4fp32 function Evaluate_r4fp64(parser,x) result(f) @@ -1386,22 +1429,24 @@ function Evaluate_r4fp64(parser,x) result(f) type(Token) :: t type(r4fp64Stack) :: stack real(real64) :: vnumber - real(real64) :: v(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) - real(real64) :: a(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) - real(real64) :: b(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) - real(real64) :: c(lbound(x,1):ubound(x,1),& - lbound(x,2):ubound(x,2),& - lbound(x,3):ubound(x,3),& - lbound(x,4):ubound(x,4)) + real(real64), allocatable :: v(:,:,:,:) + real(real64), allocatable :: a(:,:,:,:) + real(real64), allocatable :: b(:,:,:,:) + real(real64), allocatable :: c(:,:,:,:) + integer :: l1, l2, l3, l4, u1, u2, u3, u4 + + l1 = lbound(x,1) + l2 = lbound(x,2) + l3 = lbound(x,3) + l4 = lbound(x,3) + u1 = ubound(x,1) + u2 = ubound(x,2) + u3 = ubound(x,3) + u4 = ubound(x,4) + allocate( v(l1:u1,l2:u2,l3:u3,l4:u4),& + a(l1:u1,l2:u2,l3:u3,l4:u4),& + b(l1:u1,l2:u2,l3:u3,l4:u4),& + c(l1:u1,l2:u2,l3:u3,l4:u4) ) call stack % Construct(Stack_Length,v) @@ -1492,6 +1537,8 @@ function Evaluate_r4fp64(parser,x) result(f) call stack % Destruct() + deallocate( v, a, b, c ) + end function Evaluate_r4fp64 subroutine Print_InfixTokens(parser) @@ -1594,7 +1641,7 @@ integer function Priority(parser,operatorString) class(EquationParser) :: parser character(*) :: operatorString - if (IsFunction(operatorString)) then + if (operatorString(1:1) == "\") then Priority = 4 @@ -1617,15 +1664,6 @@ integer function Priority(parser,operatorString) end if end function Priority - logical function IsFunction(eqChar) - character(*) :: eqChar - - IsFunction = .false. - if (eqChar(1:1) == "\") then - IsFunction = .true. - end if - -end function IsFunction function FindLastFunctionIndex(eqChar) result(j) character(*) :: eqChar diff --git a/src/FEQParse_FloatStacks.F90 b/src/FEQParse_FloatStacks.F90 index 7635a01..a3d402e 100644 --- a/src/FEQParse_FloatStacks.F90 +++ b/src/FEQParse_FloatStacks.F90 @@ -35,7 +35,7 @@ module FEQParse_FloatStacks end type sfp32Stack type,extends(feqparse_floatstack) :: sfp64Stack - real(real32),allocatable :: tokens(:) + real(real64),allocatable :: tokens(:) contains From 87392a5c45799768578f4bff088f57bdd74d099f Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 13:49:03 -0500 Subject: [PATCH 20/25] Add ifort to ci tests * ifort, even though deprecated, should still be on our list of tested compilers for the time being --- .github/workflows/ci.yml | 20 +++++++++++++++++--- src/FEQParse.F90 | 26 ++++++++++++++------------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c58cc73..65f4675 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: test: timeout-minutes: 5 if: "!contains(github.event.head_commit.message, 'skip ci')" - name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }} - ${{ github.event_name }} + name: ${{ matrix.os_name }} - ${{ matrix.fcompiler }} - ${{ matrix.build_type }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -72,6 +72,13 @@ jobs: shell: bash build_type: debug + - os: ubuntu-22.04 + os_name: linux + fcompiler: ifort + ccompiler: icx-cc + shell: bash + build_type: debug + - os: ubuntu-22.04 os_name: linux fcompiler: gfortran-9 @@ -106,6 +113,13 @@ jobs: ccompiler: icx-cc shell: bash build_type: fpm + + - os: ubuntu-22.04 + os_name: linux + fcompiler: ifort + ccompiler: icx-cc + shell: bash + build_type: fpm # Windows @@ -137,7 +151,7 @@ jobs: path: /opt/intel/oneapi key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }} - name: Install Intel oneAPI Fortran compiler - if: matrix.fcompiler == 'ifx' && steps.cache.outputs.cache-hit != 'true' + if: ${{ (matrix.fcompiler == 'ifx' || matrix.fcompiler == 'ifort') && steps.cache.outputs.cache-hit != 'true' }} run: | # download the key to system keyring wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ @@ -155,7 +169,7 @@ jobs: env | grep oneapi >> $GITHUB_ENV - name: Use existing Intel oneAPI Fortran compiler - if: matrix.fcompiler == 'ifx' && steps.cache.outputs.cache-hit == 'true' + if: ${{ (matrix.fcompiler == 'ifx' || matrix.fcompiler == 'ifort') && steps.cache.outputs.cache-hit != 'true' }} run: | # set environment variables and make them persistent across steps . /opt/intel/oneapi/setvars.sh diff --git a/src/FEQParse.F90 b/src/FEQParse.F90 index f5773fc..211bb4b 100644 --- a/src/FEQParse.F90 +++ b/src/FEQParse.F90 @@ -90,8 +90,8 @@ module FEQParse function Construct_EquationParser(equation,indepVars) result(parser) type(EquationParser) :: parser - character(*) :: equation - character(1) :: indepVars(1:) + character(*) :: equation + character(1) :: indepVars(1:) ! Local integer :: i character(Error_Message_Length) :: errorMsg @@ -109,6 +109,7 @@ function Construct_EquationParser(equation,indepVars) result(parser) parser % inFixFormula = " " parser % equation = equation + parser % variableName = '#noname' errorMsg = " " call parser % CleanEquation(equationIsClean,errorMsg) @@ -147,14 +148,14 @@ subroutine Destruct_EquationParser(parser) end subroutine Destruct_EquationParser subroutine CleanEquation(parser,equationCleaned,errorMsg) - class(EquationParser),intent(inout) :: parser + class(EquationParser),intent(inout) :: parser logical,intent(out) :: equationCleaned character(Error_Message_Length),intent(out) :: errorMsg ! Local integer :: nChar,equalSignLoc,j,i + character(Max_Equation_Length) :: infixformula equationCleaned = .false. - parser % variableName = '#noname' nChar = len_trim(parser % equation) equalSignLoc = index(parser % equation,"=") @@ -164,23 +165,24 @@ subroutine CleanEquation(parser,equationCleaned,errorMsg) return end if - parser % variableName = trim(parser % equation(1:equalSignLoc - 1)) + parser % variableName = parser % equation(1:equalSignLoc - 1) + ! print*, "variable : "//parser % variableName ! Grab the formula to the right of the equal sign and left adjust the formula - parser % inFixFormula = parser % equation(equalSignLoc + 1:) - parser % inFixFormula = adjustl(parser % inFixFormula) - + inFixFormula = parser % equation(equalSignLoc + 1:Max_Equation_Length) + ! print*, "infix : "//inFixFormula + ! print*, "len_trim(infix) : ", len_trim(inFixFormula) ! Remove any spaces j = 1 - do i = 1,len_trim(parser % inFixFormula) - if (parser % inFixFormula(i:i) /= " ") then - parser % inFixFormula(j:j) = parser % inFixFormula(i:i) + do i = 1,len_trim(inFixFormula) + if (inFixFormula(i:i) /= " ") then + parser % inFixFormula(j:j) = inFixFormula(i:i) j = j + 1 end if end do parser % inFixFormula(j:Max_Equation_Length) = " " - + ! print*, "parser % infixformula : ", parser % infixformula equationCleaned = .true. end subroutine CleanEquation From 37a7def35413db1f20065d9855075f81aacdb79a Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 14:00:43 -0500 Subject: [PATCH 21/25] Fix conditional for intel compilers --- .github/workflows/ci.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65f4675..71510ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,9 +136,7 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - # - name: Add msbuild to PATH - # if: ${{ matrix.os_name == 'windows-latest' }} - # uses: microsoft/setup-msbuild@v1.0.2 + - uses: msys2/setup-msys2@v2 if: ${{ matrix.os == 'windows-latest' }} with: @@ -150,8 +148,9 @@ jobs: with: path: /opt/intel/oneapi key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }} + - name: Install Intel oneAPI Fortran compiler - if: ${{ (matrix.fcompiler == 'ifx' || matrix.fcompiler == 'ifort') && steps.cache.outputs.cache-hit != 'true' }} + if: ${{ startsWith(matrix.fcompiler,'if') && steps.cache.outputs.cache-hit != 'true' }} run: | # download the key to system keyring wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ @@ -169,7 +168,7 @@ jobs: env | grep oneapi >> $GITHUB_ENV - name: Use existing Intel oneAPI Fortran compiler - if: ${{ (matrix.fcompiler == 'ifx' || matrix.fcompiler == 'ifort') && steps.cache.outputs.cache-hit != 'true' }} + if: ${{ startsWith(matrix.fcompiler,'if') && steps.cache.outputs.cache-hit != 'true' }} run: | # set environment variables and make them persistent across steps . /opt/intel/oneapi/setvars.sh From 02ff0de0bf4b584024d17daea6dd74dc8dcebbd5 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 14:05:57 -0500 Subject: [PATCH 22/25] Remove caching This is causing build issues between ifort and ifx compilers.. --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71510ea..006a6f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,14 +143,14 @@ jobs: update: true install: git base-devel mingw-w64-x86_64-toolchain cmake - - uses: actions/cache@v3 - id: cache - with: - path: /opt/intel/oneapi - key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }} + # - uses: actions/cache@v3 + # id: cache + # with: + # path: /opt/intel/oneapi + # key: ${{ matrix.os }}-${{ matrix.fcompiler }}-${{ env.INTEL_ONEAPI_VERSION }} - name: Install Intel oneAPI Fortran compiler - if: ${{ startsWith(matrix.fcompiler,'if') && steps.cache.outputs.cache-hit != 'true' }} + if: ${{ startsWith(matrix.fcompiler,'if') }} run: | # download the key to system keyring wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ @@ -168,7 +168,7 @@ jobs: env | grep oneapi >> $GITHUB_ENV - name: Use existing Intel oneAPI Fortran compiler - if: ${{ startsWith(matrix.fcompiler,'if') && steps.cache.outputs.cache-hit != 'true' }} + if: ${{ startsWith(matrix.fcompiler,'if') }} run: | # set environment variables and make them persistent across steps . /opt/intel/oneapi/setvars.sh From c6f45cd5831cae839c8c591fbd417a1b7cf7b93e Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 14:09:15 -0500 Subject: [PATCH 23/25] clean out print/check statements in CleanEquation --- src/FEQParse.F90 | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/FEQParse.F90 b/src/FEQParse.F90 index 211bb4b..3915e1f 100644 --- a/src/FEQParse.F90 +++ b/src/FEQParse.F90 @@ -166,12 +166,9 @@ subroutine CleanEquation(parser,equationCleaned,errorMsg) end if parser % variableName = parser % equation(1:equalSignLoc - 1) - ! print*, "variable : "//parser % variableName ! Grab the formula to the right of the equal sign and left adjust the formula inFixFormula = parser % equation(equalSignLoc + 1:Max_Equation_Length) - ! print*, "infix : "//inFixFormula - ! print*, "len_trim(infix) : ", len_trim(inFixFormula) ! Remove any spaces j = 1 do i = 1,len_trim(inFixFormula) @@ -182,7 +179,6 @@ subroutine CleanEquation(parser,equationCleaned,errorMsg) end do parser % inFixFormula(j:Max_Equation_Length) = " " - ! print*, "parser % infixformula : ", parser % infixformula equationCleaned = .true. end subroutine CleanEquation From 2893caff263d8c56430a2a9d14ec0145e65b4524 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 14:16:14 -0500 Subject: [PATCH 24/25] Remove fpm with ifx compiler Currently ifx compiler builds and tests out fine with cmake/ctest --- .github/workflows/ci.yml | 12 ++++++------ src/FEQParse.F90 | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 006a6f0..d534ea5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,12 +107,12 @@ jobs: shell: bash build_type: fpm - - os: ubuntu-22.04 - os_name: linux - fcompiler: ifx - ccompiler: icx-cc - shell: bash - build_type: fpm + # - os: ubuntu-22.04 + # os_name: linux + # fcompiler: ifx + # ccompiler: icx-cc + # shell: bash + # build_type: fpm - os: ubuntu-22.04 os_name: linux diff --git a/src/FEQParse.F90 b/src/FEQParse.F90 index 3915e1f..7a7d730 100644 --- a/src/FEQParse.F90 +++ b/src/FEQParse.F90 @@ -371,7 +371,7 @@ subroutine ConvertToPostFix(parser) tok = operator_stack % TopToken() - do while (.not. (operator_stack % IsEmpty()) .and. trim(tok % tokenString) /= "(") + do while (.not. (operator_stack % IsEmpty()) .and. tok % tokenString(1:1) /= "(") call parser % postFix % push(tok) call operator_stack % pop(tok) From b5a29377eef5190fc02f92d0babf9c2ed6f622d0 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 6 Dec 2023 14:38:06 -0500 Subject: [PATCH 25/25] Update README to include info on spack install --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7fc1ba2..ab2d23f 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,20 @@ Copyright 2020 Fluid Numerics LLC [![Build Status](https://github.com/fluidnumerics/feq-parse/actions/workflows/ci.yml/badge.svg)](https://github.com/FluidNumerics/feq-parse/actions) [![codecov](https://codecov.io/gh/FluidNumerics/feq-parse/graph/badge.svg?token=IBNDDI4MHB)](https://codecov.io/gh/FluidNumerics/feq-parse) -`feqparse` is an equation parser Fortran class that is used to interpret and evaluate functions provided as strings. +`feq-parse` is an equation parser Fortran class that is used to interpret and evaluate functions provided as strings. [Learn how to contribute to this repository](./CONTRIBUTING.md) ## Installation +`feq-parse` can be installed using either CMake, [Fortran Package Manager (fpm)](https://github.com/fortran-lang/fpm), or with [Spack](https://spack.io). +### Prerequisites +All you need is a Fortran compiler that is compliant with the Fortran 2008 standard and supports C interoperability. You can see which compilers are regularly tested on the [Github actions page](https://github.com/FluidNumerics/feq-parse/actions/workflows/ci.yml) + +If you are installing with CMake, you will need to have CMake version 3.0.2 or greated + + +### CMake For a quick installation to `/usr/local/feqparse`, ``` cd build/ @@ -61,13 +69,50 @@ Or, to use a specific version: feq-parse = { git="https://github.com/FluidNumerics/feq-parse.git", tag = "v1.1.0" } ``` +### Spack +The maintainers of this repository also keep the `feq-parse` spack package up to date with the latest releases. This means you can easily install `feq-parse` from source with the [spack package manager](https://spack.io). + +To get started with Spack, if you haven't already +``` +git clone https://github.com/spack/spack ~/spack +source ~/spack/share/spack/setup-env.sh +spack compiler find +``` + +To install the latest version of `feq-parse` with spack, +``` +spack install feq-parse +``` + +To install a specific version of feq-parse with spack, e.g. +``` +spack install feq-parse@1.1.0 +``` + +Refer to the [spack documentation](https://spack.readthedocs.io/en/latest/) for further guidance on using Spack. + ## Usage -!!! note - All functions in the equation string must start with a `\` +> [!NOTE] +> All functions in the equation string must start with a `\` + +### Run examples with fpm +> [!NOTE] +> Examples are now included in the `example/` subdirectory -### Demo Program +Included examples +* `scalar_with_scalar_eval.f90` - Creates an equation parser, and evaluates an equation with scalar input and scalar output. +* `array_with_array_eval.f90` - Creates an equation parser, and evaluates an equation with rank 1 array input and rank 1 output. +* `array_with_scalar_eval.f90` - Creates an equation parser, and evaluates an equation with scalar array input and scalar output within a do loop to fill an array of values. This example is to demonstrate the performance difference with using the array evaluation. +* `gaussian_scalar_multivar.f90` - Creates an equation parser, and evaluates an equation with scalar input and scalar output but with multiple independent variables (much like the example shown below). +* `scalar_function_product.f90` - Creates an equation parser, and evaluates an equation with scalar array input and scalar output, and demonstrates multiplication of two functions. + +To run the included examples with the fortran package manager, +``` +fpm run --example "*" +``` +### Simple example with Makefile *Example Makefile* ``` FC = gfortran