-
Notifications
You must be signed in to change notification settings - Fork 55
use backends and allocators in DMRG #467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lkdvos
wants to merge
22
commits into
main
Choose a base branch
from
reuse-buf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c10347d
use backends and allocators in DMRG
lkdvos 5f16bc3
use backends and allocators in more parts of JordanMPO
lkdvos ed50f6e
fix typo
lkdvos 89800be
derivatives: accept backend/allocator in the projections
lkdvos 9daf0af
derivatives: backend/allocator fields on MPODerivativeOperator
lkdvos 9c9f78c
IDMRG: configurable, reused backend and allocator
lkdvos 055bc48
TDVP: configurable, reused backend and allocator
lkdvos 568d8d1
VUMPS: configurable backend and allocator
lkdvos 7ac3519
VOMPS: configurable backend and allocator
lkdvos da20956
GradientGrassmann: configurable backend and allocator
lkdvos ac135af
changebonds: configurable backend and allocator
lkdvos 50844ac
DMRG3S: route DMRG's backend and allocator into the gauge step
lkdvos a2e207a
excitations, ED, DDMRG, approximate: backend and allocator
lkdvos d08774c
Add AllocatorPool: thread-safe reuse of scratch allocators
lkdvos 49eafee
Draw local-update scratch space from an allocator pool
lkdvos 78824d6
Defaults: add `backend()` and a session-wide buffering switch
lkdvos 5ddfed7
allocator: make pools internal, session-scoped and device-aware
lkdvos b3253e1
ext: route GPU-backed states to the device allocator
lkdvos 0ac603a
test: cover the pool registry, scheduler granularity and GPU algorithms
lkdvos 7697575
docs: the allocator is internal, and device-aware
lkdvos fbfbbcd
benchmark: sbatch script for the CUDA test suite
lkdvos a690080
allocator: replace the pool with a plain selector
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| #!/bin/bash | ||
| # Run the MPSKit CUDA test suite, including the new algorithm-level allocator tests. | ||
| # | ||
| # There is no GPU on the workstation, so this is the only way to exercise | ||
| # `MPSKit.allocatortype(::Type{<:CuArray})` and confirm that a device-backed DMRG/TDVP draws its | ||
| # scratch space from `CUDAAllocator` rather than a host buffer. | ||
| # | ||
| # Submit from the repository root: | ||
| # sbatch benchmark/gpu-allocator/run_gpu_tests.sbatch | ||
| # | ||
| # Adjust --partition/--gres to whatever GPU partition you have access to; the values below are | ||
| # placeholders. Check with `sinfo -o "%P %G %N"`. | ||
|
|
||
| #SBATCH --job-name=mpskit-gpu-alloc | ||
| #SBATCH --output=benchmark/gpu-allocator/logs/%x-%j.out | ||
| #SBATCH --error=benchmark/gpu-allocator/logs/%x-%j.err | ||
| #SBATCH --time=01:00:00 | ||
| #SBATCH --nodes=1 | ||
| #SBATCH --ntasks=1 | ||
| #SBATCH --cpus-per-task=8 | ||
| #SBATCH --mem=64G | ||
| #SBATCH --partition=gpu # placeholder | ||
| #SBATCH --gres=gpu:1 # placeholder | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| cd "${SLURM_SUBMIT_DIR:?must be submitted with sbatch}" | ||
| mkdir -p benchmark/gpu-allocator/logs | ||
|
|
||
| # The depot is precompiled under 1.12.6; `module load julia` gives 1.11.2, which fails with a | ||
| # StaticData error. Use the juliaup install on GPFS directly. | ||
| JULIA="${HOME}/.julia/juliaup/julia-1.12.6+0.x64.linux.gnu/bin/julia" | ||
| test -x "$JULIA" || { echo "julia not found at $JULIA" >&2; exit 1; } | ||
|
|
||
| echo "host: $(hostname)" | ||
| echo "julia: $("$JULIA" --version)" | ||
| nvidia-smi || echo "WARNING: nvidia-smi unavailable" | ||
|
|
||
| export JULIA_NUM_THREADS=4 | ||
| # one BLAS thread per Julia thread would oversubscribe; the GPU does the heavy lifting anyway | ||
| export OPENBLAS_NUM_THREADS=1 | ||
|
|
||
| "$JULIA" --project=test -e ' | ||
| using Pkg | ||
| Pkg.instantiate() | ||
|
|
||
| using CUDA, cuTENSOR | ||
| @info "CUDA status" functional = CUDA.functional() cutensor = cuTENSOR.functional() | ||
| CUDA.functional() || error("CUDA is not functional on this node") | ||
| CUDA.versioninfo() | ||
|
|
||
| include(joinpath(@__DIR__, "test", "setup", "testsetup.jl")) | ||
| using .TestSetup | ||
| using Test | ||
|
|
||
| @testset "MPSKit CUDA" verbose = true begin | ||
| for f in ("cu_adapt.jl", "states.jl", "operators.jl", "algorithms.jl") | ||
| @testset "$f" begin | ||
| include(joinpath(@__DIR__, "test", "gpu", "cuda", f)) | ||
| end | ||
| end | ||
| end | ||
| ' |
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
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaults.backend()is currentlyDefaultBackend(), but that might change, so it's probably better to write it as the former.