From 51bac3ba3dcfdd9e15773800fe88293183fb5ddd Mon Sep 17 00:00:00 2001 From: Evan Nemerson Date: Thu, 12 Sep 2024 21:09:24 -0400 Subject: [PATCH] ci: add GitHub Action for testing NVidia C/C++ compilers --- .github/workflows/ci.yml | 87 +++++++++++++++++++++++++++++++--------- test/Makefile | 11 +++-- 2 files changed, 74 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0ae576..a6a4729 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,28 +23,75 @@ jobs: - name: Check for changes run: git diff --exit-code - pelles-c: - runs-on: windows-latest + nvhpc: + runs-on: ubuntu-latest strategy: - matrix: - version: - # https://community.chocolatey.org/packages/pelles-c#versionhistory - - "12.0.2" - - "11.0.2" - - "10.0.6" - - "9.00.0.0" - # - "8.00.0.0" ## Installation times out. + matrix: + version: + # For available versions, see https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64/Packages + # - "20.11" + # - "21.1" ## BROKEN. File size mismatch. + # - "21.2" + # - "21.3" + # - "21.5" + # - "21.7" + # - "21.9" + - "21.11" + # - "22.1" + # - "22.2" + # - "22.3" + # - "22.5" + # - "22.7" + # - "22.9" + - "22.11" + # - "23.1" + # - "23.3" + # - "23.5" + # - "23.7" + # - "23.9" + - "23.11" + # - "24.1" + # - "24.3" + - "24.7" steps: - - uses: actions/checkout@v2 - - name: Install Pelles-C - uses: crazy-max/ghaction-chocolatey@v3 - with: - args: install pelles-c --version "${{ matrix.version }}" --no-progress + - uses: actions/checkout@v4 + - name: Free some disk space + run: sudo rm -rf /usr/local/lib/android /usr/local/.ghcup/ghc + - name: Install NVidia HPC SDK + run: | + curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg + echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list + sudo apt-get update -y + sudo apt-get install -y nvhpc-$(echo "${{ matrix.version }}" | tr '.' '-') - name: Compile env: - CC: 'C:\Program Files\PellesC\bin\pocc.exe' - LD: 'C:\Program Files\PellesC\bin\polink.exe' - CFLAGS: '/IC:\Progra~1\PellesC\Include' - LDFLAGS: '/LIBPATH:C:\Progra~1\PellesC\lib /LIBPATH:C:\Progra~1\PellesC\Lib\Win64' + CC: /opt/nvidia/hpc_sdk/Linux_x86_64/"${{ matrix.version }}"/compilers/bin/nvc + CXX: /opt/nvidia/hpc_sdk/Linux_x86_64/"${{ matrix.version }}"/compilers/bin/nvc++ working-directory: test - run: make -f Makefile.pelles + run: make + + # pelles-c: + # runs-on: windows-latest + # strategy: + # matrix: + # version: + # # https://community.chocolatey.org/packages/pelles-c#versionhistory + # - "12.0.2" + # - "11.0.2" + # - "10.0.6" + # - "9.00.0.0" + # # - "8.00.0.0" ## Installation times out. + # steps: + # - uses: actions/checkout@v2 + # - name: Install Pelles-C + # uses: crazy-max/ghaction-chocolatey@v3 + # with: + # args: install pelles-c --version "${{ matrix.version }}" --no-progress + # - name: Compile + # env: + # CC: 'C:\Program Files\PellesC\bin\pocc.exe' + # LD: 'C:\Program Files\PellesC\bin\polink.exe' + # CFLAGS: '/IC:\Progra~1\PellesC\Include' + # LDFLAGS: '/LIBPATH:C:\Progra~1\PellesC\lib /LIBPATH:C:\Progra~1\PellesC\Lib\Win64' + # working-directory: test + # run: make -f Makefile.pelles diff --git a/test/Makefile b/test/Makefile index 0439dee..205be6b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -9,12 +9,12 @@ else ifeq ($(notdir $(CC)), suncc) else ifeq ($(notdir $(CC)),$(filter $(notdir $(CC)),armcl cl2000 cl430 cl6x cl7x clpru)) CFLAGS ?= --display_error_number --emit_warnings_as_errors --issue_remarks -i $(dir $(shell readlink -f $(shell which $(CC))))../include C_OUTPUT_FILE := --output_file= -else ifeq ($(notdir $(CC)), pgcc) +else ifeq ($(notdir $(CC)),$(filter $(notdir $(CC)),pgcc nvc)) CFLAGS ?= -Minform=inform -c11 C_OUTPUT_FILE := -o -else ifeq ($(notdir $(CC)), pgc++) - CFLAGS ?= --display_error_number -Minform=inform -Werror - C_OUTPUT_FILE := -o +else ifeq ($(notdir $(CC)), nvcc) + CFLAGS ?= --Werror all-warnings + C_OUTPUT_FILE := --output-file= else ifeq ($(notdir $(CC)), xlc) CFLAGS ?= $(CLANG_C_FLAGS) C_OUTPUT_FILE := -o @@ -48,6 +48,9 @@ else ifeq ($(notdir $(CXX)), sunCC) else ifeq ($(notdir $(CXX)), pgc++) CXXFLAGS ?= --display_error_number -Minform=inform -Werror CXX_OUTPUT_FILE := -o +else ifeq ($(notdir $(CXX)), nvc++) + CXXFLAGS ?= --display_error_number -Minform=inform -Werror + CXX_OUTPUT_FILE := -o else ifeq ($(notdir $(CXX)),$(filter $(notdir $(CC)),armcl cl2000 cl430 cl6x cl7x clpru)) CXXFLAGS ?= --display_error_number --emit_warnings_as_errors --issue_remarks -i $(dir $(shell readlink -f $(shell which $(CC))))../include CXX_OUTPUT_FILE := --output_file=