OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
Caches
OpenVINO uses caches to accelerate builds and tests while minimizing network usage.
Table of Contents
Available Caches
Three types of caches are available:
- GitHub Actions cache
- Available for both GitHub-hosted and self-hosted runners.
- Accessible by
actions/cacheaction. - Limited to 10 GB per repository.
- Suitable for small dependencies caches and reusable artifacts.
- Shared drive cache
- Available only to self-hosted runners.
- Automatically available via a predefined path.
- Large storage.
- Suitable for large caches, such as build caches, models, and datasets.
- Cloud storage via Azure Blob Storage
- Available only to self-hosted runners.
- Used to cache and share build artifacts with
sccache.
Jobs in the workflows utilize these caches based on their requirements.
GitHub Actions Cache
This cache is used for sharing small dependencies or artifacts between runs. Refer to the GitHub Actions official documentation for a complete reference.
The CPU functional tests job in the ubuntu_22.yml
workflow uses this cache for sharing test execution time to speed up the subsequent runs.
First, the artifacts are saved with actions/cache/save with a particular
key ${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp-${{ github.sha }}:
CPU_Functional_Tests:
name: CPU functional tests
...
steps:
- name: Save tests execution time
uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: github.ref_name == 'master'
with:
path: ${{ env.PARALLEL_TEST_CACHE }}
key: ${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp-${{ github.sha }}
...
Then it appears in the repository's cache:

The following runs can download the artifact from the repository's cache with actions/cache/restore
and use it:
CPU_Functional_Tests:
name: CPU functional tests
...
steps:
- name: Restore tests execution time
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ env.PARALLEL_TEST_CACHE }}
key: ${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-tests-functional-cpu-stamp
...
The restore-keys key is used to find the required cache entry. actions/cache searches for
a full or partial match and downloads the located cache to the provided path.
Refer to the actions/cache documentation for a complete syntax reference.
Shared Drive Cache
This cache is used to store dependencies and large assets, such as models and datasets, that will be used by different workflow jobs.
NOTE: This cache is enabled for Linux self-hosted runners only.
The drive is available on self-hosted machines. To make it available inside Docker containers,
add the mounting point under the container's volumes key in a job configuration:
Build:
...
needs: Docker
runs-on: <self-hosted runner>
container:
image: ${{ fromJSON(needs.docker.outputs.images).ov_build.<image> }}
volumes:
- <shared drive path>:<shared drive path>
- <secrets path on runner>:/secrets:ro
options: -e SCCACHE_AZURE_BLOB_CONTAINER
steps:
- name: Append the environment variable - load SCCACHE_AZURE_CONNECTION_STRING from file
shell: bash
run: |
SCCACHE_AZURE_CONNECTION_STRING="$(cat /secrets/sccache/connection-string)"
echo "::add-mask::${SCCACHE_AZURE_CONNECTION_STRING}"
echo "SCCACHE_AZURE_CONNECTION_STRING=${SCCACHE_AZURE_CONNECTION_STRING}" >> $GITHUB_ENV
echo "✓ Connection string loaded and masked"
...
In - <shared drive path>:<shared drive path>, the first path is the location of the shared drive
on the runner, the second one is the path in the Docker container where the resources will be
available. Use the same mount point as the existing workflows for the target runner.
Available Resources
pipcache- Accessible via the
PIP_CACHE_PATHenvironment variable, defined at the workflow level - Used in jobs that involve Python usage
- Accessible via the
- onnx models for tests
- Stored in a dedicated folder on the shared drive
- Used in the
ONNX Models testsjob in theubuntu_22.ymlworkflow
- Linux RISC-V with Conan build artifacts
- Used in the
linux_riscv.ymlworkflow
- Used in the
To add new resources, contact a member of the CI team for assistance.
Remote Storage Compiler Cache
Builds can share compiled objects through ccache's remote storage on the shared drive
by setting CCACHE_SECONDARY_STORAGE (or CCACHE_REMOTE_STORAGE on newer ccache) to a
file:// URL. Each build configuration uses its own directory inside the shared storage.
Users:
- The RISC-V GNU and Conan builds in
linux_riscv.ymlandlinux_riscv_conan.yml. - The Windows builds in
job_build_windows.ymlandwindows_conditional_compilation.yml.
ccache cannot cache MSVC compilations with a separate PDB (/Zi), so the Windows Debug build
sets -DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded (/Z7), which stores debug information
in object files. Builds with embedded debug information link without /INCREMENTAL, which keeps
PDB files free of stale incremental-link data. See ENABLE_STATIC_LIBS_PDB in
CMake options for custom compilation for how
static libraries are handled.
CCACHE_MAXSIZE limits only the local cache. The remote storage is trimmed periodically by the
Cleanup_remote_ccache_* jobs in
cleanup_caches.yml with
ccache --trim-dir --trim-method mtime (ccache 4.8 or newer), which evicts the least recently used
entries down to CCACHE_REMOTE_MAX_SIZE. Builds must keep update-mtime=true in the remote storage
URL so that cache hits refresh the modification time used for eviction.
Cloud Storage via Azure Blob Storage
This cache is used for sharing OpenVINO build artifacts between runs.
The sccache tool can cache, upload and download build files to/from Azure Blob Storage.
NOTE: This cache is enabled for self-hosted runners only.
sccache requires several configurations to work:
- Installation. Refer to the sccache installation section.
- Credential environment variables:
SCCACHE_AZURE_BLOB_CONTAINER,SCCACHE_AZURE_CONNECTION_STRING- The variables are already set up on the self-hosted runners.
- The variables can be passed to a Docker container via the
optionskey under thecontainerkey.
SCCACHE_AZURE_KEY_PREFIXenvironment variable to specify the folder where the cache for the current OS/architecture will be saved.CMAKE_CXX_COMPILER_LAUNCHERandCMAKE_C_COMPILER_LAUNCHERenvironment variables to enablesccachefor caching C++/C build files
sccache Installation
The installation is done via the community-provided mozilla-actions/sccache-action action:
- name: Install sccache
uses: mozilla-actions/[email protected]
with:
version: "v0.5.4"
This step must be placed in the workflow before the build step.
Passing Credential Environment Variables
The SCCACHE_AZURE_BLOB_CONTAINER and SCCACHE_AZURE_CONNECTION_STRING variables must be
set in the environment to enable sccache communication with Azure Blob Storage.
These variables are already set in the environment for jobs on self-hosted runners without a Docker container, requiring no further actions.
If a job needs a Docker container, pass the variables via the options
key under the container key to make them accessible for sccache inside the container:
Build:
...
needs: Docker
runs-on: <self-hosted runner>
container:
image: ${{ fromJSON(needs.docker.outputs.images).ov_build.<image> }}
volumes:
- <shared drive path>:<shared drive path>
- <secrets path on runner>:/secrets:ro
options: -e SCCACHE_AZURE_BLOB_CONTAINER
steps:
- name: Append the environment variable - load SCCACHE_AZURE_CONNECTION_STRING from file
shell: bash
run: |
SCCACHE_AZURE_CONNECTION_STRING="$(cat /secrets/sccache/connection-string)"
echo "::add-mask::${SCCACHE_AZURE_CONNECTION_STRING}"
echo "SCCACHE_AZURE_CONNECTION_STRING=${SCCACHE_AZURE_CONNECTION_STRING}" >> $GITHUB_ENV
echo "✓ Connection string loaded and masked"
...
Providing sccache Prefix
The folder on the remote storage where the cache for the OS/architecture will be saved is
provided via the SCCACHE_AZURE_KEY_PREFIX environment variable under the job's env key:
Build:
...
env:
...
CMAKE_CXX_COMPILER_LAUNCHER: sccache
CMAKE_C_COMPILER_LAUNCHER: sccache
...
SCCACHE_AZURE_KEY_PREFIX: ${{ inputs.os }}_${{ inputs.arch }}_Release
Enabling sccache for C++/C Files
To instruct CMake to use the caching tool, set the CMAKE_CXX_COMPILER_LAUNCHER
and CMAKE_C_COMPILER_LAUNCHER environment variables under the job's env key:
Build:
...
env:
...
CMAKE_CXX_COMPILER_LAUNCHER: sccache
CMAKE_C_COMPILER_LAUNCHER: sccache
...
SCCACHE_AZURE_KEY_PREFIX: ${{ inputs.os }}_${{ inputs.arch }}_Release
You can also set the options in the CMake configuration command.