diff --git a/.github/windows_arm64_steps/action.yml b/.github/windows_arm64_steps/action.yml new file mode 100644 index 0000000..65f6530 --- /dev/null +++ b/.github/windows_arm64_steps/action.yml @@ -0,0 +1,28 @@ +name: Build Dependencies(Win-ARM64) +description: "Common setup steps for Win-ARM64 CI" +runs: + using: "composite" + steps: + - name: Install LLVM + shell: pwsh + run: | + Invoke-WebRequest https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/LLVM-20.1.8-woa64.exe -UseBasicParsing -OutFile LLVM-woa64.exe + $expectedHash = "7c4ac97eb2ae6b960ca5f9caf3ff6124c8d2a18cc07a7840a4d2ea15537bad8e" + $fileHash = (Get-FileHash -Path "LLVM-woa64.exe" -Algorithm SHA256).Hash + if ($fileHash -ne $expectedHash) { + Write-Error "Checksum verification failed. The downloaded file may be corrupted or tampered with." + exit 1 + } + Start-Process -FilePath ".\LLVM-woa64.exe" -ArgumentList "/S" -Wait + echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Install pkgconf via vcpkg + shell: pwsh + run: | + & "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" arm64 + $env:VCPKG_ROOT = "C:\vcpkg" + Set-Location $env:VCPKG_ROOT + ./vcpkg install pkgconf:arm64-windows + $pkgconfPath = "$env:VCPKG_ROOT\installed\arm64-windows\tools\pkgconf" + Copy-Item "$pkgconfPath\pkgconf.exe" "$pkgconfPath\pkg-config.exe" -Force + echo "$pkgconfPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append \ No newline at end of file diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4153b60..6510c86 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,46 +1,46 @@ -name: MkDocs +# name: MkDocs -on: - push: - branches: - - main - pull_request: - branches: - - main - - dev +# on: +# push: +# branches: +# - main +# pull_request: +# branches: +# - main +# - dev -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 +# jobs: +# deploy: +# runs-on: ubuntu-latest +# steps: +# - name: Checkout Repository +# uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' +# - name: Set up Python +# uses: actions/setup-python@v2 +# with: +# python-version: '3.x' - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install mkdocs-material - pip install markdown - pip install pymdown-extensions - pip install Pygments - pip install mkdocstrings - pip install 'mkdocstrings[python]' - pip install mkdocs-gen-files - pip install mkdocs-literate-nav - pip install mkdocs-include-markdown-plugin +# - name: Install Dependencies +# run: | +# python -m pip install --upgrade pip +# pip install mkdocs-material +# pip install markdown +# pip install pymdown-extensions +# pip install Pygments +# pip install mkdocstrings +# pip install 'mkdocstrings[python]' +# pip install mkdocs-gen-files +# pip install mkdocs-literate-nav +# pip install mkdocs-include-markdown-plugin - - name: Test Build - run: | - # mkdocs build --strict # can't use strict mode because of some typ annotations - mkdocs build +# - name: Test Build +# run: | +# # mkdocs build --strict # can't use strict mode because of some typ annotations +# mkdocs build - - name: Build and Deploy - if: github.event_name == 'push' - run: | - mkdocs gh-deploy --force +# - name: Build and Deploy +# if: github.event_name == 'push' +# run: | +# mkdocs gh-deploy --force diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 85850f9..e2a2fd1 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -26,14 +26,16 @@ jobs: # - [macos-14, macosx, arm64, accelerate, "14.0"] # working - - [windows-2025, win, AMD64] - - [ubuntu-22.04, manylinux, x86_64] - - [macos-14, macosx, arm64, openblas, "12.3"] - - [macos-15-intel, macosx, x86_64, openblas, "10.14"] + # - [windows-2025, win, AMD64] + # - [ubuntu-22.04, manylinux, x86_64] + # - [macos-14, macosx, arm64, openblas, "12.3"] + - [windows-11-arm, win, ARM64, "", ""] + # removed + # - [macos-15-intel, macosx, x86_64, openblas, "10.14"] - python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"]] - # python: [["cp312", "3.12"]] + # python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"]] + python: [["cp312", "3.12"]] @@ -55,6 +57,19 @@ jobs: if: ${{ runner.os == 'Windows' }} + - name: Set environment variables for ARM64 + if: matrix.buildplat[1] == 'win' && matrix.buildplat[2] == 'ARM64' + run: | + echo "CC=clang-cl" >> $env:GITHUB_ENV + echo "CXX=clang-cl" >> $env:GITHUB_ENV + echo "FC=flang" >> $env:GITHUB_ENV + echo "TARGET_ARCH=${{ matrix.buildplat[2] }}" >> $env:GITHUB_ENV + + - name: Set up Flang and pkgconf for ARM64 + if: matrix.buildplat[1] == 'win' && matrix.buildplat[2] == 'ARM64' + uses: ./.github/windows_arm64_steps + + - name: Setup macOS if: startsWith( matrix.buildplat[0], 'macos-' ) run: | diff --git a/.gitignore b/.gitignore index 01894e0..1ff8fd3 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ dev_make_install/optvl tests/test_om_wrapper*_out examples/run_opt_om*_out +examples/*.avl +examples/*.ps +examples/opt_output_sweep/ # ============================================================================== # Github python gitignore template # ============================================================================== diff --git a/meson.build b/meson.build index 89d6410..004bf81 100644 --- a/meson.build +++ b/meson.build @@ -8,7 +8,6 @@ project( default_options: [ 'buildtype=debugoptimized', 'c_std=c99', - 'fortran_std=legacy', ], ) @@ -111,13 +110,27 @@ ff_args = ff.get_supported_arguments( ff_args += [ '-ffixed-line-length-80', - '-std=legacy', '-fdefault-real-8', '-fdefault-double-8', - '-fPIC', '-O2' ] +if host_machine.system() != 'windows' + ff_args += ['-fPIC'] +endif + +# --- add flags for fortran standard --- +if ff.get_id() == 'gcc' + # -std=legacy is not supported by all Fortran compilers, but very useful with + # gfortran since it avoids a ton of warnings that we don't care about. + # Needs fixing in Meson, see https://github.com/mesonbuild/meson/issues/11633. + ff_args += ['-std=legacy'] +elif ff.get_id() == 'llvm-flang' + + ff_args += ['-ffixed-form', '-w'] + +endif + numpy_nodepr_api = '-DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION' cc_args = [numpy_nodepr_api] @@ -179,4 +192,5 @@ py3.extension_module('libavl', ) + install_subdir('optvl', install_dir: py3.get_install_dir()) diff --git a/pyproject.toml b/pyproject.toml index 9876685..60344ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ version = "2.4.0" # this automatically updates __init__.py and setup_deprecated. [tool.cibuildwheel] -skip = "cp36-* cp37-* pp* *_ppc64le *_i686 *_s390x" +skip = "cp38-* pp* *_ppc64le *_i686 *_s390x" build-verbosity = "3" test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}" diff --git a/src/amake.f b/src/amake.f index 6571b47..3ba72c5 100644 --- a/src/amake.f +++ b/src/amake.f @@ -577,6 +577,14 @@ SUBROUTINE MAKESURF(ISURF) C... nodal grid associated with vortex strip (aft-panel nodes) C... NOTE: airfoil in plane of wing, but not rotated perpendicular to dihedral; C... retained in (x,z) plane at this point + + ! recompute + ! XLASEC + ! XUASEC + ! ZLASEC + ! ZUASEC + + CALL AKIMA( XLASEC(1,ISEC,ISURF), ZLASEC(1,ISEC,ISURF), NSL, & XPT(IVC+1), ZL_L, DSDX ) CALL AKIMA( XUASEC(1,ISEC,ISURF), ZUASEC(1,ISEC,ISURF), NSL, diff --git a/src/includes/ADIMEN.INC b/src/includes/ADIMEN.INC index cf2a343..c57f3f2 100644 --- a/src/includes/ADIMEN.INC +++ b/src/includes/ADIMEN.INC @@ -32,11 +32,35 @@ ! to make it easier to termine the true size in clear_ad_seeds_fast() ! I increased some values to avoid matching + ! ! ! PARAMETER (NVMAX=4000) + ! PARAMETER (NVMAX=5000) + + ! ! PARAMETER (NSMAX=400) ! max number of strips + ! ! PARAMETER (NSECMAX=401) ! max number of geometry sections + ! PARAMETER (NSMAX=500) ! max number of strips + ! PARAMETER (NSECMAX=301) ! max number of geometry sections + ! PARAMETER (NFMAX=100) ! max number of surfaces + ! PARAMETER (NLMAX=502) ! max number of body nodes + ! PARAMETER (NBMAX=20) ! max number of bodies + + ! PARAMETER (NUMAX=6) ! number of velocity components + ! PARAMETER (NDMAX=30) ! max number of control surfaces + ! PARAMETER (NGMAX=21) ! max number of design variables + + ! PARAMETER (NRMAX=25) ! max number of run cases + ! PARAMETER (NTMAX=503) ! max number of time values + + ! PARAMETER (NOBMAX=1) ! max number of off body points + ! ! PARAMETER (NOBMAX=1000) ! max number of off body points + + ! PARAMETER (ICONX=20) ! + ! PARAMETER (IBX=200) ! max number of airfoil coordinates + ! ! PARAMETER (IBX=300) ! max number of airfoil coordinates + + ! PARAMETER (NVMAX=4000) PARAMETER (NVMAX=5000) - ! PARAMETER (NSMAX=400) ! max number of strips - ! PARAMETER (NSECMAX=401) ! max number of geometry sections PARAMETER (NSMAX=500) ! max number of strips PARAMETER (NSECMAX=301) ! max number of geometry sections PARAMETER (NFMAX=100) ! max number of surfaces @@ -51,9 +75,9 @@ PARAMETER (NTMAX=503) ! max number of time values PARAMETER (NOBMAX=1) ! max number of off body points - ! PARAMETER (NOBMAX=1000) ! max number of off body points + ! PARAMETER (NOBMAX=1) ! max number of off body points - PARAMETER (ICONX=20) ! - PARAMETER (IBX=200) ! max number of airfoil coordinates + PARAMETER (ICONX=2) ! + PARAMETER (IBX=2) ! max number of airfoil coordinates ! PARAMETER (IBX=300) ! max number of airfoil coordinates diff --git a/src/second.f b/src/second.f index a2daf9f..2ddaf21 100755 --- a/src/second.f +++ b/src/second.f @@ -1,12 +1,10 @@ - SUBROUTINE SECONDS(TSEC) REAL*8 TSEC C -C...SECNDS is a real*4 function that returns seconds. -C The value is modified by subtracting the supplied argument. -C It acts as in the VMS FORTRAN Manual. +C...Returns elapsed wall-clock time in seconds +C Replacement for non-standard SECNDS intrinsic C - REAL*4 SECNDS, TIME - TIME = 0.0 - TSEC = SECNDS(TIME) - END + INTEGER COUNT, COUNT_RATE + CALL SYSTEM_CLOCK(COUNT, COUNT_RATE) + TSEC = DBLE(COUNT) / DBLE(COUNT_RATE) + END \ No newline at end of file diff --git a/tools/wheels/cibw_test_command.sh b/tools/wheels/cibw_test_command.sh index 99ebf95..57981ad 100644 --- a/tools/wheels/cibw_test_command.sh +++ b/tools/wheels/cibw_test_command.sh @@ -3,9 +3,12 @@ set -xe PROJECT_DIR="$1" cd $PROJECT_DIR/tests +python -c "import platform; print(platform.machine())" +llvm-objdump -p ../optvl/libavl.cp312-win_arm64.pyd | findstr "DLL Name" # install tesing dependencies -pip install "scipy<=1.16" psutil "openmdao!=3.38" +pip install --only-binary :all: scipy +pip install psutil "openmdao!=3.38" #HACK: if the tests are not split up the CI runs out of memory... @@ -14,6 +17,8 @@ pip install "scipy<=1.16" psutil "openmdao!=3.38" # testflo -v . + + # test package built and installed correctly python test_import.py python -m unittest -v test_import.py diff --git a/tools/wheels/repair_windows.sh b/tools/wheels/repair_windows.sh index 583e589..dbb278b 100644 --- a/tools/wheels/repair_windows.sh +++ b/tools/wheels/repair_windows.sh @@ -1,32 +1,53 @@ +# from scipy + set -xe WHEEL="$1" DEST_DIR="$2" -# create a temporary directory in the destination folder and unpack the wheel -# into there -pushd $DEST_DIR -mkdir -p tmp -pushd tmp -wheel unpack $WHEEL -pushd optvl* -# To avoid DLL hell, the file name of libopenblas that's being vendored with -# the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD -# containing extra data at the end of the binary, which frequently occurs when -# building with mingw. -# We therefore find each PYD in the directory structure and strip them. +# Skip the strip command based on TARGET_ARCH +# TARGET_ARCH should be set by the CI environment (e.g., ARM64, AMD64) +TARGET_ARCH="${TARGET_ARCH:-}" # Default to empty string if not set + +if [ "$TARGET_ARCH" = "ARM64" ]; then + echo "Skipping stripping for ARM64 target." + + pushd $DEST_DIR + mkdir -p tmp + pushd tmp + wheel unpack $WHEEL + pushd optvl* + ls + llvm-objdump -p *.pyd | grep 'DLL Name' + dumpbin /dependents *.pyd +else + echo "Performing stripping for AMD64 target." + + # create a temporary directory in the destination folder and unpack the wheel + # into there + pushd $DEST_DIR + mkdir -p tmp + pushd tmp + wheel unpack $WHEEL + pushd optvl* + + # To avoid DLL hell, the file name of libopenblas that's being vendored with + # the wheel has to be name-mangled. delvewheel is unable to name-mangle PYD + # containing extra data at the end of the binary, which frequently occurs when + # building with mingw. + # We therefore find each PYD in the directory structure and strip them. + + for f in $(find ./optvl* -name '*.pyd'); do strip $f; done -for f in $(find ./optvl* -name '*.pyd'); do strip $f; done + # now repack the wheel and overwrite the original + wheel pack . + mv -fv *.whl $WHEEL -# now repack the wheel and overwrite the original -wheel pack . -mv -fv *.whl $WHEEL + cd $DEST_DIR + rm -rf tmp +fi -cd $DEST_DIR -rm -rf tmp +delvewheel repair -w $DEST_DIR $WHEEL -# the libopenblas.dll is placed into this directory in the cibw_before_build -# script. -delvewheel repair --add-path /c/opt/openblas/openblas_dll -w $DEST_DIR $WHEEL