Skip to content

Commit 2b433e0

Browse files
authored
Merge branch 'master' into feat/formatting_precommit
2 parents ac9fd1f + 03cf55f commit 2b433e0

18 files changed

Lines changed: 455 additions & 616 deletions

.github/workflows/actions.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ jobs:
4949
BUILD_SHARED_LIB: "OFF"
5050
OPEN_SPIEL_BUILD_WITH_ORTOOLS: "OFF"
5151
OPEN_SPIEL_BUILD_WITH_ORTOOLS_DOWNLOAD_URL: ""
52-
# Build and run tests with all optional dependencies, including building a
53-
# shared library with linkable third party dependencies in place.
52+
# Older Python version on Ubuntu 20.04
5453
- os: ubuntu-20.04
5554
OS_PYTHON_VERSION: "3.9"
5655
DEFAULT_OPTIONAL_DEPENDENCY: "ON"

.github/workflows/wheels.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,34 @@ jobs:
2828
strategy:
2929
matrix:
3030
include:
31-
- os: ubuntu-20.04
31+
- os: ubuntu-22.04
3232
OS_TYPE: "Linux"
3333
CI_PYBIN: python3
34+
OS_PYTHON_VERSION: 3.10
3435
CIBW_ENVIRONMENT: "CXX=$(which g++) OPEN_SPIEL_BUILDING_WHEEL='ON' OPEN_SPIEL_BUILD_WITH_ACPC='ON' OPEN_SPIEL_BUILD_WITH_HANABI='ON' OPEN_SPIEL_BUILD_WITH_ROSHAMBO='ON'"
35-
CIBW_BUILD: cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64
36+
CIBW_BUILD: cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64
3637
- os: macOS-12
3738
OS_TYPE: "Darwin"
3839
CI_PYBIN: python3.9
40+
OS_PYTHON_VERSION: 3.9
3941
CIBW_ENVIRONMENT: "OPEN_SPIEL_BUILDING_WHEEL='ON' OPEN_SPIEL_BUILD_WITH_ACPC='ON' OPEN_SPIEL_BUILD_WITH_HANABI='ON' OPEN_SPIEL_BUILD_WITH_ROSHAMBO='ON'"
40-
CIBW_BUILD: cp38-macosx_x86_64 cp39-macosx_x86_64 cp310-macosx_x86_64 cp311-macosx_x86_64
42+
CIBW_BUILD: cp38-macosx_x86_64 cp39-macosx_x86_64 cp310-macosx_x86_64 cp311-macosx_x86_64 cp312-macosx_x86_64
43+
# Setting to the new M1 runners to build the _arm64 wheels
44+
# https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/
45+
# TODO(author5): Set this to macos-13 once these runnings are no longer in beta
46+
- os: macos-13-xlarge
47+
OS_TYPE: "Darwin"
48+
CI_PYBIN: python3.11
49+
OS_PYTHON_VERSION: 3.11
50+
CIBW_ENVIRONMENT: "OPEN_SPIEL_BUILDING_WHEEL='ON' OPEN_SPIEL_BUILD_WITH_ACPC='ON' OPEN_SPIEL_BUILD_WITH_HANABI='ON' OPEN_SPIEL_BUILD_WITH_ROSHAMBO='ON'"
51+
CIBW_BUILD: cp39-macosx_arm64 cp310-macosx_arm64 cp311-macosx_arm64 cp312-macosx_arm64
4152
env:
4253
OPEN_SPIEL_BUILDING_WHEEL: ON
4354
OPEN_SPIEL_BUILD_WITH_ACPC: ON
4455
OPEN_SPIEL_BUILD_WITH_HANABI: ON
4556
OPEN_SPIEL_BUILD_WITH_ROSHAMBO: ON
4657
OS_TYPE: ${{ matrix.OS_TYPE }}
47-
OS_PYTHON_VERSION: "3.9"
58+
OS_PYTHON_VERSION: ${{ matrix.OS_PYTHON_VERSION }}
4859
CI_PYBIN: ${{ matrix.CI_PYBIN }}
4960
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
5061
CIBW_BUILD: ${{ matrix.CIBW_BUILD }}
@@ -72,15 +83,16 @@ jobs:
7283
# These are necessary to install what is necessary for the build and for the full tests below.
7384
${CI_PYBIN} -m pip install --upgrade pip
7485
${CI_PYBIN} -m pip --version
86+
[[ "${OS_TYPE}" = "Darwin" ]] && ${CI_PYBIN} -m pip install pipx
7587
${CI_PYBIN} -m pip install --upgrade setuptools
7688
${CI_PYBIN} -m pip install --upgrade -r requirements.txt -q
77-
source ./open_spiel/scripts/python_extra_deps.sh
89+
source ./open_spiel/scripts/python_extra_deps.sh ${CI_PYBIN}
7890
${CI_PYBIN} -m pip install --no-cache-dir --upgrade $OPEN_SPIEL_PYTHON_JAX_DEPS
7991
${CI_PYBIN} -m pip install --no-cache-dir --upgrade $OPEN_SPIEL_PYTHON_PYTORCH_DEPS
8092
${CI_PYBIN} -m pip install --no-cache-dir --upgrade $OPEN_SPIEL_PYTHON_TENSORFLOW_DEPS
8193
${CI_PYBIN} -m pip install --no-cache-dir --upgrade $OPEN_SPIEL_PYTHON_MISC_DEPS
8294
${CI_PYBIN} -m pip install twine
83-
${CI_PYBIN} -m pip install cibuildwheel==2.11.1
95+
${CI_PYBIN} -m pip install cibuildwheel==2.16.2
8496
- name: Build sdist
8597
run: |
8698
pipx run build --sdist
@@ -90,6 +102,7 @@ jobs:
90102
# Basic tests are run via the CIBW_TEST_COMMAND environment variable.
91103
- name: Build bdist_wheel and run tests
92104
run: |
105+
[[ "${OS_TYPE}" = "Darwin" ]] && xcodebuild -version
93106
${CI_PYBIN} -m cibuildwheel --output-dir wheelhouse
94107
ls -l wheelhouse
95108

docs/install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ source venv/bin/activate
4646

4747
# Finally, install OpenSpiel and its dependencies:
4848
python3 -m pip install --upgrade setuptools pip
49-
python3 -m pip install --no-binary open_spiel
49+
python3 -m pip install --no-binary=:open_spiel: open_spiel
5050

5151
# To exit the virtual env
5252
deactivate

open_spiel/python/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ message(NOTICE "Python include dirs: ${Python3_INCLUDE_DIRS}")
1919
message(NOTICE "Python library dirs: ${Python3_LIBRARY_DIRS}")
2020
include_directories(SYSTEM ${Python3_INCLUDE_DIRS})
2121

22-
if(Python3_VERSION VERSION_LESS "3.6.0")
22+
if(Python3_VERSION VERSION_LESS "3.8.0")
2323
message(FATAL_ERROR
24-
"Python found ${Python3_VERSION} < 3.6.0")
24+
"Python found ${Python3_VERSION} < 3.8.0")
2525
endif()
2626

2727
# Detect the Python ML frameworks.
@@ -264,7 +264,6 @@ set(PYTHON_TESTS ${PYTHON_TESTS}
264264

265265
# Add Jax tests if it is enabled.
266266
if (OPEN_SPIEL_ENABLE_JAX)
267-
# Only current JAX test is the bridge supervised learning example below.
268267
set (PYTHON_TESTS ${PYTHON_TESTS}
269268
jax/deep_cfr_jax_test.py
270269
jax/dqn_jax_test.py
@@ -281,7 +280,6 @@ if (OPEN_SPIEL_ENABLE_PYTORCH)
281280
set(PYTHON_TESTS ${PYTHON_TESTS}
282281
pytorch/rcfr_pytorch_test.py
283282
pytorch/dqn_pytorch_test.py
284-
pytorch/nfsp_pytorch_test.py
285283
pytorch/deep_cfr_pytorch_test.py
286284
pytorch/eva_pytorch_test.py
287285
pytorch/losses/rl_losses_pytorch_test.py

open_spiel/python/algorithms/cfr_br_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ def test_cpp_and_python_cfr_br(self, game, solver_cls,
9494
else:
9595
exploitability_ = exploitability.nash_conv(game, avg_policy)
9696

97-
self.assertEqual(expected_exploitability[step], exploitability_)
97+
self.assertAlmostEqual(
98+
expected_exploitability[step], exploitability_, places=10
99+
)
98100

99101

100102
if __name__ == "__main__":

open_spiel/python/algorithms/cfr_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ def test_cpp_algorithms_identical_to_python_algorithm(self, game, cpp_class,
262262
# convert one to the other, so we use the exploitability as a proxy.
263263
cpp_expl = pyspiel.nash_conv(game, cpp_avg_policy)
264264
python_expl = exploitability.nash_conv(game, python_avg_policy)
265-
self.assertEqual(cpp_expl, python_expl)
265+
self.assertAlmostEqual(cpp_expl, python_expl, places=10)
266266
# Then we also check the CurrentPolicy, just to check it is giving the same
267267
# results too
268268
cpp_current_policy = cpp_solver.current_policy()
269269
python_current_policy = python_solver.current_policy()
270270
cpp_expl = pyspiel.nash_conv(game, cpp_current_policy)
271271
python_expl = exploitability.nash_conv(game, python_current_policy)
272-
self.assertEqual(cpp_expl, python_expl)
272+
self.assertAlmostEqual(cpp_expl, python_expl, places=10)
273273

274274

275275
class CorrDistTest(absltest.TestCase):

0 commit comments

Comments
 (0)