-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conda recipe for generating the morpheus-llm package
Signed-off-by: Anuradha Karuppiah <[email protected]>
- Loading branch information
1 parent
0cc36c7
commit e001ce9
Showing
6 changed files
with
285 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
c_compiler_version: | ||
- 11.2 | ||
|
||
cxx_compiler_version: | ||
- 11.2 | ||
|
||
cuda_compiler: | ||
- cuda-nvcc | ||
|
||
cuda_compiler_version: | ||
- 12.1 | ||
|
||
python: | ||
- 3.10 | ||
|
||
rapids_version: | ||
- 24.02 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
{% set version = environ.get('GIT_VERSION', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %} | ||
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %} | ||
|
||
package: | ||
name: morpheus-llm | ||
version: {{ version }} | ||
|
||
source: | ||
git_url: ../../../.. | ||
|
||
outputs: | ||
|
||
- name: morpheus-llm | ||
build: | ||
number: {{ GIT_DESCRIBE_NUMBER }} | ||
string: cuda_{{ cuda_compiler_version }}_py{{ python }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }} | ||
script_env: | ||
# 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_CACHE_DIR | ||
- MORPHEUS_PYTHON_BUILD_STUBS | ||
- PARALLEL_LEVEL | ||
run_exports: | ||
- {{ pin_subpackage("morpheus-llm", max_pin="x.x") }} | ||
script: morpheus_llm_build.sh | ||
|
||
requirements: | ||
build: | ||
- {{ compiler("c") }} | ||
- {{ compiler("cuda") }} | ||
- {{ compiler("cxx") }} | ||
- ccache | ||
- cmake =3.27 | ||
- ninja =1.11 | ||
host: | ||
- cudf {{ rapids_version }} | ||
- cython 3.0.* | ||
- glog 0.6.* | ||
- libcudf {{ rapids_version }} | ||
- librdkafka >=1.9.2,<1.10.0a0 | ||
- morpheus-core {{ minor_version }} | ||
- pip | ||
- pybind11-stubgen 0.10.5 | ||
- python {{ python }} | ||
- rapidjson 1.1.0 | ||
- scikit-build 0.17.6 | ||
- versioneer-518 | ||
- zlib 1.2.13 # required to build triton client | ||
run: | ||
- morpheus-core {{ minor_version }} | ||
test: | ||
requires: | ||
- pynvml | ||
- pytest-asyncio | ||
- pytest-benchmark | ||
- pytest-cov | ||
- pytest =7.4.4 | ||
source_files: | ||
- pyproject.toml | ||
- scripts/fetch_data.py | ||
imports: | ||
- morpheus_llm | ||
commands: | ||
- echo # make sure test requirements get installed | ||
|
||
about: | ||
home: https://github.com/nv-morpheus/Morpheus | ||
license: Apache-2.0 | ||
license_family: Apache | ||
license_file: LICENSE | ||
summary: Morpheus Cybersecurity LLM Library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# It is assumed that this script is executed from the root of the repo directory by conda-build | ||
# (https://conda-forge.org/docs/maintainer/knowledge_base.html#using-cmake) | ||
|
||
# This will store all of the cmake args. Make sure to prepend args to allow | ||
# incoming values to overwrite them | ||
CMAKE_ARGS=${CMAKE_ARGS:-""} | ||
|
||
export CCACHE_BASEDIR=$(realpath ${SRC_DIR}/..) | ||
export USE_SCCACHE=${USE_SCCACHE:-""} | ||
|
||
# Check for some mrc environment variables. Append to front of args to allow users to overwrite them | ||
if [[ -n "${MORPHEUS_CACHE_DIR}" ]]; then | ||
# Set the cache variable, then set the Staging prefix to allow for host searching | ||
CMAKE_ARGS="-DMORPHEUS_CACHE_DIR=${MORPHEUS_CACHE_DIR} ${CMAKE_ARGS}" | ||
|
||
# Double check that the cache dir has been created | ||
mkdir -p ${MORPHEUS_CACHE_DIR} | ||
fi | ||
|
||
# Enable llm | ||
CMAKE_ARGS="-DMORPHEUS_BUILD_MORPHEUS_LLM=ON ${CMAKE_ARGS}" | ||
|
||
# Disable core, dfp and doca | ||
CMAKE_ARGS="-DMORPHEUS_SUPPORT_DOCA=OFF ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_BUILD_MORPHEUS_CORE=OFF ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_BUILD_MORPHEUS_DFP=OFF ${CMAKE_ARGS}" | ||
|
||
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}" | ||
CMAKE_ARGS="-DBUILD_SHARED_LIBS=ON ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_USE_CONDA=ON ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_USE_CCACHE=ON ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_PYTHON_BUILD_STUBS=${MORPHEUS_PYTHON_BUILD_STUBS=-"ON"} ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_PYTHON_INPLACE_BUILD=ON ${CMAKE_ARGS}" | ||
CMAKE_ARGS="-DMORPHEUS_PYTHON_BUILD_WHEEL=ON ${CMAKE_ARGS}" | ||
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}" | ||
|
||
if [[ "${USE_SCCACHE}" == "1" ]]; then | ||
CMAKE_ARGS="-DCCACHE_PROGRAM_PATH=$(which sccache) ${CMAKE_ARGS}" | ||
fi | ||
|
||
echo "CC : ${CC}" | ||
echo "CXX : ${CXX}" | ||
echo "CUDAHOSTCXX : ${CUDAHOSTCXX}" | ||
echo "CUDA : ${CUDA}" | ||
echo "CMAKE_ARGS : ${CMAKE_ARGS}" | ||
|
||
echo "========Begin Env========" | ||
env | ||
echo "========End Env========" | ||
|
||
BUILD_DIR="build-conda" | ||
|
||
# Check if the build directory already exists. And if so, delete the | ||
# CMakeCache.txt and CMakeFiles to ensure a clean configuration | ||
if [[ -d "./${BUILD_DIR}" ]]; then | ||
echo "Deleting old CMake files at ./${BUILD_DIR}" | ||
rm -rf "./${BUILD_DIR}/CMakeCache.txt" | ||
rm -rf "./${BUILD_DIR}/CMakeFiles" | ||
fi | ||
|
||
# Run configure | ||
cmake -B ${BUILD_DIR} \ | ||
${CMAKE_ARGS} \ | ||
--log-level=verbose \ | ||
. | ||
|
||
# Build the components | ||
cmake --build ${BUILD_DIR} -j${PARALLEL_LEVEL:-$(nproc)} --target install | ||
|
||
# Install just the mprpheus llm python wheel components | ||
${PYTHON} -m pip install -vv ${BUILD_DIR}/python/morpheus_llm/dist/*.whl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/bash | ||
# SPDX-FileCopyrightText: Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
CI_SCRIPT_ARGS="$@" | ||
source ${WORKSPACE}/ci/scripts/github/common.sh | ||
|
||
cd ${MORPHEUS_ROOT} | ||
|
||
fetch_base_branch | ||
|
||
# Its important that we are in the base environment for the build | ||
rapids-logger "Activating Base Conda Environment" | ||
|
||
# Deactivate any extra environments (There can be a few on the stack) | ||
while [[ "${CONDA_SHLVL:-0}" -gt 1 ]]; do | ||
echo "Deactivating conda environment ${CONDA_DEFAULT_ENV}" | ||
conda deactivate | ||
done | ||
|
||
# Ensure at least base is activated | ||
if [[ "${CONDA_DEFAULT_ENV}" != "base" ]]; then | ||
echo "Activating base conda environment" | ||
conda activate base | ||
fi | ||
|
||
# Print the info just to be sure base is active | ||
conda info | ||
|
||
rapids-logger "Building Conda Package morpheus-llm" | ||
|
||
# Run the conda build, and upload to conda forge if requested | ||
export MORPHEUS_PYTHON_BUILD_STUBS=OFF | ||
export CONDA_ARGS="--skip-existing" | ||
${MORPHEUS_ROOT}/ci/conda/recipes/run_conda_build.sh morpheus-llm "${CI_SCRIPT_ARGS}" | ||
|
||
# If we didn't receive the upload argument, upload the artifact to S3 | ||
if [[ " ${CI_SCRIPT_ARGS} " =~ " upload " ]]; then | ||
rapids-logger "Building Conda Package morpheus-llm... Done" | ||
else | ||
# if we didn't receive the upload argument, we can still upload the artifact to S3 | ||
tar cfj "${WORKSPACE_TMP}/conda_morpheus_llm.tar.bz" "${RAPIDS_CONDA_BLD_OUTPUT_DIR}" | ||
ls -lh ${WORKSPACE_TMP}/ | ||
|
||
rapids-logger "Pushing results to ${DISPLAY_ARTIFACT_URL}/" | ||
upload_artifact "${WORKSPACE_TMP}/conda_morpheus_llm.tar.bz" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters