Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions .github/workflows/core-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ jobs:
set -x
brew install googletest

- name: install BLAS++
# macOS builds use Apple's NEW Accelerate interface (LAPACK 3.12 on
# current SDKs) -- the legacy default is LAPACK 3.2.1 from 2009, with a
# broken divide-and-conquer gesdd and none of the routines BQRRP/HQRRP
# need. The defines.h check makes a silent fallback to the legacy
# interface a hard failure. Requires blaspp/lapackpp with new-Accelerate
# support (icl-utk-edu masters after the BallisticLA PRs merge).
- name: install BLAS++ (new Accelerate)
run: |
cd ..
git clone https://github.com/icl-utk-edu/blaspp.git
mkdir blaspp-build
cd blaspp-build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`pwd`/../blaspp-install -Dbuild_tests=OFF ../blaspp
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`pwd`/../blaspp-install -Dblas=accelerate -Dgpu_backend=none -Dbuild_tests=OFF ../blaspp
make -j2 install
grep -q ACCELERATE_NEW_LAPACK ../blaspp-install/include/blas/defines.h \
|| { echo "::error::BLAS++ did not select Apple's new Accelerate interface"; exit 1; }

- name: install Random123
run: |
Expand Down
12 changes: 12 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ For GPU/CUDA support (enabled with `-DRequireCUDA=ON`), you need:
**Verified Working Configuration** (as of 2025-11-26):
- CUDA 12.9.0 + GCC 13.3.0 + CMake 3.31.9 + Driver v581.80 ✅

### macOS: Apple Accelerate requirements
Apple ships two LAPACK implementations inside Accelerate. The legacy default
is LAPACK 3.2.1 (2009): its divide-and-conquer SVD (`gesdd`) is broken on
Apple Silicon, and it lacks routines RandLAPACK requires (`orhr_col`,
`geqrt`, ...). **RandLAPACK supports only the new interface** (macOS 13.3+,
LAPACK 3.12 on current SDKs): build BLAS++ with `-Dblas=accelerate` using a
BLAS++/LAPACK++ version that carries new-Accelerate support, and the correct
interface propagates to LAPACK++ and RandLAPACK automatically. Verify by
checking that the installed `include/blas/defines.h` contains
`ACCELERATE_NEW_LAPACK`. Alternatively, use Homebrew OpenBLAS (what
`install.sh` does on macOS).

### Note on Directory Names
On some systems, library directories are called `lib` while on others they're called `lib64`. Adjust paths accordingly in the CMake configuration commands below.

Expand Down
5 changes: 0 additions & 5 deletions RandLAPACK/drivers/rl_bqrrp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ int BQRRP<T, RNG>::call(
int64_t* J,
RandBLAS::RNGState<RNG> &state
){
#ifdef __APPLE__
UNUSED(m); UNUSED(n); UNUSED(A); UNUSED(lda); UNUSED(d_factor); UNUSED(tau); UNUSED(J); UNUSED(state);
throw std::runtime_error("BQRRP is not supported when BLAS is linked against Apple Accelerate.");
#else
// Input parameter validation. Bad inputs would otherwise lead to a
// downstream BLAS/LAPACK failure or, worse, a segfault -- both fatal
// when BQRRP is called through a binding layer (e.g. MEX/MATLAB).
Expand Down Expand Up @@ -660,7 +656,6 @@ int BQRRP<T, RNG>::call(
cols -= b_sz;
}
delete[] J_buffer;
#endif
return 0;
}

Expand Down
2 changes: 0 additions & 2 deletions RandLAPACK/drivers/rl_cqrrpt.hh
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ int CQRRPT<T, RNG>::call(
hqrrp(d, n, A_hat, d, J, tau, this->nb_alg, this->oversampling, this->panel_pivoting, this->use_cholqr, state, (T**) nullptr);
} else if(this -> qrcp == Subroutines::QRCP::bqrrp) {

#if !defined(__APPLE__)
if (n <= 2000) {
this->bqrrp_block_ratio = 1.0;
} else if (n <= 8000) {
Expand All @@ -242,7 +241,6 @@ int CQRRPT<T, RNG>::call(

RandLAPACK::BQRRP<T, RNG> BQRRP(false, n * this->bqrrp_block_ratio);
BQRRP.call(d, n, A_hat, d, 1.0, tau, J, state);
#endif
} else {
lapack::geqp3(d, n, A_hat, d, J, tau);
}
Expand Down
7 changes: 0 additions & 7 deletions RandLAPACK/drivers/rl_hqrrp.hh
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,6 @@ static int64_t CHOLQR_mod_WY(
//
// Simplification of NoFLA_QRPmod_WY_unb_var4 for the case when pivoting=0.
//
#if defined(__APPLE__)
UNUSED(num_stages); UNUSED(m_A); UNUSED(n_A); UNUSED(buff_A); UNUSED(ldim_A);
UNUSED(buff_t); UNUSED(buff_T); UNUSED(ldim_T); UNUSED(buff_R); UNUSED(ldim_R);
UNUSED(buff_D);
throw std::runtime_error("Unsupported on macOS.");
#else

// Some initializations.
if( num_stages < 0 )
Expand Down Expand Up @@ -563,7 +557,6 @@ static int64_t CHOLQR_mod_WY(
// Entries of tau will be placed on the main diagonal of matrix T from orhr_col().
for(i = 0; i < n_A; ++i)
buff_t[i] = buff_T[(ldim_T + 1) * i];
#endif
return 0;
}

Expand Down
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/BQRRP_error_analysis.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
Performs computations in order to assess the pivot quality of BQRRP.
The setup is described in detail in Section 4 of The arXiv version 2 CQRRPT (https://arxiv.org/pdf/2311.08316.pdf) paper.
Expand Down Expand Up @@ -260,4 +253,3 @@ int main(int argc, char *argv[]) {
j = 0;
}
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/BQRRP_pivot_quality.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
Performs computations in order to assess the pivot quality of BQRRP.
The setup is described in detail in Section 4 of The arXiv version 2 CQRRPT (https://arxiv.org/pdf/2311.08316.pdf) paper.
Expand Down Expand Up @@ -332,4 +325,3 @@ int main(int argc, char *argv[]) {
sv_ratio(m_info, b_sz, all_data, state_constant2, path);
std::cout << "Pivot quality metric 2 done\n\n";
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/BQRRP_runtime_breakdown.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
IBQRRP runtime breakdown benchmark - assesses the time taken by each subcomponent of IBQRRP.
There are 10 things that we time:
Expand Down Expand Up @@ -182,4 +175,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/BQRRP_speed_comparisons_block_size.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
BQRRP speed comparison benchmark - runs:
1. BQRRP_CQR and BQRRP_HQR
Expand Down Expand Up @@ -267,4 +260,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/BQRRP_speed_comparisons_mat_size.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
BQRRP speed comparison benchmark - runs:
1. BQRRP_CQR and BQRRP_HQR
Expand Down Expand Up @@ -279,4 +272,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/BQRRP_subroutines_speed.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
QR speed comparison benchmark - runs:
1. GEQRF
Expand Down Expand Up @@ -436,4 +429,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/HQRRP_runtime_breakdown.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
HQRRP runtime breakdown benchmark - assesses the time taken by each subcomponent of HQRRP.
There are 7 things that we time:
Expand Down Expand Up @@ -167,4 +160,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_BQRRP/HQRRP_sanity_check.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@


#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else

// Making sure that HQRRP's performance instability is specific to HQRRP and not related to the flaws in behcnmarking logic
// by comparing HQRRP and GEMM side-by-side.
Expand Down Expand Up @@ -183,4 +176,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_CQRRPT/CQRRPT_error_analysis.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
Performs computations in order to assess the pivot quality of BQRRP.
The setup is described in detail in Section 4 of The arXiv version 2 CQRRPT (https://arxiv.org/pdf/2311.08316.pdf) paper.
Expand Down Expand Up @@ -255,4 +248,3 @@ int main(int argc, char *argv[]) {
j = 0;
}
}
#endif
8 changes: 0 additions & 8 deletions benchmark/bench_CQRRPT/CQRRPT_speed_comparisons.cc
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#if defined(__APPLE__)
#include <iostream>
int main() {
std::cout << "This benchmark cannot run on Apple machines." << std::endl;
return 1;
}
#else
/*
CQRRPT speed comparison benchmark - runs:
1. CQRRPT
Expand Down Expand Up @@ -274,4 +267,3 @@ int main(int argc, char *argv[]) {
file << "Total benchmark execution time:" + std::to_string(dur_time_all) + "\n";
file.flush();
}
#endif
69 changes: 69 additions & 0 deletions build/RandBLAS/RandBLAS/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#pragma once

#define RandBLAS_FULL_VERSION "1.1.0-32-g8417f4b"
#define RandBLAS_VERSION_MAJOR 1
#define RandBLAS_VERSION_MINOR 1
#define RandBLAS_VERSION_PATCH 0
#define RandBLAS_COMMITS_SINCE_RELEASE 32
#define RandBLAS_COMMIT_HASH "8417f4b"
// ^ CMake sets those based on the output of a shell command executed in the RandBLAS git repo.
//
// The specific command is
// git describe --tags --match "[0-9]*.[0-9]*.[0-9]*"
// That should return a string of the form
// [X].[Y].[Z]-[C]-g[H]
// The contents of this string are interpreted as follows.
// [X] is a nonnegative integer equal to the major version number
// [Y] is a nonnegative integer equal to the minor version number
// [Z] is a nonnegative integer equal to the patch number
// [C] is a nonnegative integer equal to the number of commits since the version number was assigned
// [H] is a short-form commit hash, indicating the state of repository's source code.
// RandBLAS_FULL_VERSION is the entire string returned by the git command.
//
// If you want to use RandBLAS without using CMake, you need to create config.h manually.
// We explain how to do that below. But first
//
// DISCLAIMER: if you're looking at a config.h file actually generated by CMake parsing
// this config.h.in file, then the instructions below will mostly look like nonsense.
// This is because CMake will have performed string substitution on the original
// comments as given in config.h.in.
//
// Start by making a copy of this config.h.in file and giving it the name config.h.
// From there, substitute every expression the form with a value based on the
// ``git describe`` command. For example, if ``git describe``returned 0.1.0-456-gcb84abc,
// then your config.h file would make the substitutions
//
// 1.1.0-32-g8417f4b --> 0.1.0-456-gcb84abc
// 1 --> 0
// 1 --> 1
// 0 --> 0
// 32 --> 456
// 8417f4b --> cb84abc
//

#define RandBLAS_HAS_OpenMP
// ^ CMake determines whether or not to #define RandBLAS_HAS_OpenMP
//
// If you don't want to use CMake, then your config.h file should
// either delete that line (if you aren't linking to OpenMP) or
// it should replace it with
//
// #define RandBLAS_HAS_OpenMP
//
// if you are linking to OpenMP.
//

#define RandBLAS_HAS_MKL
// ^ CMake determines whether or not to #define RandBLAS_HAS_MKL
//
// This is set when BLAS++ was built with Intel MKL, the MKL sparse
// BLAS header (mkl_spblas.h) is found, AND the user has not disabled
// MKL sparse features via -DRandBLAS_USE_MKL_SPARSE=OFF.
//
// When defined, RandBLAS uses MKL's Inspector-Executor sparse BLAS
// for accelerated sparse matrix operations (sparse x dense and
// sparse x sparse multiplication).
//
// If you don't want to use CMake, define this only if you are linking
// to Intel MKL and have mkl_spblas.h available.
//
9 changes: 9 additions & 0 deletions build/RandLAPACK/rl_config.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "../RandBLAS/RandBLAS/config.h.in"

#define RandLAPACK_VERSION "0.1.0-162-g54cf3a7"
#define RandLAPACK_VERSION_MAJOR 0
#define RandLAPACK_VERSION_MINOR 1
#define RandLAPACK_VERSION_PATCH 0

#endif
Loading
Loading