Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
goliaro committed Jul 14, 2023
1 parent 172e047 commit c625080
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
18 changes: 10 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,16 @@ if (FF_USE_PYTHON)
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/deps/legion/bindings/python/setup.py build --cmake-build-dir ${Legion_BINARY_DIR}/runtime --prefix ${Legion_BINARY_DIR} --build-lib=${Legion_BINARY_DIR}/bindings/python ${Legion_PYTHON_EXTRA_INSTALL_ARGS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deps/legion/bindings/python
)
# create flexflow_python interpreter
add_custom_command(TARGET flexflow
PRE_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${FLEXFLOW_ROOT}/python/flexflow_python_build.py --build-dir ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Creating flexflow_python interpreter..."
)
install(PROGRAMS ${CMAKE_BINARY_DIR}/flexflow_python DESTINATION "bin")
# create flexflow_python interpreter. When building from pip, we install the FF_HOME/python/flexflow_python script instead.
if (NOT FF_BUILD_FROM_PYPI)
add_custom_command(TARGET flexflow
PRE_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${FLEXFLOW_ROOT}/python/flexflow_python_build.py --build-dir ${CMAKE_BINARY_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Creating flexflow_python interpreter..."
)
install(PROGRAMS ${CMAKE_BINARY_DIR}/flexflow_python DESTINATION "bin")
endif()
endif()

# build binary
Expand Down
8 changes: 8 additions & 0 deletions python/flexflow/flexflow_python
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env bash

# This file runs the flexflow_python interpreter when installing FlexFlow via pip. This file can be ignored when installing FlexFlow using cmake/make

python_packages=$(python -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))")
export PATH="${python_packages}/flexflow/bin:${PATH}"

legion_python "$@"
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"pybind11",
"ninja",
],
scripts=['python/flexflow_python'],
ext_modules=[
CMakeExtension(
name="flexflow",
Expand Down

0 comments on commit c625080

Please sign in to comment.