Skip to content

Commit

Permalink
ci: add GitHub Action for testing NVidia C/C++ compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
nemequ committed Sep 13, 2024
1 parent 2d47a50 commit 4d49d07
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 13 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,59 @@ jobs:
- name: Check for changes
run: git diff --exit-code

nvhpc:
runs-on: ubuntu-latest
strategy:
matrix:
version:
# For available versions, see
# https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64/Packages
#
# Note that version prior to 21.11 don't support passing
# arguments to the __malloc__ attribute, which glibc >= 2.34,
# which is used in CI, does unconditionally. That causes
# breaks several of the tests for versions prior to 21.11.
# - "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@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: /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

pelles-c:
runs-on: windows-latest
strategy:
Expand Down
11 changes: 7 additions & 4 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=
Expand Down
9 changes: 0 additions & 9 deletions test/non-null.c
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#include "../hedley.h"

#if defined(_MSC_VER)
HEDLEY_DIAGNOSTIC_PUSH
#pragma warning(disable:4255 4668)
#include <stdlib.h>
HEDLEY_DIAGNOSTIC_POP
#else
#include <stdlib.h>
#endif

#if HEDLEY_PGI_VERSION_CHECK(20,7,0)
# pragma diag_remark 1622,1623
#elif defined(HEDLEY_PGI_VERSION)
Expand Down

0 comments on commit 4d49d07

Please sign in to comment.