Skip to content

Generic profiling

Generic profiling #541

Workflow file for this run

name: GCC
permissions:
contents: read
pull-requests: write
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch: {}
jobs:
Test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flags: [DBG=0, DBG=1 PEDANTIC=2]
libxs: [prebuilt]
include:
- flags: DBG=1 PEDANTIC=2 FORCE_CXX=1 FORTRAN=0
libxs: header-only
steps:
- uses: actions/checkout@v5
- name: Install OpenBLAS
run: sudo apt install -y libopenblas-openmp-dev
- name: Install OpenCL
run: sudo apt install -y opencl-c-headers ocl-icd-libopencl1 ocl-icd-opencl-dev
- name: Setup LIBXS
run: |
git clone --depth 1 https://github.com/hfp/libxs.git ${{ github.workspace }}/../libxs
echo "LIBXSROOT=${{ github.workspace }}/../libxs" >> $GITHUB_ENV
- name: Build LIBXS
if: matrix.libxs == 'prebuilt'
run: cd ${LIBXSROOT} && make -j $(nproc) ${{ matrix.flags }}
- name: Build LIBXSTREAM
if: matrix.libxs != 'header-only'
run: make -j $(nproc) ${{ matrix.flags }}
- name: Test
run: make -j $(nproc) ${{ matrix.flags }} test
- name: Install (PREFIX)
if: matrix.libxs != 'header-only'
run: make -j $(nproc) ${{ matrix.flags }} HEADER_ONLY=1 install PREFIX=$HOME/libxstream-install
- name: Verify install (PREFIX)
if: matrix.libxs != 'header-only'
run: |
test -f $HOME/libxstream-install/include/libxstream/libxstream.h
test -f $HOME/libxstream-install/include/libxstream/libxstream_version.h
test -f $HOME/libxstream-install/include/libxstream/libxstream_source.h
test -d $HOME/libxstream-install/include/libxstream/src
ls $HOME/libxstream-install/lib/libxstream.* >/dev/null
test -f $HOME/libxstream-install/lib/cmake/libxstream/libxstreamConfig.cmake
test -f $HOME/libxstream-install/share/libxstream/scripts/tool_opencl.sh
- name: Out-of-tree build and test
run: |
mkdir $HOME/libxstream-oot && cd $HOME/libxstream-oot
make -j $(nproc) -f ${{ github.workspace }}/Makefile ${{ matrix.flags }} test
- name: Build samples
if: matrix.libxs == 'header-only'
run: make -j $(nproc) ${{ matrix.flags }} PARAMS= samples
Debian:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install dependencies
run: |
sudo apt update -y
sudo apt install -y build-essential debhelper devscripts fakeroot \
gfortran opencl-c-headers ocl-icd-opencl-dev
- name: Build and install LIBXS
run: |
git clone --depth 1 https://github.com/hfp/libxs.git ${{ github.workspace }}/../libxs
cd ${{ github.workspace }}/../libxs
make -j $(nproc) GNU=1 STATIC=0
sudo make install PREFIX=/usr STATIC=0 \
POUTDIR=lib/x86_64-linux-gnu \
PPKGDIR=lib/x86_64-linux-gnu/pkgconfig \
PCMKDIR=lib/x86_64-linux-gnu/cmake/libxs
sudo ldconfig
- name: Build Debian package
run: |
cp -a scripts/debian .
chmod +x debian/rules
dpkg-buildpackage -us -uc -d -b
- name: Verify Debian packages
run: |
dpkg-deb -c ../libxstream0_*.deb
dpkg-deb -c ../libxstream-dev_*.deb
- name: Collect packages
run: cp ../*.deb .
- name: Upload packages
uses: actions/upload-artifact@v5
with:
name: libxstream-deb
path: "*.deb"
RPM:
runs-on: ubuntu-latest
container: fedora:latest
steps:
- uses: actions/checkout@v5
- name: Install dependencies
run: |
dnf install -y rpm-build gcc gcc-gfortran make bash git \
ocl-icd-devel opencl-headers
- name: Install LIBXS
run: |
git clone --depth 1 https://github.com/hfp/libxs.git ../libxs
cd ../libxs && make -j $(nproc) GNU=1 STATIC=0
cd ../libxs && make install PREFIX=/usr STATIC=0 \
POUTDIR=lib64 PPKGDIR=lib64/pkgconfig PCMKDIR=lib64/cmake/libxs
ldconfig
- name: Build RPM package
run: |
mkdir -p $HOME/rpmbuild/{SOURCES,SPECS}
cp scripts/fedora/libxstream.spec $HOME/rpmbuild/SPECS/
VERSION=$(grep '^Version:' scripts/fedora/libxstream.spec | awk '{print $2}')
tar czf $HOME/rpmbuild/SOURCES/libxstream-${VERSION}.tar.gz \
--transform="s,^\.,libxstream-${VERSION}," .
rpmbuild -bb --nodeps --nocheck \
$HOME/rpmbuild/SPECS/libxstream.spec
- name: Upload packages
uses: actions/upload-artifact@v5
with:
name: libxstream-rpm
path: ~/rpmbuild/RPMS/
CMake:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gcc: [12, 14]
shared: [static, shared]
env:
CC: gcc-${{ matrix.gcc }}
CXX: g++-${{ matrix.gcc }}
steps:
- uses: actions/checkout@v5
- name: Install GCC ${{ matrix.gcc }}
run: sudo apt install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}
- name: Install OpenCL
run: sudo apt install -y opencl-c-headers ocl-icd-libopencl1 ocl-icd-opencl-dev
- name: Setup LIBXS
run: |
git clone --depth 1 https://github.com/hfp/libxs.git ${{ github.workspace }}/../libxs
cd ${{ github.workspace }}/../libxs && make -j $(nproc)
- name: Configure LIBXSTREAM
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=$HOME/libxstream-install \
-DLIBXSTREAM_INSTALL_HEADER_ONLY=ON \
-DBUILD_SHARED_LIBS=${{ matrix.shared == 'shared' && 'ON' || 'OFF' }}
- name: Build
run: cmake --build build -j $(nproc)
- name: Install
run: cmake --install build
- name: Verify install
run: |
test -f $HOME/libxstream-install/include/libxstream/libxstream.h
test -f $HOME/libxstream-install/include/libxstream/libxstream_source.h
test -d $HOME/libxstream-install/include/libxstream/src
ls $HOME/libxstream-install/lib/libxstream* >/dev/null
ls $HOME/libxstream-install/lib/pkgconfig/libxstream.pc >/dev/null
test -f $HOME/libxstream-install/lib/cmake/libxstream/libxstreamConfig.cmake
test -f $HOME/libxstream-install/lib/cmake/libxstream/libxstreamTargets.cmake
test -f $HOME/libxstream-install/share/libxstream/scripts/tool_opencl.sh
test -f $HOME/libxstream-install/share/libxstream/samples/smm/smm_acc.c
test -f $HOME/libxstream-install/share/libxstream/samples/smm/kernels/multiply.cl
- name: Verify find_package
run: |
mkdir -p /tmp/test_find
cat > /tmp/test_find/CMakeLists.txt <<'EOF'
cmake_minimum_required(VERSION 3.13)
project(test_find C)
find_package(libxstream CONFIG REQUIRED)
add_executable(test_find test_find.c)
target_link_libraries(test_find libxstream::libxstream)
EOF
cat > /tmp/test_find/test_find.c <<'EOF'
#include <libxstream/libxstream.h>
int main(void) { return 0; }
EOF
cmake -B /tmp/test_find/build -S /tmp/test_find \
-DCMAKE_PREFIX_PATH="$HOME/libxstream-install;${{ github.workspace }}/../libxs"
cmake --build /tmp/test_find/build
Dispatch:
needs: Test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Trigger LIBXS tests
run: |
gh api repos/hfp/libxs/dispatches \
-f event_type=libxstream-update \
-f "client_payload[sha]=${{ github.sha }}"
env:
GH_TOKEN: ${{ secrets.DISPATCH_TOKEN }}