diff --git a/CMakeLists.txt b/CMakeLists.txt index 03c5f84115..4cdb9bf5a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -591,15 +591,24 @@ endforeach() # Generate device/host tables and all the collective functions that are going to be in librccl.so #================================================================================================== -find_package(PythonInterp REQUIRED) +find_package(Python3 COMPONENTS Interpreter REQUIRED) +if (NOT Python3_FOUND) + message(FATAL_ERROR "RCCL requires Python3 for generating host/device tables") +endif() + set(GEN_DIR "${HIPIFY_DIR}/gensrc") # Execute the python script to generate required files execute_process( COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/device/generate.py ${GEN_DIR} ${IFC_ENABLED} ${COLLTRACE} ${ENABLE_MSCCL_KERNEL} ${ONLY_FUNCS} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE result + RESULT_VARIABLE gen_py_result + ERROR_VARIABLE gen_py_error ) +if (gen_py_result) + message(SEND_ERROR "Error: ${gen_py_error}") + message(FATAL_ERROR "${CMAKE_SOURCE_DIR}/src/device/generate.py failed") +endif() # Find the generated files in the output directory file(GLOB GENERATED_FILES "${GEN_DIR}/*")