Skip to content

Commit

Permalink
Merge pull request #752 from ChrisCummins/py3.10
Browse files Browse the repository at this point in the history
Add Python 3.10 support.
  • Loading branch information
ChrisCummins authored Aug 16, 2022
2 parents b649577 + 628fc03 commit 1c40e5b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 34 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install build dependencies
uses: ./.github/actions/install-build-dependencies
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install build dependencies
uses: ./.github/actions/install-cmake-build-dependencies
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install build dependencies
uses: ./.github/actions/install-cmake-build-dependencies
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install build dependencies
uses: ./.github/actions/install-build-dependencies
Expand All @@ -197,7 +197,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: [3.6, 3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -234,7 +234,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.9]
python: ['3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -294,7 +294,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: [3.6, 3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -326,7 +326,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.8, 3.9]
python: [3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -363,7 +363,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: [3.6, 3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -397,7 +397,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.9]
python: ['3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -431,7 +431,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.9]
python: ['3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -472,7 +472,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- uses: actions/checkout@v2

Expand Down Expand Up @@ -505,7 +505,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Download Python wheel
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -534,7 +534,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- uses: actions/checkout@v2

Expand Down Expand Up @@ -567,7 +567,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Download Python wheel
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -595,7 +595,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.6, 3.7, 3.8, 3.9]
python: [3.6, 3.7, 3.8, 3.9, '3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -630,7 +630,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [3.9]
python: ['3.10']
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -667,7 +667,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Install build dependencies
uses: ./.github/actions/install-build-dependencies
Expand Down Expand Up @@ -700,7 +700,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- name: Download Python wheel
uses: actions/download-artifact@v2
Expand Down Expand Up @@ -753,7 +753,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'

- uses: actions/setup-node@v2
with:
Expand Down
22 changes: 13 additions & 9 deletions compiler_gym/envs/gcc/gcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import pickle
import re
import subprocess
import warnings
from functools import lru_cache
from pathlib import Path
from typing import Dict, List, NamedTuple, Optional, Union
Expand Down Expand Up @@ -222,15 +223,18 @@ def __repr__(self) -> str:
@lru_cache(maxsize=2)
def get_docker_client():
"""Fetch the docker client singleton."""
try:
return docker.from_env()
except docker.errors.DockerException as e:
raise EnvironmentNotSupported(
f"Failed to initialize docker client needed by GCC environment: {e}.\n"
"Have you installed the runtime dependencies?\n See "
"<https://facebookresearch.github.io/CompilerGym/envs/gcc.html#installation> "
"for details."
) from e
# Ignore deprecation warnings from docker.from_env().
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
try:
return docker.from_env()
except docker.errors.DockerException as e:
raise EnvironmentNotSupported(
f"Failed to initialize docker client needed by GCC environment: {e}.\n"
"Have you installed the runtime dependencies?\n See "
"<https://facebookresearch.github.io/CompilerGym/envs/gcc.html#installation> "
"for details."
) from e


# We only need to run this function once per image.
Expand Down
10 changes: 6 additions & 4 deletions examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
aioredis<2.0.0 # Pin version for ray.
dgl==0.6.1
dgl==0.9.0
geneticalgorithm>=1.0.2
hydra-core==1.1.0
keras==2.6.0
keras==2.6.0;python_version<"3.7"
keras==2.8.0;python_version>="3.7"
matplotlib>=3.3.4
nevergrad>=0.4.3
# NOTE(github.com/facebookresearch/CompilerGym/issues/750) Pin numpy version back
# as workaround for numpy.object_ use in ray 1.9.0.
numpy>=1.19.3,<1.20.0
opentuner>=0.8.5
pandas>=1.1.5
ray[default,rllib]==1.9.0
ray[default,rllib]==1.13.0
submitit>=1.2.0
submitit>=1.2.0
tensorflow==2.6.1
tensorflow==2.6.2;python_version<"3.7"
tensorflow==2.8.0;python_version>="3.7"
torch>=1.6.0
typer[all]>=0.3.2
5 changes: 4 additions & 1 deletion tests/mlir/rllib_ppo_smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def test_rllib_ppo_smoke():
"rollout_fragment_length": 2,
}
trainer = PPOTrainer(config=config)
trainer.train()
with warnings.catch_warnings():
# Ignore deprecation warnings from internal rllib implementation.
warnings.filterwarnings("ignore", category=DeprecationWarning)
trainer.train()
ray.shutdown()


Expand Down

0 comments on commit 1c40e5b

Please sign in to comment.