Skip to content

Commit 503d8f4

Browse files
jeongseok-metafacebook-github-bot
authored andcommitted
Add CUDA environments for pixi (#86)
Summary: This PR adds multiple environments (by modifying `pixi.toml`) for CPU and GPU environments. Depending on the environment, pymomentum is built with PyTorch with or without CUDA support. The environment can be set by passing the `-e <env>` option when running pixi tasks. For example, `pixi run -e cpu build_pymomentum` builds without CUDA support while `pixi run -e gpu build_pymomentum` builds with CUDA support. If no `-e` option is passed, the default environment is used, which is `cpu`. To see all available environments, run `pixi info`. Also, this update includes changes to CMake to find torch packages for any Python versions. ## Checklist: - [x] Adheres to the [style guidelines](https://facebookincubator.github.io/momentum/docs/developer_guide/style_guide) - [x] Codebase formatted by running `pixi run lint` Pull Request resolved: #86 Test Plan: CI for CPU has been set up. However, the GPU CI setup is not yet complete as I have not figured out how to do it. I am seeking help from the Pixi community. The GPU environment has been tested locally instead. Reviewed By: EscapeZero Differential Revision: D63299584 Pulled By: jeongseok-meta fbshipit-source-id: 18e583047d7e2d87f3fbb4af34fd835b76557c7c
1 parent 59a893f commit 503d8f4

File tree

4 files changed

+8597
-2034
lines changed

4 files changed

+8597
-2034
lines changed

.github/workflows/ci_ubuntu.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,49 @@ jobs:
3636
pixi run cmake --build momentum/examples/hello_world/build
3737
3838
pymomentum:
39-
name: pymomentum-ubuntu
39+
name: pymomentum-${{ matrix.pixi_env }}-ubuntu
4040
runs-on: ubuntu-latest
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
pixi_env: ["cpu"] # TODO: Add gpu
4145
steps:
46+
- name: Maximize build space
47+
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
48+
uses: easimon/maximize-build-space@master
49+
with:
50+
root-reserve-mb: 32768
51+
remove-dotnet: true
52+
remove-android: true
53+
remove-haskell: true
54+
remove-codeql: true
55+
remove-docker-images: true
56+
4257
- name: Checkout
4358
uses: actions/checkout@v4
59+
60+
- name: Install CUDA Toolkit
61+
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
62+
uses: Jimver/cuda-toolkit@v0.2.17
63+
id: cuda-toolkit
64+
with:
65+
cuda: "12.0.1"
66+
67+
- name: Check CUDA Version
68+
if: ${{ contains(matrix.pixi_env, 'cuda') || contains(matrix.pixi_env, 'gpu') }}
69+
run: |
70+
nvcc --version
71+
4472
- name: Set up pixi
4573
uses: prefix-dev/setup-pixi@v0.8.1
4674
with:
75+
environments: ${{ matrix.pixi_env }}
4776
cache: true
77+
78+
- name: Check pixi environments
79+
run: |
80+
pixi info
81+
4882
- name: Build PyMomentum
4983
run: |
50-
pixi run test_pymomentum
84+
pixi run -e ${{ matrix.pixi_env }} test_pymomentum

0 commit comments

Comments
 (0)