From f83ec22713c1c084d8b5cb099a66aace0c07e15a Mon Sep 17 00:00:00 2001 From: ccy Date: Tue, 9 Apr 2024 12:05:38 +0800 Subject: [PATCH] set up conda ci --- .github/workflows/ci.yml | 23 ++++++++++++----------- environments.yaml | 10 ++++++++++ example/torch_cifar10.py | 4 ++-- requirements.txt | 8 ++++---- 4 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 environments.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0794c2..93ee9c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,16 +62,17 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Set up Conda + uses: conda-incubator/setup-miniconda@v2 with: + auto-update-conda: true python-version: ${{ matrix.python-version }} + activate-environment: bluefoglite - name: Install BlueFogLite run: | + conda install pip python -m pip install --upgrade pip python -m pip install -r requirements.txt - python -m pip install networkx - python -c "import networkx" python -m pip install . cat tools/requirements_dev.txt | grep pytest | xargs pip install - name: Unit Test @@ -88,19 +89,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - name: Set up Conda + uses: conda-incubator/setup-miniconda@v2 with: + auto-update-conda: true python-version: ${{ matrix.python-version }} + activate-environment: bluefoglite - name: Install brew coreutils run: brew install coreutils # for timeout command - name: Install BlueFogLite run: | - python3 -m pip install --upgrade pip - python3 -m pip install -r requirements.txt - python3 -m pip install networkx - python3 -c "import networkx" - python3 -m pip install . + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + python -m pip install . cat tools/requirements_dev.txt | grep pytest | xargs pip install - name: Unit Test run: | diff --git a/environments.yaml b/environments.yaml new file mode 100644 index 0000000..0157fed --- /dev/null +++ b/environments.yaml @@ -0,0 +1,10 @@ +name: bluefoglite +channels: + - defaults +dependencies: + - torch=2.1.0 + - torchvision=0.16.0 + - torchaudio=2.1.0 + - networkx=2.8.8 + - numpy=1.24.1 + - protobuf=3.19.4 \ No newline at end of file diff --git a/example/torch_cifar10.py b/example/torch_cifar10.py index 55d40b3..d3ca8d6 100644 --- a/example/torch_cifar10.py +++ b/example/torch_cifar10.py @@ -317,7 +317,7 @@ def test(epoch): profiler.disable() # redirect to ./output_static.txt or ./output_dynamic.txt with open( - f"output/{'static' if args.disable_dynamic_topology else 'dynamic'}_np{bfl.size()}_topo{args.topology}.txt", + f"output/cp_{'static' if args.disable_dynamic_topology else 'dynamic'}_np{bfl.size()}_{args.topology}.txt", "w", ) as file: stats = pstats.Stats(profiler, stream=file).sort_stats("tottime") @@ -337,7 +337,7 @@ def test(epoch): train(0) # redirect to ./output_static.txt or ./output_dynamic.txt with open( - f"output/{'static' if args.disable_dynamic_topology else 'dynamic'}_np{bfl.size()}_topo{args.topology}.txt", + f"output/tp_{'static' if args.disable_dynamic_topology else 'dynamic'}_np{bfl.size()}_{args.topology}.txt", "w", ) as file: with contextlib.redirect_stdout(file): diff --git a/requirements.txt b/requirements.txt index 3a80c0d..4c1ac07 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -torch==2.1.0 -torchvision==0.16.0 -torchaudio==2.1.0 -networkx==2.8.8 +torch +torchvision +torchaudio +networkx<3.0 numpy==1.24.1 protobuf==3.19.4