wgblas
    Preparing search index...

    Module benchmarks/utils

    Shared utilities for wgblas benchmark scripts — a JS module and a parallel C header covering the same operations for the cuBLAS benchmarks.

    Used by every benchmarks/<routine>/wgblas/*.js (and the roofline probes) for GPU clock warm-up, timing, result persistence and table formatting. Every function is documented individually below:

    A header-only C counterpart used by every benchmarks/<routine>/cuda/*.c. All functions are static so each translation unit gets its own copy. It also defines CUDA_CHECK / CUBLAS_CHECK, which print the failing file:line and exit on any non-success status.

    Function Signature What it does
    warm_clocks (cublasHandle_t handle) → void Brings the GPU to full clocks before a measurement — the counterpart of warmClocks(), using cublasSscal bursts over a zeroed 64 MB buffer since these files define no kernels of their own
    median (float *arr, int n) → float Returns the median of arr; copies before sorting so the original is unchanged
    save_results (const char *gpu_model, const char *folder, const char *file_name, const record_field *fields, int n_fields, float *med_times, float *gbs_vals, float *gflops_vals, int n) → void Writes benchmarks/results/<gpu>/cuda/<folder>/<file_name>.json in the same schema as saveResults(). Each record_field ({ name, type, values }, type FIELD_INT/FIELD_FLOAT/FIELD_STRING) is one swept key, written before the fixed compute_ms/compute_GFLOPs/compute_GBs fields, so any record shape needs no new function; pass gflops_vals = NULL to omit compute_GFLOPs
    save_results_ex, _stride, _pad, _pad_ex, _uplo, _trans, _flag, _scalar — Thin wrappers over save_results for the record shapes older call sites use: {n}, {stride, n}, {pad, n} (_pad_ex adds GFLOP/s), {uplo, n}, {trans, n}, and a caller-named string (_flag) or float (_scalar) key with optional GFLOP/s. New benchmarks should call save_results directly
    get_gpu_model (char *dst, int maxlen) → void Fills dst with the CUDA device name as a slug, so wgblas and cuBLAS results land in the same benchmarks/results/<gpu>/ folder
    random_float_array (int n, float low, float high) → float* Heap-allocates n random floats in [low, high]; caller must free()
    host_bytes_available (void) → size_t Available host RAM from /proc/meminfo, for benchmarks that stage large host copies (the f64 routines stage two); returns 0 if unknown, which callers treat as "don't skip"

    The C slug in get_gpu_model maps each non-alphanumeric character to - one at a time, while getGpuModel() collapses runs and trims the ends — identical for every GPU benchmarked so far, but a name with consecutive or edge punctuation would split into two folders (tracked in TODO.md).

    getGpuModel
    median
    printHeader
    printRow
    saveResults
    toColumnMajor
    warmClocks