From 41a2c02773521faef4ea6540cecac43c0edc127e Mon Sep 17 00:00:00 2001 From: Nilesh M Negi Date: Wed, 9 Oct 2024 22:36:50 -0500 Subject: [PATCH] [BUILD] Require use of Python3 interpreter (#1367) Signed-off-by: nileshnegi --- CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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}/*")