Skip to content

Commit

Permalink
Added PPO and fixed all bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
perara committed Oct 18, 2024
1 parent bb63853 commit a83e928
Show file tree
Hide file tree
Showing 12 changed files with 912 additions and 368 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest] # , windows-latest, macos-13, macos-latest

steps:
- uses: actions/checkout@v4

# Used to host cibuildwheel
- uses: actions/setup-python@v5

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.21.3


- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse

- name: Display vcpkg logs on failure
if: failure()
run: |
echo "vcpkg bootstrap log:"
cat ${{ github.workspace }}/.vcpkg/buildtrees/vcpkg/bootstrap-out.log || echo "Bootstrap log not found"
echo "vcpkg install log:"
find /tmp -name vcpkg-bootstrap.log -exec cat {} \; || echo "Install log not found"
shell: bash

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl

publish:
needs: build_wheels
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-wheels-*
path: dist
merge-multiple: true

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
28 changes: 20 additions & 8 deletions jsp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,33 @@ find_package(glfw3 REQUIRED)
find_package(CURL REQUIRED)
find_package(fmt REQUIRED)






find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)

# Check if nanobind_DIR is set
if(DEFINED nanobind_DIR)
list(APPEND CMAKE_MODULE_PATH "${nanobind_DIR}")
message(STATUS "nanobind_DIR is set to: ${nanobind_DIR}")
else()
message(WARNING "nanobind_DIR is not set")
# site-packages/nanobind/cmake
list(APPEND CMAKE_MODULE_PATH "${Python_SITEARCH}/nanobind/cmake")


get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
message( "${Python_SITEARCH}/nanobind/cmake")
endif()

# Try to find nanobind
find_package(Python COMPONENTS Interpreter Development REQUIRED)

# print path to Python executable
message(STATUS "Python_EXECUTABLE: ${Python_EXECUTABLE}")
set(nanobind_DIR "${Python_SITELIB}/nanobind/cmake")
find_package(nanobind CONFIG REQUIRED)

if(NOT nanobind_FOUND)
message(FATAL_ERROR "nanobind not found. Please set nanobind_DIR to the directory containing nanobind-config.cmake")
endif()
Expand Down Expand Up @@ -71,15 +82,16 @@ if(NOT DEFINED BUILD_EXECUTABLE OR BUILD_EXECUTABLE)
endif()

# Create the Python module
nanobind_add_module(jobshop bindings/jobshop_bindings.cpp ${SOURCES} ${HEADERS})
target_include_directories(jobshop PRIVATE include)
nanobind_add_module(jobshop bindings/jobshop_bindings.cpp bindings/multi_dim_array_bind.cpp ${SOURCES} ${HEADERS})
target_include_directories(jobshop PRIVATE include ${Python_INCLUDE_DIRS})
target_link_libraries(jobshop PRIVATE
${OPENGL_LIBRARIES}
GLEW::GLEW
glfw
${CURL_LIBRARIES}
fmt::fmt
imgui::imgui
${Python_LIBRARIES}
)

# Installation
Expand Down
19 changes: 18 additions & 1 deletion jsp/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"type": "FILEPATH"
}
},
"environment": {}
"environment": {

}
},
{
"name": "debug",
Expand Down Expand Up @@ -63,7 +65,22 @@
"CMAKE_CXX_FLAGS": "-O3 -DNDEBUG -march=native -flto -ffast-math -fno-omit-frame-pointer",
"BUILD_EXECUTABLE": "OFF"
}
},
{
"name": "debug-dev",
"inherits": "debug",
"displayName": "Debug Dev",
"cacheVariables": {
"nanobind_DIR": "../venv/lib/python3.12/site-packages/nanobind/cmake"
},
"environment": {
"VCPKG_ROOT": "../vcpkg"
}

}



],
"workflowPresets": []
}
Loading

0 comments on commit a83e928

Please sign in to comment.