All libs (Release) #30
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
| name: All libs (Release) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release-number: | |
| description: 'Release Number (e.g. 0.3.0)' | |
| required: true | |
| default: '0.0.0' | |
| assets_repo: | |
| type: string | |
| description: Retrieve assets from a draft release from this repo (e.g. NVIDIA/cudaqx) | |
| required: false | |
| assets_tag: | |
| type: string | |
| description: Retrieve assets from a draft release with this tag (e.g. installed_files-1) | |
| required: false | |
| jobs: | |
| pr-build: | |
| name: Build and test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runner: [ | |
| { arch: arm64, gpu: a100 }, | |
| { arch: amd64, gpu: a100 }, | |
| ] | |
| cuda_version: ['12.6', '13.0'] | |
| runs-on: linux-${{ matrix.runner.arch }}-gpu-${{ matrix.runner.gpu }}-latest-1 | |
| container: | |
| # FIXME | |
| image: ${{ format('ghcr.io/nvidia/cudaqx-dev:{0}-{1}-cu{2}', 'latest', matrix.runner.arch, matrix.cuda_version) }} | |
| env: | |
| NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }} | |
| permissions: write-all | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main # FIXME | |
| set-safe-directory: true | |
| - name: Set git safe directory | |
| run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
| - name: Set release number | |
| id: set-release-number | |
| run: | | |
| echo "CUDAQX_QEC_VERSION=${{ inputs.release-number }}" >> $GITHUB_ENV | |
| echo "CUDAQX_SOLVERS_VERSION=${{ inputs.release-number }}" >> $GITHUB_ENV | |
| # And output to the GitHub Actions summary. | |
| echo "Setting CUDAQX_QEC_VERSION=${{ inputs.release-number }}" >> $GITHUB_STEP_SUMMARY | |
| echo "Setting CUDAQX_SOLVERS_VERSION=${{ inputs.release-number }}" >> $GITHUB_STEP_SUMMARY | |
| - name: Install dependencies | |
| run: | | |
| apt update && apt install -y --no-install-recommends zip unzip patchelf | |
| - name: Fetch assets and set QEC_EXTERNAL_DECODERS | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| id: fetch-assets | |
| run: | | |
| if [[ -n "${{ inputs.assets_repo }}" ]] && [[ -n "${{ inputs.assets_tag }}" ]]; then | |
| bash .github/workflows/scripts/install_git_cli.sh | |
| # Fetch the assets into this directory | |
| gh release download -R ${{ inputs.assets_repo }} ${{ inputs.assets_tag }} | |
| # Show what was downloaded | |
| ls | |
| # Show release info (and save to summary) | |
| gh release view -R ${{ inputs.assets_repo }} ${{ inputs.assets_tag }} >> $GITHUB_STEP_SUMMARY | |
| # Extract the decoder that needs to be embedded in the release | |
| mkdir -p tmp | |
| tar -C tmp -xzvf nv-qldpc-decoder-${{ matrix.runner.arch }}_ubuntu24.04_cuda${{ matrix.cuda_version }}_release.tar.gz | |
| echo "QEC_EXTERNAL_DECODERS=$(pwd)/tmp/libcudaq-qec-nv-qldpc-decoder.so" >> $GITHUB_ENV | |
| fi | |
| shell: bash | |
| - name: Configure | |
| id: config | |
| run: | | |
| cuda_major=`echo ${{ matrix.cuda_version }} | cut -d . -f1` | |
| echo "cuda_major=$cuda_major" >> $GITHUB_OUTPUT | |
| # ======================================================================== | |
| # Build | |
| # ======================================================================== | |
| - name: Build | |
| id: build | |
| uses: ./.github/actions/build-lib | |
| with: | |
| lib: "all" | |
| cuda_version: ${{ matrix.cuda_version }} | |
| platform: ${{ matrix.runner.arch }} | |
| install-prefix: /usr/local/cudaq | |
| - name: Save build artifacts | |
| run: | | |
| cmake --build ${{ steps.build.outputs.build-dir }} --target zip_installed_files | |
| cd ${{ steps.build.outputs.build-dir }} | |
| mv installed_files.zip installed_files-${{ matrix.runner.arch }}-cu${{ matrix.cuda_version }}.zip | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: installed_files-${{ matrix.runner.arch }}-cu${{ matrix.cuda_version }} | |
| path: ${{ steps.build.outputs.build-dir }}/installed_files-${{ matrix.runner.arch }}-cu${{ matrix.cuda_version }}.zip | |
| # ======================================================================== | |
| # Run tests | |
| # ======================================================================== | |
| # | |
| - name: Run tests | |
| run: cmake --build ${{ steps.build.outputs.build-dir }} --target run_tests | |
| # ======================================================================== | |
| # Run python tests | |
| # ======================================================================== | |
| - name: Install python requirements | |
| env: | |
| LD_LIBRARY_PATH: ${{ env.MPI_PATH }}/lib:${{ env.LD_LIBRARY_PATH }} | |
| run: pip install numpy pytest cupy-cuda${{ steps.config.outputs.cuda_major }}x cuquantum-cu${{ steps.config.outputs.cuda_major }} torch lightning ml_collections mpi4py transformers quimb opt_einsum torch | |
| - name: Run Python tests | |
| env: | |
| LD_LIBRARY_PATH: ${{ env.MPI_PATH }}/lib:${{ env.LD_LIBRARY_PATH }} | |
| OMPI_MCA_pml: ob1 | |
| run: | | |
| if [[ -n "${{ env.QEC_EXTERNAL_DECODERS }}" ]]; then | |
| # Verify that external decoder is available if applicable | |
| export PYTHONPATH="/usr/local/cudaq:$HOME/.cudaqx" | |
| python3 -c "import cudaq_qec as qec; print(qec.__version__); d = qec.get_decoder('nv-qldpc-decoder', qec.get_code('steane').get_parity()); print(d.get_version())" | |
| fi | |
| cmake --build ${{ steps.build.outputs.build-dir }} --target run_python_tests | |
| shell: bash | |
| # ======================================================================== | |
| # Run example tests | |
| # ======================================================================== | |
| - name: Run example tests | |
| env: | |
| LD_LIBRARY_PATH: ${{ env.MPI_PATH }}/lib:${{ env.LD_LIBRARY_PATH }} | |
| OMPI_MCA_pml: ob1 | |
| run: | | |
| ln -s /usr/local/cudaq /cudaq-install | |
| bash scripts/ci/test_examples.sh all | |