Skip to content

Commit

Permalink
Various fixes & improvements for Windows CI/CD
Browse files Browse the repository at this point in the history
This commit marks version 0.23.2 (see #14).

* Fix incorrect cuda_version reference and order of CUDA version / CC
  columns in table generated on the release notes
* Fix mfaktc.ini copy on Windows CI/CI builds:
  Github Actions running an unusual environment for Windows builds,
  where GNU Make has SHELL set to PowerShell (in other case GNU Make
  from MSYS2 installed will try to launch bash shell which fails to
  build without heavy modifications to the Makefile). And for some
  reason make fails to spawn "copy" command, probably because it's
  just a shortcut from Copy-Item command name. Anyways, simply copying
  this file to upper dir before launching make fixes this issue,
  because Make will skip this step as completed previously. This way
  we don't have to patch Makefile.win or invent other tricks.
* Changes suggested by @tdulcet on #14 added. Thanks!
  These include:
  * Set action fail-fast to false. This allows other job continue if
    one fails.
  * Commented out CUDA versions to leave only one highest .patch per
    major.minor.
  * "Code quality" improvements to workflow & helper script.
  • Loading branch information
N-Storm committed Mar 3, 2025
1 parent a2a45c5 commit 6f87bf4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 46 deletions.
76 changes: 43 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,41 @@ jobs:
runs-on: ubuntu-latest

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true
# When fail-fast set to true, if one job fails, all others within the same
# matrix (i.e. Linux or Windows builds) will be aborted at the same time.
fail-fast: false

matrix:
sys:
# Specified version combination must exist as CUDA container image from NVidia: nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }}
# Available versions can be found here: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags (note that only Ubuntus are supported by this action)
- { cuda_version: '12.8.0', ct_os: 'ubuntu24.04' }
- { cuda_version: '12.6.3', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.6.2', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.6.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.6.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.6.2', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.6.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.6.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.5.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.5.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.5.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.4.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.4.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.4.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.2', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.3.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.3.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.2.2', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.2.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.2.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.1.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.1.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.1.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.0.1', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.0.0', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.0.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.8.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.7.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '11.7.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.6.2', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.6.1', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.6.1', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.6.0', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.5.2', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.5.1', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.5.0', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.4.3', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.3.1', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.2.2', ct_os: 'ubuntu20.04' }
Expand Down Expand Up @@ -76,17 +81,16 @@ jobs:
id: packages
env:
SCRIPT: |
apt update
apt -y full-upgrade
apt install -y build-essential curl git make python3 sudo unzip wget zip
apt-get update
apt-get -y full-upgrade
apt-get install -y build-essential curl git make python3 sudo unzip wget zip
run: docker exec build-container bash -c "$SCRIPT"

- name: Checkout repo
uses: actions/checkout@v4

- name: Prepare sources and gather info
id: prepare
shell: bash
env:
SCRIPT: |
cd /workspace
Expand All @@ -106,7 +110,7 @@ jobs:
cd /workspace
zip -9 -j ${{ env.base_name }}.zip *
echo "[${{ env.base_name }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.base_name }}.zip) | \
${{ matrix.sys.os.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ env.base_name }}.txt
run: docker exec build-container bash -c "$SCRIPT"

Expand All @@ -122,8 +126,9 @@ jobs:
runs-on: ${{ matrix.sys.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: true
# When fail-fast set to true, if one job fails, all others within the same
# matrix (i.e. Linux or Windows builds) will be aborted at the same time.
fail-fast: false

matrix:
# Available version can be viewed at the Jimver/cuda-toolkit action sources:
Expand All @@ -138,7 +143,7 @@ jobs:
- { cuda_version: '12.1.1', os: 'windows-2022' }
- { cuda_version: '12.0.1', os: 'windows-2022' }
- { cuda_version: '11.8.0', os: 'windows-2022' }
- { cuda_version: '11.7.0', os: 'windows-2022' }
- { cuda_version: '11.7.1', os: 'windows-2022' }
- { cuda_version: '11.6.2', os: 'windows-2022' }
- { cuda_version: '11.5.2', os: 'windows-2022' }
- { cuda_version: '11.4.4', os: 'windows-2022' }
Expand Down Expand Up @@ -178,6 +183,7 @@ jobs:
run: |
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64 -HostArch amd64
cd "${{ github.workspace }}\src"
Copy-Item mfaktc.ini ..
make SHELL="powershell.exe" -f Makefile.win
# MSVC 2019 on Windows 2019 has similar script, but it doesn't allows setting arch & host_arch and defaults to x86 (32 bit) env.
Expand All @@ -187,15 +193,15 @@ jobs:
if: ${{ matrix.sys.os == 'windows-2019' }}
shell: cmd
run: |
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" & cd src & make SHELL="powershell.exe" -f Makefile.win
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" & cd src & copy mfaktc.ini .. & make SHELL="powershell.exe" -f Makefile.win
- name: Prepare build archive with description
shell: bash
run: |
choco install -y --no-progress zip
zip -9 -j "${{ env.base_name }}.zip" *
echo "[${{ env.base_name }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.base_name }}.zip) | \
${{ matrix.sys.os.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ env.base_name }}.txt
- name: Upload build artifacts
Expand All @@ -222,16 +228,20 @@ jobs:
- name: Prepare list of release files & release notes
id: makeinfo
run: |
echo "Binary releases (automated builds) below." > RELEASE_NOTES.txt
echo "Compute Capability (CC) in the table means minimum and maximum versions supported." >> RELEASE_NOTES.txt
echo "CC versions are listed without the dot (i.e. 90 means 9.0 compute capability)." >> RELEASE_NOTES.txt
echo >> RELEASE_NOTES.txt
echo "File | Compute Capability | CUDA version | Build OS | Compiler version | NVCC version" >> RELEASE_NOTES.txt
echo "--- | --- | --- | --- | --- | ---" >> RELEASE_NOTES.txt
cat mfaktc-${{ github.ref_name }}-*-cuda*/mfaktc-${{ github.ref_name }}-*-cuda*.txt | sort -Vr >> RELEASE_NOTES.txt
echo 'RELEASE_FILES<<EOF' > $GITHUB_OUTPUT
ls -1 mfaktc-${{ github.ref_name }}-*-cuda*/mfaktc-${{ github.ref_name }}-*-cuda*.zip | sort -Vr >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
{
echo "Binary releases (automated builds) below."
echo "Compute Capability (CC) in the table means minimum and maximum versions supported."
echo "CC versions are listed without the dot (i.e. 90 means 9.0 compute capability)."
echo
echo "File | CUDA version | Compute Capability | Build OS | Compiler version | NVCC version"
echo "--- | --- | --- | --- | --- | ---"
sort -Vr mfaktc-${{ github.ref_name }}-*-cuda*/mfaktc-${{ github.ref_name }}-*-cuda*.txt
} > RELEASE_NOTES.txt
{
echo 'RELEASE_FILES<<EOF'
printf '%s\n' mfaktc-${{ github.ref_name }}-*-cuda*/mfaktc-${{ github.ref_name }}-*-cuda*.zip | sort -Vr
echo 'EOF'
} > $GITHUB_OUTPUT
- name: Make and upload release
uses: softprops/[email protected]
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/scripts/build_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ if [[ -z "$1" ]]; then
exit 1
fi

# Windows may have it's sort first on PATH, so set this var to the full path
# to GNU sort to avoid having writing full path every time.
# Windows may have it's sort first on PATH, this is the shortcut
# to call GNU sort by the full path
export GSORT='/usr/bin/sort'

declare -a CUDA_VERSION
Expand All @@ -43,8 +43,10 @@ if [[ -z "${CUDA_VERSION[*]}" ]]; then
exit 2
fi

eval $(echo -e "CUDA_VER_MAJOR=${CUDA_VERSION[0]}\nCUDA_VER_MINOR=${CUDA_VERSION[1]}" | tee $0.out)
CUDA_VER_MAJOR=${CUDA_VERSION[0]}
CUDA_VER_MINOR=${CUDA_VERSION[1]}
CUDA_VER="${CUDA_VER_MAJOR}${CUDA_VER_MINOR}"
echo -e "CUDA_VER_MAJOR=${CUDA_VER_MAJOR}\nCUDA_VER_MINOR=${CUDA_VER_MINOR}" > "$0.out"

# Starting from 11.0.0 CUDA has --list-gpu-arch flag.
# For older versions we have to grep out supported CC versions from help.
Expand All @@ -63,7 +65,7 @@ elif [ ${#CC_LIST[*]} -lt 3 ]; then
fi

echo "All supported CCs: ${CC_LIST[*]}, CC_MIN=${CC_LIST[0]}, CC_MAX=${CC_LIST[-1]}"
echo -e "CC_LIST=\"${CC_LIST[*]}\"\nCC_MIN=${CC_LIST[0]}\nCC_MAX=${CC_LIST[-1]}" >> $0.out
echo -e "CC_LIST=\"${CC_LIST[*]}\"\nCC_MIN=${CC_LIST[0]}\nCC_MAX=${CC_LIST[-1]}" >> "$0.out"

echo 'Removing NVCCFLAGS strings with CC arch entries from the Makefile & Makefile.win and populating with discovered supported values.'
sed -i '/^NVCCFLAGS += --generate-code arch=compute.*/d' src/Makefile.win src/Makefile
Expand All @@ -81,22 +83,23 @@ if [ $CUDA_VER -lt 120 ]; then
fi

echo 'Gathering version info on generic compiler and nvcc...'
if [[ -x "$(which vswhere.exe)" ]]; then
if [[ -x "$(command -v vswhere.exe)" ]]; then
CC_VSPROD="$(vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property displayName)"
COMPILER_VER="${CC_VSPROD}, $(vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationVersion)"
elif [[ -x "$(which powershell.exe)" ]]; then
elif [[ -x "$(command -v powershell.exe)" ]]; then
CC_VSINFO="$(powershell -Command Get-VSSetupInstance)"
CC_VSPROD="$(echo $CC_VSINFO | grep DisplayName | cut -d':' -f2 | xargs)"
COMPILER_VER="${CC_VSPROD}, $(echo $CC_VSINFO | grep InstallationVersion | cut -d':' -f2 | xargs)"
CC_VSPROD="$(echo "$CC_VSINFO" | grep DisplayName | cut -d':' -f2 | xargs)"
COMPILER_VER="${CC_VSPROD}, $(echo "$CC_VSINFO" | grep InstallationVersion | cut -d':' -f2 | xargs)"
else
COMPILER_VER="$(gcc --version | head -n1)"
OS_VER="$(grep PRETTY_NAME /etc/os-release | cut -d'=' -f2- | tr -d '"')"
source /etc/os-release
OS_VER="${PRETTY_NAME}"
fi

NVCC_VER="$(nvcc --version | tail -n1)"

if [[ -x "$(which powershell.exe)" ]]; then
if [[ -x "$(command -v powershell.exe)" ]]; then
OS_VER="$(powershell -Command "[System.Environment]::OSVersion.VersionString")"
fi

NVCC_VER="$(nvcc --version | tail -n1)"

echo -e "COMPILER_VER=$COMPILER_VER\nNVCC_VER=$NVCC_VER\nOS_VER=${OS_VER}" | tee -a $0.out
2 changes: 1 addition & 1 deletion src/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ code path */
*******************************************************************************
******************************************************************************/

#define MFAKTC_VERSION "0.23.1" /* DO NOT CHANGE! */
#define MFAKTC_VERSION "0.23.2" /* DO NOT CHANGE! */



Expand Down

0 comments on commit 6f87bf4

Please sign in to comment.