Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the conda-build with DOCA enabled and upgrading to CMake 3.25 #1386

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.


cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)


list(APPEND CMAKE_MESSAGE_CONTEXT "morpheus")
Expand Down
8 changes: 6 additions & 2 deletions ci/conda/recipes/morpheus/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ outputs:
# Note: Setting a default value here will overwrite the value from the
# shell! Defaults should be set in the run_conda_build.sh script
- CMAKE_CUDA_ARCHITECTURES
- MORPHEUS_PYTHON_BUILD_STUBS
- MORPHEUS_CACHE_DIR
- MORPHEUS_PYTHON_BUILD_STUBS
- MORPHEUS_SUPPORT_DOCA
- PARALLEL_LEVEL
run_exports:
- {{ pin_subpackage("morpheus", max_pin="x.x") }}
Expand All @@ -47,9 +48,11 @@ outputs:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- {{ compiler("cuda") }}
- automake 1.16.5 # Needed for DOCA build
- ccache
- cmake 3.24
- cmake 3.25
- cuda-cudart-dev {{ cuda_compiler_version }} # Needed by CMake to compile a test application
- libtool # Needed for DOCA build
- ninja
host:
- cuda-toolkit {{ cuda_compiler_version }}
Expand All @@ -63,6 +66,7 @@ outputs:
- pybind11-stubgen 0.10.5
- python {{ python }}
- rapidjson 1.1
- rdma-core >=48 # Needed for DOCA. Compatible with UCX 1.14.1
- scikit-build 0.17.1
- versioneer-518
run:
Expand Down
10 changes: 10 additions & 0 deletions ci/conda/recipes/morpheus/morpheus_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ if [[ -n "${MORPHEUS_CACHE_DIR}" ]]; then
mkdir -p ${MORPHEUS_CACHE_DIR}
fi

if [[ "${MORPHEUS_SUPPORT_DOCA}" == "ON" ]]; then
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved
CMAKE_ARGS="-DMORPHEUS_SUPPORT_DOCA=ON ${CMAKE_ARGS}"

# Set the CMAKE_CUDA_ARCHITECTURES to just 80;86 since that is what DOCA supports for now
CMAKE_CUDA_ARCHITECTURES="80;86"

echo "MORPHEUS_SUPPORT_DOCA is ON. Setting CMAKE_CUDA_ARCHITECTURES to supported values: '${CMAKE_CUDA_ARCHITECTURES}'"
fi

CMAKE_ARGS="-DCMAKE_MESSAGE_CONTEXT_SHOW=ON ${CMAKE_ARGS}"
CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX=$PREFIX ${CMAKE_ARGS}"
CMAKE_ARGS="-DCMAKE_INSTALL_LIBDIR=lib ${CMAKE_ARGS}"
Expand All @@ -45,6 +54,7 @@ CMAKE_ARGS="-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON ${CMAKE_ARGS}"
CMAKE_ARGS="-DCMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES=-"RAPIDS"} ${CMAKE_ARGS}"
CMAKE_ARGS="-DPython_EXECUTABLE=${PYTHON} ${CMAKE_ARGS}"
CMAKE_ARGS="-DPYTHON_EXECUTABLE=${PYTHON} ${CMAKE_ARGS}" # for pybind11
CMAKE_ARGS="--log-level=VERBOSE ${CMAKE_ARGS}"
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved

if [[ "${USE_SCCACHE}" == "1" ]]; then
CMAKE_ARGS="-DCCACHE_PROGRAM_PATH=$(which sccache) ${CMAKE_ARGS}"
Expand Down
1 change: 1 addition & 0 deletions ci/conda/recipes/run_conda_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ fi

# And default channels (with optional channel alias)
CONDA_ARGS_ARRAY+=("-c" "${CONDA_CHANNEL_ALIAS:+"${CONDA_CHANNEL_ALIAS%/}/"}rapidsai")
CONDA_ARGS_ARRAY+=("-c" "${CONDA_CHANNEL_ALIAS:+"${CONDA_CHANNEL_ALIAS%/}/"}nvidia/label/cuda-11.8.0")
CONDA_ARGS_ARRAY+=("-c" "${CONDA_CHANNEL_ALIAS:+"${CONDA_CHANNEL_ALIAS%/}/"}nvidia")
CONDA_ARGS_ARRAY+=("-c" "${CONDA_CHANNEL_ALIAS:+"${CONDA_CHANNEL_ALIAS%/}/"}nvidia/label/dev")
CONDA_ARGS_ARRAY+=("-c" "${CONDA_CHANNEL_ALIAS:+"${CONDA_CHANNEL_ALIAS%/}/"}pytorch")
Expand Down
5 changes: 2 additions & 3 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ list(APPEND CMAKE_MESSAGE_CONTEXT "dep")

morpheus_utils_initialize_cpm(MORPHEUS_CACHE_DIR)

if (VERBOSE)
morpheus_utils_print_config()
endif()

mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved
morpheus_utils_print_config()

# First, load the package_config functions
include(${CMAKE_CURRENT_LIST_DIR}/package_config/register_api.cmake)
Expand Down
184 changes: 94 additions & 90 deletions cmake/package_search/Finddoca.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
# Often this is installed in /opt/mellanox/doca. If so, run `set(doca_ROOT "/opt/mellanox/doca")` before calling this
# file

# List of required args. Start with INCLUDE_DIR since the first one is displayed
list(APPEND doca_REQUIRED_VARS doca_INCLUDE_DIR)

if(DEFINED doca_ROOT)
# Usually, dpdk is up and over one
# /opt/mellanox/doca
Expand All @@ -30,112 +27,119 @@ endif()

# Now find DPDK
find_package(libdpdk QUIET)
mdemoret-nv marked this conversation as resolved.
Show resolved Hide resolved
list(APPEND doca_REQUIRED_VARS libdpdk_FOUND)

# CMAKE_LIBRARY_ARCHITECTURE needs to be set for this to work correctly. Save the value so we can restore
set(_saved_CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE})

if(NOT DEFINED CMAKE_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE x86_64-linux-gnu)
endif()

# Find the include path
find_path(
doca_INCLUDE_DIR doca_gpunetio.h
)
mark_as_advanced(doca_INCLUDE_DIR)

# Find all of the libraries
list(APPEND doca_REQUIRED_LIBS
doca_eth
doca_flow
doca_gpunetio
doca_gpunetio_device
# Create a scope to allow variables to be set locally without altering the parent scope
block(SCOPE_FOR VARIABLES
PROPAGATE
doca_FOUND
doca_VERSION
)

foreach(library_name IN LISTS doca_REQUIRED_LIBS)
find_library(
${library_name}_LIBRARY
NAMES ${library_name}
)
mark_as_advanced(${library_name}_LIBRARY)
list(APPEND doca_REQUIRED_VARS ${library_name}_LIBRARY)
endforeach()
# List of required args. Start with INCLUDE_DIR since the first one is displayed
list(APPEND doca_REQUIRED_VARS libdpdk_FOUND doca_INCLUDE_DIR)

macro(parse_define_number define_name file_string output_variable)
string(REGEX MATCH "#define ${define_name} ([^\n]+)\n" _ "${file_string}")
set(${output_variable} "${CMAKE_MATCH_1}")
endmacro()
# This library will always be installed on the host. Allow that to be searched here (Should fix this up in the future)
set("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE" BOTH)
set("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY" BOTH)

macro(parse_define_string define_name file_string output_variable)
string(REGEX MATCH "#define ${define_name} \"([^\n]+)\"\n" _ "${file_string}")
set(${output_variable} "${CMAKE_MATCH_1}")
endmacro()
# CMAKE_LIBRARY_ARCHITECTURE needs to be set for this to work correctly. Will be restored at the end of the block
if(NOT DEFINED CMAKE_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE x86_64-linux-gnu)
endif()

# Parse the version number
if (DEFINED doca_INCLUDE_DIR)
# Find the include path
find_path(
doca_INCLUDE_DIR doca_gpunetio.h
)
mark_as_advanced(doca_INCLUDE_DIR)

# Find all of the libraries
list(APPEND doca_REQUIRED_LIBS
doca_eth
doca_flow
doca_gpunetio
doca_gpunetio_device
)

message(VERBOSE "doca_INCLUDE_DIR: ${doca_INCLUDE_DIR}")
foreach(library_name IN LISTS doca_REQUIRED_LIBS)
find_library(
${library_name}_LIBRARY
NAMES ${library_name}
)
mark_as_advanced(${library_name}_LIBRARY)
list(APPEND doca_REQUIRED_VARS ${library_name}_LIBRARY)
endforeach()

find_file(doca_VERSION_FILE
NAMES doca_version.h
PATHS ${doca_INCLUDE_DIR}
NO_DEFAULT_PATH
)
mark_as_advanced(doca_VERSION_FILE)
macro(parse_define_number define_name file_string output_variable)
string(REGEX MATCH "#define ${define_name} ([^\n]+)\n" _ "${file_string}")
set(${output_variable} "${CMAKE_MATCH_1}")
endmacro()

if (DEFINED doca_VERSION_FILE)
message(VERBOSE "doca_VERSION_FILE: ${doca_VERSION_FILE}")
macro(parse_define_string define_name file_string output_variable)
string(REGEX MATCH "#define ${define_name} \"([^\n]+)\"\n" _ "${file_string}")
set(${output_variable} "${CMAKE_MATCH_1}")
endmacro()

file(READ ${doca_VERSION_FILE} version_file_string)
# Parse the version number
if (DEFINED doca_INCLUDE_DIR)

parse_define_string(DOCA_VER_STRING "${version_file_string}" doca_FULL_VERSION)
parse_define_number(DOCA_VER_MAJOR "${version_file_string}" doca_MAJOR_VERSION)
parse_define_number(DOCA_VER_MINOR "${version_file_string}" doca_MINOR_VERSION)
parse_define_number(DOCA_VER_PATCH "${version_file_string}" doca_PATCH_VERSION)
find_file(doca_VERSION_FILE
NAMES doca_version.h
PATHS ${doca_INCLUDE_DIR}
NO_DEFAULT_PATH
)
mark_as_advanced(doca_VERSION_FILE)

# Set the version variable
set(doca_VERSION "${doca_FULL_VERSION}")
if (DEFINED doca_VERSION_FILE)

endif()
file(READ ${doca_VERSION_FILE} version_file_string)

endif()
parse_define_string(DOCA_VER_STRING "${version_file_string}" doca_VERSION_FULL)
parse_define_number(DOCA_VER_MAJOR "${version_file_string}" doca_VERSION_MAJOR)
parse_define_number(DOCA_VER_MINOR "${version_file_string}" doca_VERSION_MINOR)
parse_define_number(DOCA_VER_PATCH "${version_file_string}" doca_VERSION_PATCH)

# Restore CMAKE_LIBRARY_ARCHITECTURE now that we are done
set(CMAKE_LIBRARY_ARCHITECTURE ${_saved_CMAKE_LIBRARY_ARCHITECTURE})
# Set the version variable
set(doca_VERSION "${doca_VERSION_FULL}")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(doca
FOUND_VAR doca_FOUND
REQUIRED_VARS
${doca_REQUIRED_VARS}
VERSION_VAR doca_VERSION
)
endif()

if(doca_FOUND)
endif()

list(APPEND doca_child_targets)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(doca
FOUND_VAR doca_FOUND
REQUIRED_VARS
${doca_REQUIRED_VARS}
VERSION_VAR doca_VERSION
)

foreach(library_name IN LISTS doca_REQUIRED_LIBS)
if(NOT TARGET doca::${library_name})
add_library(${library_name} UNKNOWN IMPORTED GLOBAL)
add_library(doca::${library_name} ALIAS ${library_name})
set_target_properties(${library_name} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${${library_name}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${doca_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "libdpdk::libdpdk"
if(doca_FOUND)

list(APPEND doca_child_targets)

foreach(library_name IN LISTS doca_REQUIRED_LIBS)
if(NOT TARGET doca::${library_name})
add_library(${library_name} UNKNOWN IMPORTED GLOBAL)
add_library(doca::${library_name} ALIAS ${library_name})
set_target_properties(${library_name} PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${${library_name}_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${doca_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "libdpdk::libdpdk"
)

# Add to the list of dependent targets
list(APPEND doca_child_targets doca::${library_name})
endif()
endforeach()

if(NOT TARGET doca::doca)
add_library(doca::doca INTERFACE IMPORTED GLOBAL)
set_target_properties(doca::doca PROPERTIES
INTERFACE_LINK_LIBRARIES "${doca_child_targets}"
)

# Add to the list of dependent targets
list(APPEND doca_child_targets doca::${library_name})
endif()
endforeach()

if(NOT TARGET doca::doca)
add_library(doca::doca INTERFACE IMPORTED GLOBAL)
set_target_properties(doca::doca PROPERTIES
INTERFACE_LINK_LIBRARIES "${doca_child_targets}"
)
endif()
endif()

endblock()
Loading