Skip to content

Commit

Permalink
merge lantern and lantern_extras repos
Browse files Browse the repository at this point in the history
  • Loading branch information
var77 committed Oct 8, 2024
2 parents 544d386 + 664f1a7 commit 07538c1
Show file tree
Hide file tree
Showing 485 changed files with 49,534 additions and 17,096 deletions.
48 changes: 48 additions & 0 deletions Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM rust:1.78.0 as build
# Copy the files in your machine to the Docker image
WORKDIR /app
COPY . .
ENV ORT_STRATEGY="system"
ARG RUSTFLAGS=""
ENV RUSTFLAGS=$RUSTFLAGS
ARG CXXFLAGS=""
ENV CXXFLAGS=$CXXFLAGS

ENV CC=/usr/bin/clang-18
ENV CXX=/usr/bin/clang++-18
# Remove lantern_extras from workspace
RUN rm -rf lantern_extras && sed -i -e 's/"lantern_extras",//' Cargo.toml

# Build your program for release
RUN apt update && \
apt install -y --no-install-recommends lsb-release wget software-properties-common gnupg pkg-config curl libssl-dev && \
curl -s https://apt.llvm.org/llvm.sh | bash -s -- 18 && \
cargo build --release --package lantern_cli

FROM debian:12
COPY --from=build /app/target/release/lantern-cli .
ARG TARGETARCH
ENV OS_ARCH="${TARGETARCH:-amd64}"

RUN apt update && \
apt install -y wget && apt clean

# Download onnxruntime
RUN cd /tmp && \
ONNX_VERSION="1.16.1" && \
PACKAGE_URL="https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-x64-${ONNX_VERSION}.tgz" && \
case "$OS_ARCH" in \
arm*|aarch64) \
PACKAGE_URL="https://github.com/microsoft/onnxruntime/releases/download/v${ONNX_VERSION}/onnxruntime-linux-aarch64-${ONNX_VERSION}.tgz"; \
esac && \
mkdir -p /usr/local/lib && \
cd /usr/local/lib && \
wget -qq $PACKAGE_URL && \
tar xzf ./onnx*.tgz && \
rm -rf ./onnx*.tgz && \
mv ./onnx* ./onnxruntime

ENV ORT_STRATEGY=system
ENV ORT_DYLIB_PATH=/usr/local/lib/onnxruntime/lib/libonnxruntime.so
# Run the binary
ENTRYPOINT ["./lantern-cli"]
38 changes: 38 additions & 0 deletions Dockerfile.cli.cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM rust:1.78.0 as build
# Copy the files in your machine to the Docker image
WORKDIR /app
COPY . .

# Remove lantern_extras from workspace
RUN rm -rf lantern_extras && sed -i -e 's/"lantern_extras",//' Cargo.toml

ENV CC=/usr/bin/clang-18
ENV CXX=/usr/bin/clang++-18
# Build your program for release
RUN apt update && \
apt install -y --no-install-recommends lsb-release wget software-properties-common gnupg pkg-config curl libssl-dev && \
curl -s https://apt.llvm.org/llvm.sh | bash -s -- 18 && \
cargo build --release --package lantern_cli

FROM nvcr.io/nvidia/cuda:11.8.0-runtime-ubuntu22.04
COPY --from=build /app/target/release/lantern-cli .
RUN apt update && \
apt install -y wget && apt clean
# Download onnxruntime
RUN mkdir -p /usr/local/lib && \
cd /usr/local/lib && \
wget -q https://github.com/microsoft/onnxruntime/releases/download/v1.16.1/onnxruntime-linux-x64-gpu-1.16.1.tgz && \
tar xzf ./onnx*.tgz && \
rm -rf ./onnx*.tgz && \
mv ./onnx* ./onnxruntime

# Install libcudnn
RUN wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/libcudnn8_8.7.0.84-1+cuda11.8_amd64.deb -O libcudnn.deb && \
dpkg -i libcudnn.deb && \
rm -rf libcudnn.deb

RUN ln -s /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so.11.2 /usr/local/cuda/targets/x86_64-linux/lib/libnvrtc.so
ENV ORT_STRATEGY=system
ENV ORT_DYLIB_PATH=/usr/local/lib/onnxruntime/lib/libonnxruntime.so
# Run the binary
ENTRYPOINT ["./lantern-cli"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.
TITLE.
30 changes: 30 additions & 0 deletions ci/scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

source "$(dirname "$0")/get_arch_and_platform.sh"
cd $BUILD_DIR
EXT_VERSION=$(cmake --system-information | awk -F= '$1~/CMAKE_PROJECT_VERSION:STATIC/{print$2}')
PACKAGE_NAME=lantern-${EXT_VERSION}-postgres-${PG_VERSION}-${PLATFORM}-${ARCH}

mkdir -p ${BUILD_DIR}/${PACKAGE_NAME}/src
cp ${SOURCE_DIR}/scripts/packaging/* ${BUILD_DIR}/${PACKAGE_NAME}/

# For Mac OS and Postgres 16 the module will have .dylib extension
# Instead of .so, so any of the files may not exist
# So we will ignore the error from cp command
cp ${BUILD_DIR}/*.{so,dylib} ${BUILD_DIR}/${PACKAGE_NAME}/src 2>/dev/null || true
cp -r ${BUILD_DIR}/bitcode ${BUILD_DIR}/${PACKAGE_NAME}/src/bitcode 2>/dev/null || true
cp ${BUILD_DIR}/*.sql ${BUILD_DIR}/${PACKAGE_NAME}/src

for f in $(find "${SOURCE_DIR}/sql/updates/" -name "*.sql"); do
dest_filename=$(echo $f | sed -E 's#(.*)/(.*\.sql)#lantern--\2#g')
cp $f ${BUILD_DIR}/${PACKAGE_NAME}/src/${dest_filename}
done

cp ${BUILD_DIR}/lantern.control ${BUILD_DIR}/${PACKAGE_NAME}/src

cd ${BUILD_DIR} && tar cf ${PACKAGE_NAME}.tar ${PACKAGE_NAME}
rm -rf ${BUILD_DIR}/${PACKAGE_NAME}

## Write output so we can use this in actions and upload artifacts
echo "archive_package_name=${PACKAGE_NAME}.tar" >> "/tmp/gh-output.txt"
echo "archive_package_path=${BUILD_DIR}/${PACKAGE_NAME}.tar" >> "/tmp/gh-output.txt"
70 changes: 0 additions & 70 deletions lantern_cli/Cargo.toml

This file was deleted.

39 changes: 0 additions & 39 deletions lantern_cli/src/cli.rs

This file was deleted.

Loading

0 comments on commit 07538c1

Please sign in to comment.