Repository navigation
Conversation
With the pthreads OpenBLAS build used in our benchmarks, the per-row symv
calls made by the CG solver (once per row for the initial residual, once
per CG step for A*p) and by calculate_loss stop scaling at a handful of
OpenMP threads: on last.fm, CG was no faster with 40 threads than with 4.
The level 1 routines do not have the problem, so the product with the Gram
matrix YtY is now n axpy calls.
Seconds per ALS iteration, 128 factors, cg_steps=3, one thread per physical
core on a dual-socket Xeon (20 cores per socket), OPENBLAS_NUM_THREADS=1,
before -> after:
threads last.fm 360k ml20m
1 14.3 -> 15.1 10.0 -> 11.0
8 5.1 -> 2.4 2.2 -> 1.5
40 6.0 -> 0.7 1.9 -> 0.4
Single-threaded runs are about 10% slower (medians of five runs each:
last.fm 14.3 -> 15.9 s, ml20m 10.3 -> 11.1 s): without thread contention,
one symv call is faster than n axpy calls. Results change only by floating
point rounding (summation order).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CPU CG solver uses BLAS
symvfor its products with the Gram matrixYtY: once per row for the initial residual, and once per CG step forA·p.calculate_lossalso callssymvonce per row. With the pthreads OpenBLASbuild used in these benchmarks,
concurrent
symvcalls scale poorly beyond a few OpenMP threads. On last.fm,CG was no faster with 40 threads than with 4.
This replaces each
symvcall withnBLAS level-1axpycalls, wherenis the number of factors. The matrix-vector product is mathematically unchanged;
results differ only in floating-point rounding due to the changed summation order.
Seconds per ALS iteration on a dual-socket Xeon (20 cores per socket),
128 factors,
cg_steps=3, one thread per physical core,OPENBLAS_NUM_THREADS=1, before → after:Single-threaded runs are about 10% slower (medians of five runs each:
last.fm 14.3 → 15.9 s, ml20m 10.3 → 11.1 s): without thread contention,
one
symvcall is faster thannaxpycalls.