opencudalab 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opencudalab-0.1.0/.github/workflows/ci.yml +113 -0
- opencudalab-0.1.0/.github/workflows/pypi.yml +38 -0
- opencudalab-0.1.0/.gitignore +29 -0
- opencudalab-0.1.0/CMakeLists.txt +235 -0
- opencudalab-0.1.0/OPEN_CUDA_LAB_PRD.pdf +0 -0
- opencudalab-0.1.0/OpenCUDA-Lab.pdf +0 -0
- opencudalab-0.1.0/PKG-INFO +151 -0
- opencudalab-0.1.0/README.md +274 -0
- opencudalab-0.1.0/analysis/fig_ablation.py +127 -0
- opencudalab-0.1.0/analysis/fig_baselines.py +93 -0
- opencudalab-0.1.0/analysis/fig_coverage.py +106 -0
- opencudalab-0.1.0/analysis/fig_fragmentation.py +101 -0
- opencudalab-0.1.0/analysis/fig_latency.py +97 -0
- opencudalab-0.1.0/analysis/fig_motivation.py +177 -0
- opencudalab-0.1.0/analysis/fig_multitenant.py +52 -0
- opencudalab-0.1.0/analysis/fig_risk_utilization.py +261 -0
- opencudalab-0.1.0/analysis/fig_sweeps.py +131 -0
- opencudalab-0.1.0/analysis/make_all.py +83 -0
- opencudalab-0.1.0/analysis/oclstats.py +255 -0
- opencudalab-0.1.0/analysis/requirements.txt +7 -0
- opencudalab-0.1.0/analysis/tables.py +368 -0
- opencudalab-0.1.0/bench/baselines/baselines.c +573 -0
- opencudalab-0.1.0/bench/baselines/baselines.h +99 -0
- opencudalab-0.1.0/bench/kernels/kernels.cu +562 -0
- opencudalab-0.1.0/bench/replay/replay.c +528 -0
- opencudalab-0.1.0/bench/workloads/workloads.c +569 -0
- opencudalab-0.1.0/bench/workloads/workloads.h +95 -0
- opencudalab-0.1.0/bindings/java/pom.xml +32 -0
- opencudalab-0.1.0/bindings/java/src/main/java/io/opencuda/OpenCuda.java +39 -0
- opencudalab-0.1.0/bindings/java/target/classes/io/opencuda/OpenCuda$Lib.class +0 -0
- opencudalab-0.1.0/bindings/java/target/classes/io/opencuda/OpenCuda.class +0 -0
- opencudalab-0.1.0/docker/Dockerfile +41 -0
- opencudalab-0.1.0/docker/entrypoint.sh +20 -0
- opencudalab-0.1.0/docs/research-plan.md +189 -0
- opencudalab-0.1.0/examples/python/requirements.txt +5 -0
- opencudalab-0.1.0/examples/python/resnet_cifar10.py +517 -0
- opencudalab-0.1.0/examples/quickstart.c +177 -0
- opencudalab-0.1.0/experiments/drivers/admission.c +371 -0
- opencudalab-0.1.0/experiments/drivers/baselines.c +243 -0
- opencudalab-0.1.0/experiments/drivers/calibrate.c +281 -0
- opencudalab-0.1.0/experiments/drivers/capacity.c +279 -0
- opencudalab-0.1.0/experiments/drivers/multitenant.c +180 -0
- opencudalab-0.1.0/experiments/run_gpu.sh +62 -0
- opencudalab-0.1.0/experiments/run_host.sh +85 -0
- opencudalab-0.1.0/include/opencuda/opencuda.h +381 -0
- opencudalab-0.1.0/include/opencuda/opencuda_cuda.h +86 -0
- opencudalab-0.1.0/opencuda.pc.in +10 -0
- opencudalab-0.1.0/packaging/INSTALL.md +133 -0
- opencudalab-0.1.0/packaging/homebrew/opencudalab.rb +31 -0
- opencudalab-0.1.0/paper/Makefile +13 -0
- opencudalab-0.1.0/paper/figures/fig_ablation.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_ablation.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_baselines.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_baselines.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_coverage.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_coverage.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_fragmentation.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_fragmentation.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_latency.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_latency.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_motivation.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_motivation.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_multitenant.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_multitenant.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_risk_utilization.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_risk_utilization.png +0 -0
- opencudalab-0.1.0/paper/figures/fig_sweeps.pdf +0 -0
- opencudalab-0.1.0/paper/figures/fig_sweeps.png +0 -0
- opencudalab-0.1.0/paper/opencuda-lab.tex +163 -0
- opencudalab-0.1.0/paper/refs.bib +47 -0
- opencudalab-0.1.0/paper/tables/headline.json +1387 -0
- opencudalab-0.1.0/paper/tables/table_admission.tex +66 -0
- opencudalab-0.1.0/paper/tables/table_baselines.tex +15 -0
- opencudalab-0.1.0/paper/tables/table_capacity_family.tex +9 -0
- opencudalab-0.1.0/paper/tables/table_coverage.tex +63 -0
- opencudalab-0.1.0/paper/tables/table_liveness.tex +16 -0
- opencudalab-0.1.0/paper/tables/table_main.tex +13 -0
- opencudalab-0.1.0/paper/tables/table_risk_targeting.tex +16 -0
- opencudalab-0.1.0/pyproject.toml +62 -0
- opencudalab-0.1.0/python/opencudalab/__init__.py +14 -0
- opencudalab-0.1.0/python/opencudalab/__main__.py +37 -0
- opencudalab-0.1.0/python/opencudalab/_native.py +53 -0
- opencudalab-0.1.0/scripts/artifact.sh +30 -0
- opencudalab-0.1.0/scripts/pack_v1.sh +31 -0
- opencudalab-0.1.0/scripts/phase0.sh +53 -0
- opencudalab-0.1.0/scripts/publish_pypi.sh +34 -0
- opencudalab-0.1.0/scripts/remote.sh +73 -0
- opencudalab-0.1.0/src/backend/mock/provider_mock.c +375 -0
- opencudalab-0.1.0/src/backend/provider.h +119 -0
- opencudalab-0.1.0/src/backend/runtime/provider_runtime.c +229 -0
- opencudalab-0.1.0/src/backend/vmm/provider_vmm.c +429 -0
- opencudalab-0.1.0/src/core/allocator.c +862 -0
- opencudalab-0.1.0/src/core/ocl_internal.h +251 -0
- opencudalab-0.1.0/src/core/ocl_vm.c +82 -0
- opencudalab-0.1.0/src/core/ocl_vm.h +23 -0
- opencudalab-0.1.0/src/core/ocl_win_pthread.h +98 -0
- opencudalab-0.1.0/src/core/planner.c +207 -0
- opencudalab-0.1.0/src/core/runtime.c +696 -0
- opencudalab-0.1.0/src/core/util.c +254 -0
- opencudalab-0.1.0/src/estimator/conformal.c +141 -0
- opencudalab-0.1.0/src/estimator/estimator.c +174 -0
- opencudalab-0.1.0/src/interop/pytorch_alloc.c +52 -0
- opencudalab-0.1.0/src/telemetry/telemetry.c +335 -0
- opencudalab-0.1.0/tests/ocl_test.h +96 -0
- opencudalab-0.1.0/tests/test_admission.c +176 -0
- opencudalab-0.1.0/tests/test_allocator.c +135 -0
- opencudalab-0.1.0/tests/test_baselines.c +83 -0
- opencudalab-0.1.0/tests/test_conformal.c +178 -0
- opencudalab-0.1.0/tests/test_estimator.c +230 -0
- opencudalab-0.1.0/tests/test_planner.c +215 -0
- opencudalab-0.1.0/tests/test_pytorch_alloc.c +35 -0
- opencudalab-0.1.0/tests/test_realloc.c +118 -0
- opencudalab-0.1.0/tests/test_stress.c +192 -0
- opencudalab-0.1.0/tests/test_telemetry.c +152 -0
- opencudalab-0.1.0/tests/test_threads.c +143 -0
- opencudalab-0.1.0/tools/ocl_gap.cu +300 -0
- opencudalab-0.1.0/tools/ocl_micro.cu +369 -0
- opencudalab-0.1.0/tools/ocl_probe.cu +181 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
# Everything here runs without a GPU. That is the point of the device memory
|
|
4
|
+
# provider interface: the allocator core, planner, estimator and calibrator are
|
|
5
|
+
# CUDA-free, so the whole test suite is exercised on hosted runners and only the
|
|
6
|
+
# VMM and runtime backends need the GPU box.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
11
|
+
pull_request:
|
|
12
|
+
workflow_dispatch:
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build-and-test:
|
|
20
|
+
name: ${{ matrix.os }} / ${{ matrix.preset }}
|
|
21
|
+
runs-on: ${{ matrix.os }}
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
os: [ubuntu-24.04, macos-14]
|
|
26
|
+
preset: [release, asan, tsan]
|
|
27
|
+
exclude:
|
|
28
|
+
# Apple clang's TSan reports on the pthread interceptors used by the
|
|
29
|
+
# runtime lock in a way that differs from libstdc++; one platform's
|
|
30
|
+
# TSan run is enough to catch a real data race.
|
|
31
|
+
- os: macos-14
|
|
32
|
+
preset: tsan
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
|
|
36
|
+
- name: Configure
|
|
37
|
+
run: |
|
|
38
|
+
case "${{ matrix.preset }}" in
|
|
39
|
+
release) EXTRA="-DCMAKE_BUILD_TYPE=Release" ;;
|
|
40
|
+
asan) EXTRA="-DCMAKE_BUILD_TYPE=Debug -DOCL_ENABLE_ASAN=ON" ;;
|
|
41
|
+
tsan) EXTRA="-DCMAKE_BUILD_TYPE=Debug -DOCL_ENABLE_TSAN=ON" ;;
|
|
42
|
+
esac
|
|
43
|
+
cmake -S . -B build -DOCL_ENABLE_CUDA=OFF -DOCL_WERROR=ON $EXTRA
|
|
44
|
+
|
|
45
|
+
- name: Build
|
|
46
|
+
run: cmake --build build -j
|
|
47
|
+
|
|
48
|
+
- name: Test
|
|
49
|
+
working-directory: build
|
|
50
|
+
# The stress and thread tests dominate the runtime under a sanitizer, so
|
|
51
|
+
# the timeout is generous rather than tight.
|
|
52
|
+
run: ctest --output-on-failure --timeout 900
|
|
53
|
+
|
|
54
|
+
# A configure-only check that the CUDA sources still compile as C. It cannot
|
|
55
|
+
# link or run without a driver, but it catches the common breakage where a
|
|
56
|
+
# host-side change to provider.h invalidates the VMM or runtime backend and
|
|
57
|
+
# nobody notices until the next trip to the GPU box.
|
|
58
|
+
cuda-compile:
|
|
59
|
+
name: cuda backends compile
|
|
60
|
+
runs-on: ubuntu-24.04
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- uses: Jimver/cuda-toolkit@v0.2.19
|
|
65
|
+
id: cuda
|
|
66
|
+
with:
|
|
67
|
+
cuda: '12.5.0'
|
|
68
|
+
method: network
|
|
69
|
+
sub-packages: '["nvcc", "cudart", "cuda-driver-dev"]'
|
|
70
|
+
|
|
71
|
+
- name: Configure and build
|
|
72
|
+
run: |
|
|
73
|
+
cmake -S . -B build-cuda \
|
|
74
|
+
-DOCL_ENABLE_CUDA=ON -DOCL_ENABLE_TESTS=OFF \
|
|
75
|
+
-DCMAKE_CUDA_ARCHITECTURES=80
|
|
76
|
+
cmake --build build-cuda -j
|
|
77
|
+
|
|
78
|
+
figures:
|
|
79
|
+
name: figures regenerate from raw data
|
|
80
|
+
runs-on: ubuntu-24.04
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
|
|
84
|
+
- uses: actions/setup-python@v5
|
|
85
|
+
with:
|
|
86
|
+
python-version: '3.12'
|
|
87
|
+
cache: pip
|
|
88
|
+
|
|
89
|
+
- name: Install pinned analysis dependencies
|
|
90
|
+
run: pip install -r analysis/requirements.txt
|
|
91
|
+
|
|
92
|
+
# The rule the project enforces from day one is that no number in the
|
|
93
|
+
# paper is hand-made. This job is what makes that rule verifiable: it
|
|
94
|
+
# rebuilds every figure and table from the committed CSVs and fails if any
|
|
95
|
+
# script cannot reproduce its output. It deliberately does not assert that
|
|
96
|
+
# the bytes match the committed figures: the table headers carry the git
|
|
97
|
+
# revision, and PDF output is only reproducible within one matplotlib and
|
|
98
|
+
# platform combination, so a byte check would fail for reasons that have
|
|
99
|
+
# nothing to do with the results.
|
|
100
|
+
- name: Regenerate every figure and table
|
|
101
|
+
run: python analysis/make_all.py --results dev --keep-going
|
|
102
|
+
|
|
103
|
+
- name: Report which figures changed
|
|
104
|
+
if: always()
|
|
105
|
+
run: git diff --stat -- paper/figures paper/tables || true
|
|
106
|
+
|
|
107
|
+
- uses: actions/upload-artifact@v4
|
|
108
|
+
if: always()
|
|
109
|
+
with:
|
|
110
|
+
name: figures
|
|
111
|
+
path: |
|
|
112
|
+
paper/figures
|
|
113
|
+
paper/tables
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: pypi
|
|
2
|
+
|
|
3
|
+
# Source distribution only. Never upload a Mac/Linux wheel from CI: CUDA
|
|
4
|
+
# wheels have to be built on the OS that will run them.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
sdist:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
|
|
24
|
+
- name: Build sdist
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install -U pip build
|
|
27
|
+
python -m build --sdist
|
|
28
|
+
test -z "$(find dist -name '*.whl')"
|
|
29
|
+
ls -l dist
|
|
30
|
+
|
|
31
|
+
- uses: actions/upload-artifact@v4
|
|
32
|
+
with:
|
|
33
|
+
name: sdist
|
|
34
|
+
path: dist/*.tar.gz
|
|
35
|
+
|
|
36
|
+
- name: Publish to PyPI
|
|
37
|
+
if: github.event_name == 'release'
|
|
38
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
build/
|
|
2
|
+
build-*/
|
|
3
|
+
*.o
|
|
4
|
+
*.a
|
|
5
|
+
*.so
|
|
6
|
+
*.so.*
|
|
7
|
+
*.dylib
|
|
8
|
+
.DS_Store
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.pyc
|
|
11
|
+
.venv/
|
|
12
|
+
dist/
|
|
13
|
+
_skbuild/
|
|
14
|
+
*.egg-info/
|
|
15
|
+
python/*.egg-info/
|
|
16
|
+
analysis/.cache/
|
|
17
|
+
|
|
18
|
+
# Raw measurement output. results/dev is checked in because the paper's
|
|
19
|
+
# CI-reproducible figures are regenerated from it; everything else is
|
|
20
|
+
# machine-specific and is fetched from the GPU box on demand.
|
|
21
|
+
results/*
|
|
22
|
+
!results/dev/
|
|
23
|
+
paper/*.aux
|
|
24
|
+
paper/*.log
|
|
25
|
+
paper/*.out
|
|
26
|
+
paper/*.bbl
|
|
27
|
+
paper/*.blg
|
|
28
|
+
paper/*.pdf
|
|
29
|
+
!paper/opencuda-lab.pdf
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.20)
|
|
2
|
+
project(opencuda_lab VERSION 0.1.0 LANGUAGES C)
|
|
3
|
+
|
|
4
|
+
set(CMAKE_C_STANDARD 11)
|
|
5
|
+
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
6
|
+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
7
|
+
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
|
|
8
|
+
endif()
|
|
9
|
+
|
|
10
|
+
option(OCL_ENABLE_CUDA "Build the CUDA runtime and VMM backends, tools and benchmarks" OFF)
|
|
11
|
+
option(OCL_ENABLE_TESTS "Build the test suite" ON)
|
|
12
|
+
option(OCL_BUILD_APPS "Build replay drivers, quickstart and CUDA tools" ON)
|
|
13
|
+
option(OCL_ENABLE_ASAN "Build with address and undefined-behaviour sanitizers" OFF)
|
|
14
|
+
option(OCL_ENABLE_TSAN "Build with the thread sanitizer" OFF)
|
|
15
|
+
option(OCL_WERROR "Treat warnings as errors" ON)
|
|
16
|
+
|
|
17
|
+
if(DEFINED SKBUILD)
|
|
18
|
+
set(OCL_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
|
|
19
|
+
set(OCL_BUILD_APPS OFF CACHE BOOL "" FORCE)
|
|
20
|
+
set(OCL_WERROR OFF CACHE BOOL "" FORCE)
|
|
21
|
+
# pip install: use CUDA backends when nvcc is present. Set OCL_FORCE_MOCK=1
|
|
22
|
+
# to keep the host mock on a machine that also has a toolkit.
|
|
23
|
+
if(NOT DEFINED ENV{OCL_FORCE_MOCK})
|
|
24
|
+
include(CheckLanguage)
|
|
25
|
+
check_language(CUDA)
|
|
26
|
+
if(CMAKE_CUDA_COMPILER)
|
|
27
|
+
set(OCL_ENABLE_CUDA ON)
|
|
28
|
+
message(STATUS "CUDA compiler found; pip package will include GPU backends")
|
|
29
|
+
endif()
|
|
30
|
+
endif()
|
|
31
|
+
endif()
|
|
32
|
+
|
|
33
|
+
# CUDA is optional so the allocator core, planner, estimator, calibrator and the
|
|
34
|
+
# whole test suite can be developed and validated on machines without a GPU.
|
|
35
|
+
if(OCL_ENABLE_CUDA)
|
|
36
|
+
include(CheckLanguage)
|
|
37
|
+
check_language(CUDA)
|
|
38
|
+
if(CMAKE_CUDA_COMPILER)
|
|
39
|
+
enable_language(CUDA)
|
|
40
|
+
set(CMAKE_CUDA_STANDARD 14)
|
|
41
|
+
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
|
42
|
+
set(CMAKE_CUDA_ARCHITECTURES 70 75 80 86 89 90)
|
|
43
|
+
endif()
|
|
44
|
+
find_package(CUDAToolkit REQUIRED)
|
|
45
|
+
set(OCL_HAVE_CUDA TRUE)
|
|
46
|
+
else()
|
|
47
|
+
message(WARNING "OCL_ENABLE_CUDA requested but no CUDA compiler was found; "
|
|
48
|
+
"building the host-only configuration")
|
|
49
|
+
set(OCL_HAVE_CUDA FALSE)
|
|
50
|
+
endif()
|
|
51
|
+
else()
|
|
52
|
+
set(OCL_HAVE_CUDA FALSE)
|
|
53
|
+
endif()
|
|
54
|
+
|
|
55
|
+
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
56
|
+
|
|
57
|
+
add_library(ocl_flags INTERFACE)
|
|
58
|
+
if(MSVC)
|
|
59
|
+
target_compile_options(ocl_flags INTERFACE
|
|
60
|
+
$<$<COMPILE_LANGUAGE:C>:/W3 /wd4996>)
|
|
61
|
+
if(OCL_WERROR)
|
|
62
|
+
target_compile_options(ocl_flags INTERFACE $<$<COMPILE_LANGUAGE:C>:/WX>)
|
|
63
|
+
endif()
|
|
64
|
+
else()
|
|
65
|
+
target_compile_options(ocl_flags INTERFACE
|
|
66
|
+
$<$<COMPILE_LANGUAGE:C>:-Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual>)
|
|
67
|
+
if(OCL_WERROR)
|
|
68
|
+
target_compile_options(ocl_flags INTERFACE $<$<COMPILE_LANGUAGE:C>:-Werror>)
|
|
69
|
+
endif()
|
|
70
|
+
endif()
|
|
71
|
+
if(OCL_ENABLE_ASAN AND NOT MSVC)
|
|
72
|
+
target_compile_options(ocl_flags INTERFACE -fsanitize=address,undefined -fno-omit-frame-pointer -g)
|
|
73
|
+
target_link_options(ocl_flags INTERFACE -fsanitize=address,undefined)
|
|
74
|
+
endif()
|
|
75
|
+
if(OCL_ENABLE_TSAN AND NOT MSVC)
|
|
76
|
+
target_compile_options(ocl_flags INTERFACE -fsanitize=thread -g)
|
|
77
|
+
target_link_options(ocl_flags INTERFACE -fsanitize=thread)
|
|
78
|
+
endif()
|
|
79
|
+
|
|
80
|
+
set(OCL_SOURCES
|
|
81
|
+
src/core/runtime.c
|
|
82
|
+
src/core/allocator.c
|
|
83
|
+
src/core/planner.c
|
|
84
|
+
src/core/util.c
|
|
85
|
+
src/core/ocl_vm.c
|
|
86
|
+
src/estimator/estimator.c
|
|
87
|
+
src/estimator/conformal.c
|
|
88
|
+
src/telemetry/telemetry.c
|
|
89
|
+
src/backend/mock/provider_mock.c
|
|
90
|
+
src/interop/pytorch_alloc.c)
|
|
91
|
+
|
|
92
|
+
if(OCL_HAVE_CUDA)
|
|
93
|
+
list(APPEND OCL_SOURCES
|
|
94
|
+
src/backend/runtime/provider_runtime.c
|
|
95
|
+
src/backend/vmm/provider_vmm.c)
|
|
96
|
+
endif()
|
|
97
|
+
|
|
98
|
+
add_library(opencuda SHARED ${OCL_SOURCES})
|
|
99
|
+
add_library(opencuda_static STATIC ${OCL_SOURCES})
|
|
100
|
+
|
|
101
|
+
foreach(tgt opencuda opencuda_static)
|
|
102
|
+
target_include_directories(${tgt} PUBLIC
|
|
103
|
+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
104
|
+
$<INSTALL_INTERFACE:include>)
|
|
105
|
+
target_include_directories(${tgt} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
106
|
+
target_link_libraries(${tgt} PUBLIC ocl_flags)
|
|
107
|
+
find_library(OCL_LIBM m)
|
|
108
|
+
if(OCL_LIBM)
|
|
109
|
+
target_link_libraries(${tgt} PUBLIC ${OCL_LIBM})
|
|
110
|
+
endif()
|
|
111
|
+
find_package(Threads REQUIRED)
|
|
112
|
+
target_link_libraries(${tgt} PUBLIC Threads::Threads)
|
|
113
|
+
if(OCL_HAVE_CUDA)
|
|
114
|
+
target_compile_definitions(${tgt} PUBLIC OCL_WITH_CUDA=1)
|
|
115
|
+
target_link_libraries(${tgt} PUBLIC CUDA::cudart CUDA::cuda_driver)
|
|
116
|
+
endif()
|
|
117
|
+
endforeach()
|
|
118
|
+
|
|
119
|
+
set_target_properties(opencuda PROPERTIES
|
|
120
|
+
OUTPUT_NAME opencuda VERSION ${PROJECT_VERSION} SOVERSION 0)
|
|
121
|
+
set_target_properties(opencuda_static PROPERTIES OUTPUT_NAME opencuda_static)
|
|
122
|
+
|
|
123
|
+
# ------------------------------------------------------- benchmark support --
|
|
124
|
+
if(OCL_BUILD_APPS)
|
|
125
|
+
# The workload generators are shared by the host-only replay driver and the CUDA
|
|
126
|
+
# drivers, so that a result produced in CI and one produced on the GPU box refer
|
|
127
|
+
# to the same allocation sequence.
|
|
128
|
+
add_library(ocl_bench STATIC
|
|
129
|
+
bench/workloads/workloads.c
|
|
130
|
+
bench/baselines/baselines.c)
|
|
131
|
+
target_include_directories(ocl_bench PUBLIC
|
|
132
|
+
${CMAKE_CURRENT_SOURCE_DIR}/bench/workloads
|
|
133
|
+
${CMAKE_CURRENT_SOURCE_DIR}/bench/baselines)
|
|
134
|
+
target_link_libraries(ocl_bench PUBLIC opencuda_static)
|
|
135
|
+
|
|
136
|
+
add_executable(ocl_replay bench/replay/replay.c)
|
|
137
|
+
target_link_libraries(ocl_replay PRIVATE ocl_bench)
|
|
138
|
+
target_include_directories(ocl_replay PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
139
|
+
|
|
140
|
+
add_executable(ocl_calibrate experiments/drivers/calibrate.c)
|
|
141
|
+
target_link_libraries(ocl_calibrate PRIVATE ocl_bench)
|
|
142
|
+
target_include_directories(ocl_calibrate PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
143
|
+
|
|
144
|
+
add_executable(ocl_admission experiments/drivers/admission.c)
|
|
145
|
+
target_link_libraries(ocl_admission PRIVATE ocl_bench)
|
|
146
|
+
target_include_directories(ocl_admission PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
147
|
+
|
|
148
|
+
add_executable(ocl_capacity experiments/drivers/capacity.c)
|
|
149
|
+
target_link_libraries(ocl_capacity PRIVATE ocl_bench)
|
|
150
|
+
target_include_directories(ocl_capacity PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
151
|
+
|
|
152
|
+
add_executable(ocl_baselines experiments/drivers/baselines.c)
|
|
153
|
+
target_link_libraries(ocl_baselines PRIVATE ocl_bench)
|
|
154
|
+
target_include_directories(ocl_baselines PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
155
|
+
|
|
156
|
+
add_executable(ocl_multitenant experiments/drivers/multitenant.c)
|
|
157
|
+
target_link_libraries(ocl_multitenant PRIVATE ocl_bench)
|
|
158
|
+
target_include_directories(ocl_multitenant PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
159
|
+
|
|
160
|
+
# The README's usage example, built and run so that a rename in the public
|
|
161
|
+
# header cannot leave documentation that no longer compiles.
|
|
162
|
+
add_executable(ocl_quickstart examples/quickstart.c)
|
|
163
|
+
target_link_libraries(ocl_quickstart PRIVATE opencuda_static)
|
|
164
|
+
|
|
165
|
+
if(OCL_HAVE_CUDA)
|
|
166
|
+
add_executable(ocl_probe tools/ocl_probe.cu)
|
|
167
|
+
target_link_libraries(ocl_probe PRIVATE CUDA::cudart CUDA::cuda_driver)
|
|
168
|
+
|
|
169
|
+
add_executable(ocl_micro tools/ocl_micro.cu)
|
|
170
|
+
target_link_libraries(ocl_micro PRIVATE CUDA::cudart CUDA::cuda_driver)
|
|
171
|
+
|
|
172
|
+
add_executable(ocl_gap tools/ocl_gap.cu)
|
|
173
|
+
target_link_libraries(ocl_gap PRIVATE ocl_bench CUDA::cudart CUDA::cuda_driver)
|
|
174
|
+
target_include_directories(ocl_gap PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
175
|
+
|
|
176
|
+
add_executable(ocl_kernels bench/kernels/kernels.cu)
|
|
177
|
+
target_link_libraries(ocl_kernels PRIVATE ocl_bench CUDA::cudart CUDA::cuda_driver)
|
|
178
|
+
target_include_directories(ocl_kernels PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
179
|
+
endif()
|
|
180
|
+
endif() # OCL_BUILD_APPS
|
|
181
|
+
|
|
182
|
+
# ------------------------------------------------------------------- tests --
|
|
183
|
+
if(OCL_ENABLE_TESTS)
|
|
184
|
+
enable_testing()
|
|
185
|
+
set(OCL_TESTS
|
|
186
|
+
test_allocator
|
|
187
|
+
test_realloc
|
|
188
|
+
test_planner
|
|
189
|
+
test_estimator
|
|
190
|
+
test_conformal
|
|
191
|
+
test_admission
|
|
192
|
+
test_telemetry
|
|
193
|
+
test_stress
|
|
194
|
+
test_threads
|
|
195
|
+
test_pytorch_alloc)
|
|
196
|
+
if(OCL_BUILD_APPS)
|
|
197
|
+
list(APPEND OCL_TESTS test_baselines)
|
|
198
|
+
endif()
|
|
199
|
+
foreach(t ${OCL_TESTS})
|
|
200
|
+
add_executable(${t} tests/${t}.c)
|
|
201
|
+
target_link_libraries(${t} PRIVATE opencuda_static)
|
|
202
|
+
target_include_directories(${t} PRIVATE
|
|
203
|
+
${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/tests)
|
|
204
|
+
add_test(NAME ${t} COMMAND ${t})
|
|
205
|
+
endforeach()
|
|
206
|
+
if(OCL_BUILD_APPS)
|
|
207
|
+
add_test(NAME quickstart COMMAND ocl_quickstart)
|
|
208
|
+
target_link_libraries(test_baselines PRIVATE ocl_bench)
|
|
209
|
+
endif()
|
|
210
|
+
endif()
|
|
211
|
+
|
|
212
|
+
if(DEFINED SKBUILD)
|
|
213
|
+
install(TARGETS opencuda
|
|
214
|
+
RUNTIME DESTINATION opencudalab
|
|
215
|
+
LIBRARY DESTINATION opencudalab
|
|
216
|
+
ARCHIVE DESTINATION opencudalab)
|
|
217
|
+
install(FILES examples/python/resnet_cifar10.py DESTINATION opencudalab)
|
|
218
|
+
else()
|
|
219
|
+
install(TARGETS opencuda opencuda_static
|
|
220
|
+
RUNTIME DESTINATION bin
|
|
221
|
+
LIBRARY DESTINATION lib
|
|
222
|
+
ARCHIVE DESTINATION lib)
|
|
223
|
+
install(DIRECTORY include/ DESTINATION include)
|
|
224
|
+
|
|
225
|
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/opencuda.pc.in
|
|
226
|
+
${CMAKE_CURRENT_BINARY_DIR}/opencuda.pc @ONLY)
|
|
227
|
+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/opencuda.pc
|
|
228
|
+
DESTINATION lib/pkgconfig)
|
|
229
|
+
endif()
|
|
230
|
+
|
|
231
|
+
message(STATUS "OpenCUDA-Lab ${PROJECT_VERSION}")
|
|
232
|
+
message(STATUS " CUDA backends : ${OCL_HAVE_CUDA}")
|
|
233
|
+
message(STATUS " tests : ${OCL_ENABLE_TESTS}")
|
|
234
|
+
message(STATUS " apps : ${OCL_BUILD_APPS}")
|
|
235
|
+
message(STATUS " asan/ubsan : ${OCL_ENABLE_ASAN}")
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: opencudalab
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Risk-calibrated GPU memory runtime (libopencuda) with Python bindings
|
|
5
|
+
Keywords: cuda,gpu,memory,allocator,conformal
|
|
6
|
+
Author: OpenCUDA-Lab
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Science/Research
|
|
9
|
+
Classifier: Programming Language :: C
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering
|
|
12
|
+
Project-URL: Homepage, https://pypi.org/project/opencudalab/
|
|
13
|
+
Requires-Python: >=3.9
|
|
14
|
+
Provides-Extra: vision
|
|
15
|
+
Requires-Dist: torch>=2.1; extra == "vision"
|
|
16
|
+
Requires-Dist: torchvision>=0.16; extra == "vision"
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Install OpenCUDA-Lab 0.1 (exportable preview)
|
|
20
|
+
|
|
21
|
+
This is **not** a frozen production ABI (`SOVERSION` is still 0).
|
|
22
|
+
|
|
23
|
+
The PyPI package is a **source distribution**. `pip install opencudalab`
|
|
24
|
+
compiles `libopencuda` on *that* machine. A Mac wheel is never the CUDA
|
|
25
|
+
artifact.
|
|
26
|
+
|
|
27
|
+
## pip (the real export)
|
|
28
|
+
|
|
29
|
+
On a Windows/Linux box with NVIDIA GPU, CUDA toolkit, a C/C++ compiler, and CMake:
|
|
30
|
+
|
|
31
|
+
```bat
|
|
32
|
+
pip install opencudalab
|
|
33
|
+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
|
|
34
|
+
python -m opencudalab --compare --batches 8
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If CUDA is on `PATH` (`nvcc`), the GPU backends are built automatically.
|
|
38
|
+
Force the mock backend: `set OCL_FORCE_MOCK=1` before pip install.
|
|
39
|
+
|
|
40
|
+
Until the project is published to PyPI, the same command works from a clone:
|
|
41
|
+
|
|
42
|
+
```bat
|
|
43
|
+
pip install .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## USB tarball (no GitHub / no PyPI yet)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
./scripts/pack_v1.sh
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Copy `dist/opencudalab-0.1.0-usb.tar.gz`. Do **not** copy a Mac `.dylib`.
|
|
53
|
+
|
|
54
|
+
## Windows + NVIDIA + CUDA (friend laptop)
|
|
55
|
+
|
|
56
|
+
Needs: NVIDIA GPU, CUDA Toolkit, Visual Studio 2022 **Build Tools** (C++ workload),
|
|
57
|
+
Python 3.10+, CMake on PATH (`winget install Kitware.CMake`).
|
|
58
|
+
|
|
59
|
+
In **x64 Native Tools Command Prompt** or a terminal where `nvcc` works:
|
|
60
|
+
|
|
61
|
+
```bat
|
|
62
|
+
tar -xf opencudalab-0.1.0.tar.gz
|
|
63
|
+
cd opencudalab-0.1.0
|
|
64
|
+
|
|
65
|
+
python -m venv .venv
|
|
66
|
+
.venv\Scripts\activate
|
|
67
|
+
python -m pip install -U pip
|
|
68
|
+
|
|
69
|
+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
|
|
70
|
+
|
|
71
|
+
pip install opencudalab
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then the with-vs-without comparison:
|
|
75
|
+
|
|
76
|
+
```bat
|
|
77
|
+
python -m opencudalab --compare --batches 8
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or without pip, CMake + the example:
|
|
81
|
+
|
|
82
|
+
```bat
|
|
83
|
+
cmake -S . -B build -DOCL_ENABLE_CUDA=ON
|
|
84
|
+
cmake --build build --config Release
|
|
85
|
+
python examples/python/resnet_cifar10.py --compare --lib build\Release\opencuda.dll
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If native Windows build fights you, **WSL2 Ubuntu + CUDA on WSL** is the same
|
|
89
|
+
Linux path as the paper's GPU box:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cmake -S . -B build -DOCL_ENABLE_CUDA=ON && cmake --build build -j
|
|
93
|
+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124
|
|
94
|
+
python examples/python/resnet_cifar10.py --compare --lib build/libopencuda.so
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Look at `torch_peak_alloc_MiB` and `ocl_n_oom_actual` in the table.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## pip (Mac / Linux)
|
|
102
|
+
|
|
103
|
+
From this repo, or from PyPI after publish:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install opencudalab
|
|
107
|
+
python -c "import opencudalab; print(opencudalab.library_path())"
|
|
108
|
+
python -m opencudalab --cpu --compare --dataset synthetic
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
On this Mac that installs the mock backend (no NVIDIA GPU).
|
|
112
|
+
|
|
113
|
+
To publish the source distribution (maintainers):
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
./scripts/publish_pypi.sh # build + print upload commands
|
|
117
|
+
./scripts/publish_pypi.sh --test # TestPyPI (needs token)
|
|
118
|
+
./scripts/publish_pypi.sh --upload # PyPI (needs token)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Homebrew (macOS, mock backend only)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
brew install cmake
|
|
127
|
+
./scripts/pack_v1.sh
|
|
128
|
+
brew install --build-from-source ./packaging/homebrew/opencudalab.rb
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## C / pkg-config
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
|
137
|
+
cmake --build build -j
|
|
138
|
+
cmake --install build --prefix /usr/local
|
|
139
|
+
pkg-config --libs --cflags opencuda
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Java (JNA, same DLL/.so/.dylib)
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
cd bindings/java
|
|
148
|
+
mvn -q package
|
|
149
|
+
# Windows: put opencuda.dll on PATH or java.library.path
|
|
150
|
+
mvn -q exec:java
|
|
151
|
+
```
|