Repository navigation
Reimplement dpnp.random.RandomState on the device RNG
#3296
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: Test oneAPI Math Library (oneMath) | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| # Nightly run of the oneMath develop branch job: its failures are upstream's, not a PR's | |
| schedule: | |
| - cron: '17 3 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # Cancel superseded PR runs only; other runs get a unique group and always complete | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| # Pinned: Miniforge3 26.9.4-0 fails 'conda init' on Windows runners | |
| miniforge-version: '26.7.2-1' | |
| environment-file: 'environments/environment.yml' | |
| environment-file-name: 'environment.yml' | |
| environment-file-loc: '${{ github.workspace }}/environments' | |
| build-with-oneapi-env: 'environments/build_with_oneapi.yml' | |
| dpctl-pkg-env: 'environments/dpctl_pkg.yml' | |
| oneapi-pkgs-env: 'environments/oneapi_pkgs.yml' | |
| python-pkg-env: 'environments/python.yml' | |
| test-pkg-env: 'environments/test.yml' | |
| test-env-name: 'test_onemath' | |
| rerun-tests-on-failure: 'true' | |
| rerun-tests-max-attempts: 2 | |
| rerun-tests-timeout: 30 | |
| rerun-tensor-tests-timeout: 10 | |
| rerun-tensor-tests-max-attempts: 3 | |
| # Per-test limit to kill a test stuck at 99%: https://github.com/IntelPython/dpctl/issues/1954 | |
| # The thread method exits the process, so -n is needed for xdist to replace the worker | |
| tensor-test-timeout: 120 | |
| jobs: | |
| build_env_file: | |
| name: Build conda env file | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.14'] | |
| python_spec: ['3.14.* *_cp314', '3.14.* *_cp314t'] | |
| runs-on: 'ubuntu-latest' | |
| timeout-minutes: 5 | |
| env: | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| python-install-spec: "python ${{ matrix.python_spec || format('{0}.*', matrix.python) }}" | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| # Blobless: all commits and tags for git describe, no gh-pages blobs | |
| filter: blob:none | |
| - name: Install conda-merge tool | |
| uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1 | |
| with: | |
| packages: conda-merge | |
| - name: Build Python env file | |
| run: | | |
| cat > ${{ env.python-pkg-env }} <<EOF | |
| name: Python interpreter to test with | |
| channels: | |
| - conda-forge | |
| dependencies: | |
| - ${{ env.python-install-spec }} | |
| EOF | |
| - name: Merge conda env files | |
| run: | | |
| conda-merge ${{ env.dpctl-pkg-env }} \ | |
| ${{ env.oneapi-pkgs-env }} \ | |
| ${{ env.build-with-oneapi-env }} \ | |
| ${{ env.test-pkg-env }} \ | |
| ${{ env.python-pkg-env }} > ${{ env.environment-file }} | |
| cat ${{ env.environment-file }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: ${{ env.environment-file-name }}-${{ env.python-label }} | |
| path: ${{ env.environment-file }} | |
| test_by_tag: | |
| name: Run tests with OneMath tag | |
| needs: build_env_file | |
| if: github.event_name != 'schedule' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.14'] | |
| python_spec: ['3.14.* *_cp314', '3.14.* *_cp314t'] | |
| os: [ubuntu-latest] # windows-2022 - no DFT support for Windows in oneMKL | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 120 | |
| defaults: | |
| run: | |
| shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} | |
| env: | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| # Blobless: all commits and tags for git describe, no gh-pages blobs | |
| filter: blob:none | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.environment-file-name }}-${{ env.python-label }} | |
| path: ${{ env.environment-file-loc }} | |
| - name: Setup miniconda | |
| uses: ./.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.environment-file }} | |
| activate-environment: ${{ env.test-env-name }} | |
| - name: Conda info | |
| run: | | |
| mamba info | |
| mamba list | |
| - name: Build and install DPNP package | |
| run: | | |
| python scripts/build_locally.py --onemath --verbose | |
| - name: Smoke test | |
| run: | | |
| python -m dpctl -f | |
| python -c "import dpnp; print(dpnp.__version__)" | |
| - name: Run tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| run: | | |
| python -m pytest -ra --pyargs dpnp.tests | |
| env: | |
| SKIP_TENSOR_TESTS: 1 | |
| SYCL_CACHE_PERSISTENT: 1 | |
| - name: Run tensor tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| run: | | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| env: | |
| SYCL_CACHE_PERSISTENT: 1 | |
| - name: ReRun tests on Linux | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tests | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tests-max-attempts }} | |
| retry_on: any | |
| command: | | |
| . $CONDA/etc/profile.d/conda.sh | |
| . $CONDA/etc/profile.d/mamba.sh | |
| mamba activate ${{ env.test-env-name }} | |
| python -m pytest -ra --pyargs dpnp.tests | |
| env: | |
| SKIP_TENSOR_TESTS: 1 | |
| SYCL_CACHE_PERSISTENT: 1 | |
| - name: ReRun tensor tests on Linux | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tensor_tests | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tensor-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tensor-tests-max-attempts }} | |
| retry_on: any | |
| command: | | |
| . $CONDA/etc/profile.d/conda.sh | |
| . $CONDA/etc/profile.d/mamba.sh | |
| mamba activate ${{ env.test-env-name }} | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| env: | |
| SYCL_CACHE_PERSISTENT: 1 | |
| test_by_branch: | |
| name: Run tests with oneMath develop branch | |
| needs: build_env_file | |
| if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.14'] | |
| python_spec: ['3.14.* *_cp314', '3.14.* *_cp314t'] | |
| os: [ubuntu-latest] # windows-2022 - no DFT support for Windows in oneMKL | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 120 | |
| defaults: | |
| run: | |
| shell: ${{ matrix.os == 'windows-2022' && 'cmd /C CALL {0}' || 'bash -el {0}' }} | |
| env: | |
| onemath-source-dir: '${{ github.workspace }}/onemath/' | |
| python-label: ${{ endsWith(matrix.python_spec, 't') && format('{0}t', matrix.python) || matrix.python }} | |
| steps: | |
| - name: Checkout DPNP repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| # Blobless: all commits and tags for git describe, no gh-pages blobs | |
| filter: blob:none | |
| - name: Download artifact | |
| uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 | |
| with: | |
| name: ${{ env.environment-file-name }}-${{ env.python-label }} | |
| path: ${{ env.environment-file-loc }} | |
| - name: Checkout oneMath repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| repository: 'uxlfoundation/oneMath' | |
| ref: 'develop' | |
| path: ${{ env.onemath-source-dir }} | |
| fetch-depth: 0 | |
| - name: oneMath ls info | |
| run: | | |
| ls -la ${{ env.onemath-source-dir }} | |
| - name: Setup miniconda | |
| uses: ./.github/actions/setup-miniconda | |
| with: | |
| miniforge-version: ${{ env.miniforge-version }} | |
| environment-file: ${{ env.environment-file }} | |
| activate-environment: ${{ env.test-env-name }} | |
| - name: Conda info | |
| run: | | |
| mamba info | |
| mamba list | |
| - name: Build and install DPNP package | |
| run: | | |
| python scripts/build_locally.py --onemath --onemath-dir=${{ env.onemath-source-dir }} --verbose | |
| - name: Smoke test | |
| run: | | |
| python -m dpctl -f | |
| python -c "import dpnp; print(dpnp.__version__)" | |
| - name: Run tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| run: | | |
| python -m pytest -ra --pyargs dpnp.tests | |
| env: | |
| SKIP_TENSOR_TESTS: 1 | |
| SYCL_CACHE_PERSISTENT: 1 | |
| - name: Run tensor tests | |
| if: env.rerun-tests-on-failure != 'true' | |
| run: | | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| env: | |
| SYCL_CACHE_PERSISTENT: 1 | |
| - name: ReRun tests on Linux | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tests | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tests-max-attempts }} | |
| retry_on: any | |
| command: | | |
| . $CONDA/etc/profile.d/conda.sh | |
| . $CONDA/etc/profile.d/mamba.sh | |
| mamba activate ${{ env.test-env-name }} | |
| python -m pytest -ra --pyargs dpnp.tests | |
| env: | |
| SKIP_TENSOR_TESTS: 1 | |
| SYCL_CACHE_PERSISTENT: 1 | |
| - name: ReRun tensor tests on Linux | |
| if: env.rerun-tests-on-failure == 'true' | |
| id: run_tensor_tests_branch | |
| uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0 | |
| with: | |
| timeout_minutes: ${{ env.rerun-tensor-tests-timeout }} | |
| max_attempts: ${{ env.rerun-tensor-tests-max-attempts }} | |
| retry_on: any | |
| command: | | |
| . $CONDA/etc/profile.d/conda.sh | |
| . $CONDA/etc/profile.d/mamba.sh | |
| mamba activate ${{ env.test-env-name }} | |
| python -m pytest -n auto -ra --timeout=${{ env.tensor-test-timeout }} --timeout-method=thread --pyargs dpnp.tests.tensor | |
| env: | |
| SYCL_CACHE_PERSISTENT: 1 |