Skip to content

Commit

Permalink
Merge pull request #28 from jschueller/cport
Browse files Browse the repository at this point in the history
C interface. Thank @jschueller !
  • Loading branch information
zaikunzhang authored Sep 11, 2023
2 parents fb46fa1 + feddc18 commit 0a4c979
Show file tree
Hide file tree
Showing 104 changed files with 1,644 additions and 5,310 deletions.
23 changes: 23 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2037,3 +2037,26 @@ nlcon
charityware
AFINC
AFLIB
cmake
endmacro
evals
primac
primaf
cintrf
COBJ
COBJCON
cobjfun
cobjfuncon
constrc
evalcobj
evalcobjcon
execstack
FUNPTR
PROCPOINTER
cfun
cobj
NVHPC
objcon
cobjcon
FEVL
Qdiag
93 changes: 93 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CMake build

on:
push:
pull_request:
schedule:
# 0h mondays
- cron: '0 0 * * 1'

permissions:
contents: read

jobs:
cmake-main:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
toolchain:
- {compiler: gcc, version: 11, cflags: '-Wall -Wextra -Werror', fflags: '-Wall -Wextra -Wpedantic -Werror -pedantic -fimplicit-none -frecursive -fcheck=all -fstack-check -Wno-function-elimination'}
- {compiler: intel-classic, version: '2021.9', cflags: '-diag-disable=10441', fflags: '-warn all -debug extended -fimplicit-none -standard-semantics -assume recursion'}
include:
- os: ubuntu-latest
toolchain: {compiler: intel, version: '2023.1', cflags: '', fflags: '-warn all -debug extended -fimplicit-none -standard-semantics -assume recursion'}
- os: windows-latest
toolchain: {compiler: intel, version: '2023.1', cflags: '', fflags: '/warn:all /debug:extended /fimplicit-none /standard-semantics /assume:recursion'}
- os: windows-latest
toolchain: {compiler: intel-classic, version: '2021.9', cflags: '/Qdiag-disable:10441', fflags: '/warn:all /debug:extended /fimplicit-none /standard-semantics /assume:recursion'}
steps:
- uses: actions/checkout@v3
- name: Install Ninja / Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install ninja-build
- name: Install Ninja / MacOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install ninja
- uses: awvwgk/setup-fortran@main
id: setup-fortran
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- name: Build
run: |
cmake --version
cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. -LAH -DCMAKE_C_FLAGS="${{ matrix.toolchain.cflags }}" -DCMAKE_Fortran_FLAGS="${{ matrix.toolchain.fflags }}" .
cmake --build . --target install --parallel 4
cmake --build . --target examples --parallel 4
ctest --output-on-failure -V -j4 -R examples
env:
FC: ${{ steps.setup-fortran.outputs.fc }}
- name: Test
if: ${{ github.event_name == 'schedule' }}
run: |
cmake --build . --target tests --parallel 4
ctest --output-on-failure -V -j4 -R large
cmake-other:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain:
- {compiler: aflang, cflags: '-Wall', fflags: '-pedantic -Weverything -Wall -Wextra -Minform=warn -Mstandard -Mrecursive'}
- {compiler: nvfortran, cflags: '-Wall', fflags: '-C -Wall -Wextra -Minform=warn -Mstandard -Mrecursive -Mbounds -Mchkstk -Mchkptr'}
- {compiler: flang, cflags: '-Wall', fflags: '-pedantic -Weverything -Wall -Wextra'}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install AOCC
if: ${{ matrix.toolchain.compiler == 'aflang' }}
run: bash .github/scripts/install_aocc
- name: Install nvfortran
if: ${{ matrix.toolchain.compiler == 'nvfortran' }}
run: bash .github/scripts/install_nvfortran
- name: Install Flang
if: ${{ matrix.toolchain.compiler == 'flang' }}
run: bash .github/scripts/install_flang
- name: Build
run: |
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. -LAH -DCMAKE_C_FLAGS="${{ matrix.toolchain.cflags }}" -DCMAKE_Fortran_FLAGS="${{ matrix.toolchain.fflags }}" -DBUILD_SHARED_LIBS=ON .
cmake --build . --target install --parallel 4
cmake --build . --target examples --parallel 4
# cobyla test does not pass on AOCC: https://github.com/libprima/prima/issues/41
ctest --output-on-failure -V -j4 -R examples -E cobyla
env:
FC: ${{ matrix.toolchain.compiler }}
- name: Test
if: ${{ github.event_name == 'schedule' }}
run: |
cmake --build . --target tests --parallel 4
ctest --output-on-failure -V -j4 -R large -E cobyla
43 changes: 43 additions & 0 deletions .github/workflows/cmake_nagfor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CMake build / nagfor

on:
# Trigger the workflow on push or pull request
#push:
pull_request: # DANGEROUS! MUST be disabled for self-hosted runners!
# Trigger the workflow by cron. The default time zone of GitHub Actions is UTC.
schedule:
- cron: '0 19 * * *'
# Trigger the workflow manually
workflow_dispatch:

jobs:

test:
name: CMake build with nagfor
runs-on: [self-hosted, nagfor]
continue-on-error: true

steps:
- name: Checkout repository
uses: actions/[email protected]
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_ACT }} # This forces checkout to use SSH, not HTTPS
submodules: recursive

- name: Miscellaneous setup
run: bash .github/scripts/misc_setup

- name: Conduct the test
run: |
export PATH=$PATH:"~/local/bin"
source ~/local/bin/nag_licensing || echo "\n\nNAG licensing failed.\n\n"
# Use $(( )) rather than $(expr ). See https://unix.stackexchange.com/questions/63166/bash-e-exits-when-let-or-expr-evaluates-to-0
FFLAGS=-O$(($(date +%-d) % 5))
FFLAGS=${FFLAGS/O0/g}
FFLAGS=${FFLAGS/O4/fast}
export FFLAGS
export FC=nagfor
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=. -LAH -DCMAKE_C_FLAGS="" -DCMAKE_Fortran_FLAGS="${FFLAGS}" .
cmake --build . --target install --parallel 4
cmake --build . --target examples --parallel 4
ctest --output-on-failure -V
135 changes: 0 additions & 135 deletions .github/workflows/lint_hosted.yml

This file was deleted.

81 changes: 0 additions & 81 deletions .github/workflows/lint_nagfor.yml

This file was deleted.

Loading

0 comments on commit 0a4c979

Please sign in to comment.