Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
434 commits
Select commit Hold shift + click to select a range
ae37a9e
Tweak comments.
bredelings Jun 19, 2024
e55f5a4
Bug FIX: cache partial index wrong, need to multiply kCategoryCount!
xji3 Jun 21, 2024
b992d62
Implement SpMatrix<Real>::operator*=
bredelings Jun 24, 2024
066d162
Use destP instead of integrationTmp.
bredelings Jun 24, 2024
f52496d
Simplify.
bredelings Jun 24, 2024
280bcaf
optimize peeling
yucais Jun 25, 2024
5820a41
some optimization to reduction
yucais Jun 25, 2024
36dbb00
Specialize calculateRootLogLikelihoods( )
bredelings Jun 25, 2024
af76e5f
Use cublas for the dot product.
bredelings Jun 25, 2024
977e584
Chop out the multigrid version to simplify things.
bredelings Jun 25, 2024
c93e01b
Remove some old code.
bredelings Jun 25, 2024
aca251b
More printing operations.
bredelings Jun 25, 2024
73130c0
Use printing operations.
bredelings Jun 25, 2024
ed78fde
First try computing root likelihoods on the host.
bredelings Jun 25, 2024
0b3b500
Add function to show scaling info.
bredelings Jun 26, 2024
f0709b3
Fix likelihood by incorporating scaling factors (log).
bredelings Jun 26, 2024
c077523
Add pseudocode for rescaling partials.
bredelings Jun 26, 2024
b09cfc9
Updated pseudocode
bredelings Jun 26, 2024
0b18cc8
This code compiles.
bredelings Jun 26, 2024
c077fff
Fix computed index.
bredelings Jun 26, 2024
d94708d
Copy the host quantities back to the device.
bredelings Jun 26, 2024
45493b8
Comment out the kernel to use our host code for calculateRootLogLikel…
bredelings Jun 26, 2024
c93ba6c
Comment out the device kernel to use our host code for rescaling part…
bredelings Jun 26, 2024
adb32f4
Remove debug prints.
bredelings Jun 26, 2024
b9c8d55
Move rescaling code into its own subroutine.
bredelings Jun 26, 2024
72610db
Remove debug print.
bredelings Jun 26, 2024
5e1ecbc
Comment out debugging code.
bredelings Jun 26, 2024
173bd8b
Add some in-process notes.
bredelings Jun 26, 2024
bd3fce2
Split loop into three sequential parts.
bredelings Jul 1, 2024
c3e071b
Initialize the host column probs from the device version.
bredelings Jul 1, 2024
c52a04d
Initial implementation using S/Dgemv
bredelings Jul 1, 2024
e85e40c
Add note.
bredelings Jul 1, 2024
f254fd3
Reorder host sum.
bredelings Jul 2, 2024
8cac661
Transpose the matrix
bredelings Jul 2, 2024
7cc126a
Remove the CPU code in favor of GPU code.
bredelings Jul 2, 2024
d542f54
Remove some debug printing.
bredelings Jul 2, 2024
6c77a49
Fix order of stateCount / patternCount in gemv
bredelings Jul 2, 2024
761db59
Move gemv wrapper into its own function.
bredelings Jul 2, 2024
6a560b1
Remove commented-out code.
bredelings Jul 3, 2024
4b9ae54
Make dCumulativeScalingFactor into a const Real*
bredelings Jul 3, 2024
134c3be
Use cblas<t>axpy instead of CPU summation.
bredelings Jul 3, 2024
6b452ee
Remove comments and debugging code.
bredelings Jul 3, 2024
6e871d0
Comment out now-unused host vectors.
bredelings Jul 3, 2024
9eb2640
First working version of doing log on the device.
bredelings Jul 9, 2024
1ff16d9
Simplify cuda_log_vector
bredelings Jul 9, 2024
c0a41e7
Add question.
bredelings Jul 9, 2024
a4fd32a
Simplify code for scaling.
bredelings Jul 10, 2024
c9be335
calculate all operations for reduce within interval
yucais Jul 11, 2024
95f457b
move calculations of flags and accumulations to GPU
yucais Jul 11, 2024
858e0bc
Add first part of GPU rescaling code.
bredelings Jul 24, 2024
1dd4649
Add notes for what to do next.
bredelings Jul 25, 2024
4ca852d
Implement maximization over states and categories in one operation.
bredelings Jul 29, 2024
9ac404e
revision to kernel code
yucais Jul 30, 2024
d7641fd
one for loop for updating flags
yucais Jul 31, 2024
f9b5671
all cpu code for reduce within interval
yucais Jul 31, 2024
605a0db
padding (one interval per block)
yucais Jul 31, 2024
999dc7c
two segmented reduction to handle carry out
yucais Jul 31, 2024
e17e304
Start adding generic GPU code for rescalePartials
bredelings Aug 5, 2024
b599b42
Pass in extra dimensions.
bredelings Aug 5, 2024
66fd733
Add commented-out call to new GPU code.
bredelings Aug 5, 2024
c18af98
Pass in scalers_log also.
bredelings Aug 5, 2024
c3d54c0
Add last bit.
bredelings Aug 5, 2024
5aa5c5e
Also add the REAL=double version.
bredelings Aug 5, 2024
efca74a
Try the new rescaling code.
bredelings Aug 5, 2024
e210f11
Run the existing scaling code on the device.
bredelings Aug 12, 2024
b3893c4
Don't allocate device memory to do thrust::transform
bredelings Aug 12, 2024
36832e8
Add explanatory note.
bredelings Aug 12, 2024
186c049
Actually use the template version.
bredelings Aug 12, 2024
15757fe
fix bug in peeling for large transition matrix
yucais Aug 16, 2024
6197c34
one read and write for e, f, g, h and flags
yucais Aug 16, 2024
ae2a8cb
typo
yucais Aug 16, 2024
231625d
reorder for benchmark
yucais Aug 16, 2024
261c73a
Turn scaling on for actiontest by default.
bredelings Aug 19, 2024
2dbe8c7
Make sure that nSites != nStates
bredelings Aug 19, 2024
b3399af
Use the permuted order.
bredelings Aug 19, 2024
556cdf7
justMaximize should write the scalingFactors, not cumulativeScalingBu…
bredelings Aug 19, 2024
4f0c5e2
Fix indent.
bredelings Aug 19, 2024
57d7da1
Move rescalePartials2 after justMaximize
bredelings Aug 19, 2024
48b20b8
Calculate the maximum using thrust::reduced_by_key
bredelings Aug 19, 2024
f724932
Simplify log-transform of scaling factors.
bredelings Aug 20, 2024
38831a1
Move the s/0/1/ transform out of the thrust::for_each
bredelings Aug 20, 2024
436ce91
Factor out transformations of scalingFactors and cumulativeScalingBuf…
bredelings Aug 20, 2024
c2f841a
Speed up rescaling.
bredelings Aug 20, 2024
fdbd395
Remove (probably) unnecessary cudaDeviceSynchronize() calls.
bredelings Aug 20, 2024
0836a1a
Slight fix to simpleAction2
bredelings Aug 20, 2024
35f53fe
Add cuda_max( ) funtion that uses thrust.
bredelings Aug 20, 2024
4dc265f
Add notes.
bredelings Aug 20, 2024
1172990
code for accumulation using gpu/change memory allocation/add benchmark
yucais Aug 22, 2024
51ecb48
use atomic add for last accumulation
yucais Aug 23, 2024
f383e76
Calculate root likelihoods in a single operation w/o memory transfers.
bredelings Aug 26, 2024
fbadbdf
Also implement sumRootLikelihoods for float (duplicate code).
bredelings Aug 26, 2024
4ffc40e
Simplify/fix the CUDA Inf norm.
bredelings Aug 27, 2024
72e57fd
Remove some debug code to make the code easier to read.
bredelings Aug 27, 2024
5001ce0
Remove another piece of debug code.
bredelings Aug 27, 2024
d8b6a7e
allocate host memory once / ifdef for benchmark
yucais Aug 30, 2024
d621fc5
benchmark option
yucais Sep 3, 2024
ff22e7f
serially add up elements in reduceWithinInterval kernel
yucais Sep 12, 2024
e1252f6
update serial reduction
yucais Sep 20, 2024
d2298eb
Merge branch 'action-dev' of https://github.com/ji-group/beagle-lib i…
xji3 Oct 18, 2024
49403ba
JNI edits
xji3 Oct 25, 2024
c5374cb
merge remote Basta into action
xji3 Oct 25, 2024
134bc77
fix java flag
xji3 Oct 25, 2024
045a878
Clarify comment.
bredelings Nov 12, 2024
f6cc979
Fix indentation.
bredelings Nov 12, 2024
8349f35
First code for GPU L1 norms
bredelings Nov 12, 2024
732b7d6
Debugging code
bredelings Nov 12, 2024
1c7703d
Remove one crash, but find another.
bredelings Nov 19, 2024
47b2181
Fix error message.
bredelings Nov 19, 2024
fc8813a
Fix memory bug that was making everything crash.
bredelings Nov 19, 2024
9f61db9
Write informative error string.
bredelings Nov 19, 2024
0767b1b
Add thrust routine to initialize X matrix.
bredelings Nov 26, 2024
1837e2f
Use the CUDA/thrust routine to initialize the matrix.
bredelings Nov 26, 2024
c49534c
Add cuda_max_l1_norm
bredelings Nov 26, 2024
d3af633
Add cuda_sign_div_vector( ).
bredelings Nov 26, 2024
8bc97ef
Try and compute the norm.
bredelings Nov 26, 2024
8f8b92f
Also print t.
bredelings Nov 26, 2024
2b4bdca
Fix initializing X matrix.
bredelings Dec 2, 2024
09b4dcd
Move byRow matrix printers to header.
bredelings Dec 2, 2024
8e65e23
Log norm values.
bredelings Dec 2, 2024
6e7736a
Print before/after.
bredelings Dec 2, 2024
0ae4c97
Start adding missing stage (3) of the algorithm.
bredelings Dec 3, 2024
89103a0
Correct dimensions for Z and h in the comments of normest1
bredelings Dec 3, 2024
87384af
Get rowwise maximum using CUDA for column-major matrix.
bredelings Dec 3, 2024
24311a0
Construct the h vector using the GPU.
bredelings Dec 3, 2024
8826381
Make the destructor call cudaFree
bredelings Dec 3, 2024
1eb30d1
Add cudaDeviceDelete, to handle possible errors in cudaFree.
bredelings Dec 3, 2024
28fc158
Fix missing return statement.
bredelings Dec 3, 2024
c982b9f
Use cudaDeviceDelete( ).
bredelings Dec 3, 2024
4d7bb48
Sort the indices by the vector elements.
bredelings Dec 3, 2024
1c290cd
Fill the X matrix with zeros.
bredelings Dec 3, 2024
9d7b02d
Also copy itmax.
bredelings Dec 3, 2024
466dedb
GPU version seems to work.
bredelings Dec 3, 2024
c46b7e8
Remove debugging print statements.
bredelings Dec 3, 2024
54c7abe
Use kPaddedStateCount instead of kStateCount
bredelings Dec 9, 2024
a893e9e
Stop calculating tmp^p.
bredelings Dec 9, 2024
f407f89
Try switching to xcode 16
bredelings Dec 9, 2024
9847ef3
Try switching windows build to ubuntu 24.04
bredelings Dec 9, 2024
b882e6c
Switch mac into build to MacOs-13
bredelings Dec 9, 2024
4c77bd8
Use XCode 15 for MacOs 13
bredelings Dec 9, 2024
eba02fe
Use the GPU norm for |A^p|
bredelings Dec 9, 2024
7163aa1
Add early-exit from L1 norm code.
bredelings Dec 16, 2024
b125eaf
Don't compute norms for early exit.
bredelings Dec 16, 2024
5550607
fix cmake cuda error for recent versions
xji3 Dec 17, 2024
9e02245
do not really need "native" it seems
xji3 Dec 17, 2024
cbc2286
unrolling categories result in slower calculation because of differen…
xji3 Dec 19, 2024
0a5376e
another GPU L1 norm calculation, not working yet
xji3 Dec 19, 2024
65dc5a3
another L1 norm
xji3 Dec 20, 2024
db477bb
Switch back to original GPUnormest1 for now.
bredelings Jan 14, 2025
6768391
Add draft for cuda_max_l1_norm_to_device( )
bredelings Jan 14, 2025
93c50d5
Share code between float and double versions in cuda_ops
bredelings Jan 21, 2025
94b4a7c
Unify more code.
bredelings Jan 21, 2025
26ea0a8
Unduplicate more code.
bredelings Jan 21, 2025
9c82e5a
Unduplicate initialize_norm_x_matrix
bredelings Jan 21, 2025
28abcb1
Unduplicate code for justMaximize( ).
bredelings Jan 21, 2025
bce6cda
Unduplicate sumRootLikelihoods
bredelings Jan 21, 2025
d8a6999
Unduplicate rescalePartials2( ).
bredelings Jan 21, 2025
abec137
Add additional buffers to struct GPUnormest1
bredelings Jan 27, 2025
b60986b
Reimplement cuda_max using cub::DeviceReduce::Max( )
bredelings Feb 3, 2025
6c4ea04
Add cuda_scratch_space object.
bredelings Feb 4, 2025
a404ab6
Also use cuda_scratch_space in cuda_max
bredelings Feb 4, 2025
49ec203
Don't allocate memory for offsets.
bredelings Feb 4, 2025
43aa56b
Add GPUnormest3
bredelings Feb 4, 2025
6e810a1
Don't call cudaFree if the buffer is nullptr.
bredelings Feb 4, 2025
8cae1ba
Don't call cudaFree unnecessarily.
bredelings Feb 4, 2025
858154c
Add GPUnormest3
bredelings Feb 4, 2025
dac7168
Use GPUnormest3
bredelings Feb 4, 2025
8b1120a
Don't run find_package(CUDA) if BUILD_CUDA=OFF
bredelings Mar 4, 2025
9c7b673
Print size of failed allocation.
bredelings Apr 14, 2025
9135585
Only allocate BASTA memory if BASTA is enabled.
bredelings Apr 28, 2025
29303f3
Merge branch 'action-dev' of https://github.com/ji-group/beagle-lib i…
xji3 Apr 29, 2025
bac49b5
action test file update
xji3 May 7, 2025
22c8416
add new set sparse differential matrix for action
xji3 May 7, 2025
269c56b
intermediate commit: not compile yet
xji3 May 7, 2025
cef8d1b
minor format fix
xji3 May 7, 2025
c295cdb
dimension fix
xji3 May 7, 2025
cd80ab4
let it compile
xji3 May 7, 2025
c333bed
getting numbers
xji3 May 7, 2025
c09addf
clean a bit
xji3 May 7, 2025
e66d792
Remove ubuntu-20.04, as it is too old.
bredelings May 7, 2025
c8f2488
Update ccache bit.
bredelings May 7, 2025
14a57ea
Add missing matrix name.
bredelings May 7, 2025
74133ca
Fix bug and warning, I think.
bredelings May 7, 2025
0b0420b
temp commit for debug prints
xji3 May 7, 2025
552a3dc
Merge branch 'action-dev' of https://github.com/ji-group/beagle-lib i…
xji3 May 7, 2025
b07a1bb
correct edge derivative numbers
xji3 May 7, 2025
763f74b
JNI interface update for new setSparseDifferentialMatrix function
xji3 May 7, 2025
7239127
update JNI interface
xji3 May 7, 2025
a187219
let action pre-order partial update multi-threading again
xji3 May 15, 2025
30341ee
try enable multi threading for CPU pre-order update
xji3 May 16, 2025
a15aff5
not working yet
xji3 May 16, 2025
ee36b46
action CPU multi-threading actually works, need to fix non-action code
xji3 May 16, 2025
433b1c8
non-action pre order update mutli-threaded now
xji3 May 19, 2025
f99a6fe
make edge derivative reduction multi-threaded
xji3 Jun 2, 2025
0246298
make action edge derivative reduction multi-threaded
xji3 Jun 2, 2025
0d7474f
Fix confusing comment.
bredelings Jul 14, 2025
0e997c0
Use the merged norms.
bredelings Jul 14, 2025
6ebc30b
Remove early exit based on prodS
bredelings Jul 14, 2025
40a6044
Remove unused S_old.
bredelings Jul 14, 2025
4032df0
Make X into a vector of matrices.
bredelings Jul 14, 2025
bcddfa2
Move Y, Z, S, and h out of the inner loop.
bredelings Jul 14, 2025
406616d
Move other quantities out of the loop.
bredelings Jul 14, 2025
5bc8cd2
Split the loop into two pieces.
bredelings Jul 14, 2025
89caaf7
Simplify exit condition.
bredelings Jul 14, 2025
575d10f
Make separate result variables.
bredelings Jul 14, 2025
43b42cc
Remove early exit condition.
bredelings Jul 14, 2025
4a6be89
Remove some exit conditions.
bredelings Jul 14, 2025
78d1634
Interchange loop order.
bredelings Jul 14, 2025
f1c432e
Make S, Z, and h just temp vars.
bredelings Jul 14, 2025
075e950
Construct the X values for the next generation separately.
bredelings Jul 14, 2025
4f35b8a
Use a single X for all values of p.
bredelings Jul 15, 2025
932963b
Compute Y[p] from Y[p-1].
bredelings Jul 15, 2025
da8ea4e
Use a single value of Y across P.
bredelings Jul 15, 2025
76673da
If there are no more X columns to try, then we're done.
bredelings Jul 15, 2025
4c34eda
Fix incorrect break in loop.
bredelings Jul 15, 2025
ed0dac8
Remove debug logging.
bredelings Jul 21, 2025
ddc7f5a
Don't make the last partition extra-big.
bredelings Jul 21, 2025
3e8543b
Further simplify and fix assignment of patterns to threads.
bredelings Aug 12, 2025
ed626b2
Update test script
bredelings Aug 19, 2025
f2a1a8d
Merge branch 'action-dev' of https://github.com/ji-group/beagle-lib i…
xji3 Aug 26, 2025
61bba63
upPrePartials..
xji3 Aug 29, 2025
ddf3d9c
Fix mac arm test.
bredelings Sep 8, 2025
75dcb55
Update ci.yaml to use native linux-arm runner
bredelings Sep 8, 2025
0f26ad2
Fix compiler versions.
bredelings Sep 8, 2025
c93dc47
Use native linux-arm runner
bredelings Sep 8, 2025
524c0a8
Simplify merged_norms by changing std::sort to just an argmax
bredelings Sep 9, 2025
b751d59
Add a function to compute the true norms (merged).
bredelings Sep 9, 2025
9e8df82
Add comment about condition 3.13
bredelings Oct 13, 2025
4f8aaf4
Enable color in compiler errors
bredelings Nov 3, 2025
3198cb8
Switch back to the non-merged norms.
bredelings Oct 21, 2025
42fbb9a
Don't crash in the destructor when initialization fails.
bredelings Nov 10, 2025
9b2793b
Print a more helpful message when EigenDecompositionCube tries to all…
bredelings Nov 10, 2025
36dffa9
Print message if an exception is thrown in createInstance
bredelings Nov 10, 2025
8d19cf6
Make auto-download of Eigen work
bredelings Nov 12, 2025
b6affc5
Compute the d-values on demand
bredelings Mar 3, 2026
b31195d
Update github actions
bredelings Mar 3, 2026
caa5866
Compute the d-values in a single-threaded fashion.
bredelings Mar 16, 2026
7907d39
Compute cheaper (s,m) for comparison
bredelings Mar 24, 2026
df15374
Stop computing d[p] when we've done too much work
bredelings Mar 24, 2026
d57985b
GPU action: correctness and robustness fixes (Phase 0)
xji3 Oct 24, 2026
fd47d6e
GPU action: remove per-term and per-node overhead (Phase 1)
xji3 Oct 24, 2026
bd7078e
CI: run the Xcode 16 job on macos-15
xji3 Oct 24, 2026
a5fbb78
CI: build without -march=native
xji3 Oct 24, 2026
0556a0f
CI: key the ccache cache on the runner CPU instead of dropping -march…
xji3 Oct 24, 2026
d372e30
GPU action Phase 2: row-major partials, Horner term kernels, level ba…
xji3 Oct 25, 2026
93fb001
GPU action: cheaper setSparseMatrix (cached CSR structure, row-major …
xji3 Oct 25, 2026
c7542de
GPU action: pre-order partials, edge derivatives and cross products
xji3 Oct 28, 2026
bd767d0
Action plugins: apply existing scale factors for a read scaling index
xji3 Oct 29, 2026
4fbd5ff
CI: include the CPU's instruction-set flags in the ccache key
xji3 Oct 29, 2026
3d68dde
CI: the CPU feature lists exist only on Intel Macs
xji3 Oct 29, 2026
2fdc317
Build option for portable binaries; SSE plugin needs only SSE4.1
xji3 Oct 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 102 additions & 71 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and test
on:
push:
branches:
- "*"
- "*"
pull_request:
branches:
- "*"
Expand All @@ -12,78 +12,134 @@ jobs:
build:
strategy:
matrix:
name: [ubuntu-gcc-10,
ubuntu-gcc-11,
ubuntu-gcc-12,
ubuntu-clang-15,
macos-xcode-14-intel,
macos-xcode-14-arm,
name: [ubuntu-gcc-12,
ubuntu-gcc-13,
ubuntu-gcc-14,
ubuntu-gcc-15,
ubuntu-gcc-15-debug,
# ubuntu-gcc-14-arm,
ubuntu-clang-17,
ubuntu-clang-19,
macos-intel,
macos-xcode16-arm,
macos-xcode26-arm,
windows
]

include:
- name: ubuntu-gcc-10
os: ubuntu-20.04

- name: ubuntu-gcc-12
os: ubuntu-22.04
compiler: gcc
version: "10"
buildtype: "release"
version: "12"
arch: "linux64"

- name: ubuntu-gcc-11
os: ubuntu-22.04
- name: ubuntu-gcc-13
os: ubuntu-24.04
compiler: gcc
version: "11"
buildtype: "release"
version: "13"
arch: "linux64"

- name: ubuntu-gcc-12
os: ubuntu-22.04
- name: ubuntu-gcc-14
os: ubuntu-24.04
compiler: gcc
version: "12"
buildtype: "release"
version: "14"
arch: "linux64"

- name: ubuntu-clang-15
os: ubuntu-22.04
compiler: clang
- name: ubuntu-gcc-15
os: ubuntu-24.04
compiler: gcc
version: "14"
buildtype: "Release"
arch: "linux64"
image: ubuntu:25.04

- name: ubuntu-gcc-15-debug
os: ubuntu-24.04
compiler: gcc
version: "15"
buildtype: "release"
buildtype: "Debug"
arch: "linux64"
image: ubuntu:25.04

# "Failed to obtain BEAGLE instance" on some tests.
# - name: ubuntu-gcc-14-arm
# os: ubuntu-24.04-arm
# compiler: gcc
# version: "14"
# arch: "linux64"

- name: ubuntu-clang-17
os: ubuntu-24.04
compiler: clang
version: "17"
buildtype: "Release"
arch: "linux64"

- name: ubuntu-clang-19
os: ubuntu-24.04
compiler: clang
version: "19"
buildtype: "Release"
arch: "linux64"

- name: macos-xcode-14-intel
os: macos-12
- name: macos-intel
os: macos-15-intel
compiler: xcode
version: "14"
buildtype: "release"
version: "16"
arch: "mac-intel64"

- name: macos-xcode-14-arm
os: macos-14
- name: macos-xcode16-arm
os: macos-15
compiler: xcode
version: "14"
buildtype: "release"
version: "16"
arch: "mac-arm64"

- name: macos-xcode26-arm
os: macos-latest
compiler: xcode
version: "26"
arch: "mac-arm64"

- name: windows
os: ubuntu-22.04
os: ubuntu-24.04
compiler: mingw
version: "N/A"
buildtype: "release"
arch: "win64"

runs-on: ${{ matrix.os }}
container:
image: ${{ matrix.image || '' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12.0
python-version: 3.12

# Caches for different branches are isolated, so we don't need to put the branch name into the key.
# The total size for all caches in a repository is 5Gb.

- name: Set CMake build type
run: |
# Portable binaries: with -march=native, ccache would reuse objects built on one runner's CPU on
# another runner's ("Illegal instruction").
CMAKE_ARGS="-DBEAGLE_OPTIMIZE_FOR_NATIVE_ARCH=OFF"
if [ -n "${{ matrix.buildtype }}" ] ; then
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }}"
fi
echo "CMAKE_ARGS=${CMAKE_ARGS}" >> $GITHUB_ENV

- name: Install (Linux)
- name: Install utilities (Linux)
if: runner.os == 'Linux' && matrix.name != 'windows'
run: |
# If we're running in a docker image, we are already root
if [ -n "${{ matrix.image }}" ] ; then
apt-get update && apt-get install -y sudo build-essential git cmake
fi

sudo apt-get update
sudo apt-get install -y cmake ninja-build ccache pkg-config
sudo apt-get install -y openjdk-17-jdk libeigen3-dev ocl-icd-opencl-dev
sudo apt-get install -y openjdk-17-jdk libeigen3-dev

if [ "${{ matrix.compiler }}" = "gcc" ]; then
# For newer GCCs, maybe.
Expand All @@ -97,66 +153,41 @@ jobs:
sudo apt-get install -y clang-${{ matrix.version }}
echo "CC=ccache clang-${{ matrix.version }}" >> $GITHUB_ENV
echo "CXX=ccache clang++-${{ matrix.version }}" >> $GITHUB_ENV
echo "CMAKE_ARGS=-DBUILD_OPENMP=OFF" >> $GITHUB_ENV
echo "CMAKE_ARGS=${CMAKE_ARGS} -DBUILD_OPENMP=OFF" >> $GITHUB_ENV
fi

- name: Install (Linux -> Windows [cross])
- name: Install utilities (Linux -> Windows [cross])
if: matrix.name == 'windows'
run: |
# For mingw/gcc-12.
cat /etc/apt/sources.list
sudo sed -i 's/jammy/lunar/g' /etc/apt/sources.list

sudo apt-get update
sudo apt-get install -y cmake ninja-build ccache pkg-config
sudo apt-get install -y dos2unix g++-mingw-w64 mingw-w64-tools wine64 zstd

echo "CMAKE_ARGS=-DBUILD_ACTION=OFF -DBUILD_JNI=OFF -DBUILD_OPENMP=OFF -DCMAKE_TOOLCHAIN_FILE=scripts/mingw-w64-x86_64.cmake" >> $GITHUB_ENV
echo "CMAKE_ARGS=${CMAKE_ARGS} -DBUILD_ACTION=OFF -DBUILD_JNI=OFF -DBUILD_OPENMP=OFF -DCMAKE_TOOLCHAIN_FILE=scripts/mingw-w64-x86_64.cmake" >> $GITHUB_ENV

- name: Select XCode version (macOS)
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.version }}

- name: Install (macOS)
- name: Install utilities (macOS)
if: runner.os == 'macOS'
run: |
brew install cmake ninja pkg-config ccache coreutils eigen openjdk
brew install ninja pkg-config ccache coreutils eigen openjdk
echo "CC=ccache clang" >> $GITHUB_ENV
echo "CXX=ccache clang++" >> $GITHUB_ENV
echo "CMAKE_ARGS=-DBUILD_OPENMP=OFF" >> $GITHUB_ENV

# Caches for different branches are isolated, so we don't need to put the branch name into the key.
# The total size for all caches in a repository is 5Gb.
echo "CMAKE_ARGS=${CMAKE_ARGS} -DBUILD_OPENMP=OFF" >> $GITHUB_ENV

- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
ccache --set-config=cache_dir=$HOME/.ccache

if [ "${{ runner.os }}" = "Linux" ]; then
stamp=$(date '+%s')
else
stamp=$(gdate '+%s')
fi
echo "${stamp}"
echo "timestamp=${stamp}" >> $GITHUB_OUTPUT

- name: ccache cache files
# uses: actions/cache@v2
uses: pat-s/always-upload-cache@v3.0.11
- name: Set up ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
path: ~/.ccache
key: ${{ matrix.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
key: ${{ matrix.name }}-portable
restore-keys: |
${{ matrix.name }}-ccache-
${{ matrix.name }}-portable

- name: Configure
run: |
if [ "${{ matrix.cxxflags }}" != "" ] ; then
CPPARGS="$CPPARGS ${{ matrix.cxxflags }}"
fi
mkdir build
cd build
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=$HOME/local ${CMAKE_ARGS}
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- "*"
pull_request:
branches:
- "*"

jobs:
build:
name: Build on Linux x86_64
runs-on: ubuntu-latest

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

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake file pkgconf libeigen3-dev

- name: Build
run: |
mkdir build
cd build
cmake ..
make -j
file libhmsbeagle/libhmsbeagle.so.* | grep x86-64

build-aarch64:
name: Build on Linux aarch64
runs-on: ubuntu-24.04-arm

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

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake file pkgconf libeigen3-dev

- name: Build
run: |
mkdir build
cd build
cmake ..
make -j
file libhmsbeagle/libhmsbeagle.so.* | grep aarch64
Loading
Loading