diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 318b984a1..2871f9a4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -294,7 +294,7 @@ jobs: run: | ./install_deps.sh mkdir build && cd build - cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + cmake -DMAC_ARM64=ON -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. CC=gcc-8 make -j $(sysctl -n hw.ncpu) ls -la @@ -363,7 +363,7 @@ jobs: run: | ./install_deps.sh mkdir build && cd build - cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. + cmake -DNITRO_VERSION=${{ needs.set-nitro-version.outputs.version }} .. CC=gcc-8 make -j $(sysctl -n hw.ncp) ls -la @@ -423,7 +423,7 @@ jobs: mkdir -p nitro/engines/cortex.llamacpp/ ls ./nitro-mac-amd64 lipo -create ./nitro-mac-amd64/nitro ./nitro-mac-arm64/nitro -output ./nitro/nitro - lipo -create ./nitro-mac-amd64/engines/cortex.llamacpp/libengine.dylib ./nitro-mac-arm64/engines/cortex.llamacpp/libengine.dylib -output ./nitro/engines/cortex.llamacpp/libengine.dylib + lipo -create ./nitro-mac-amd64/engines/cortex.llamacpp/libengine.dylib ./nitro-mac-arm64/engines/cortex.llamacpp/libengine.dylib ./nitro/engines/cortex.llamacpp/libengine.dylib cp ./nitro-mac-arm64/ggml-metal.metal ./nitro/ggml-metal.metal tar -czvf nitro.tar.gz nitro diff --git a/cortex-cpp/engines/cortex.llamacpp/engine.cmake b/cortex-cpp/engines/cortex.llamacpp/engine.cmake index 4b879a1ca..be7df6b12 100644 --- a/cortex-cpp/engines/cortex.llamacpp/engine.cmake +++ b/cortex-cpp/engines/cortex.llamacpp/engine.cmake @@ -1,52 +1,62 @@ -set(LIBLLAMA_ENGINE_VERSION v1.0) +# cortex.llamacpp release version +set(VERSION 0.1.0) +set(ENGINE_VERSION v${VERSION}) -# Download library based on instruction -# TODO(sang) correct library name when cortex.llamacpp CI is done +# MESSAGE("ENGINE_VERSION=" ${ENGINE_VERSION}) + +# Download library based on instructions if(UNIX AND NOT APPLE) if(CUDA_12_0) - set(LIBRARY_NAME linux-amd64-cuda-12-0.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-cuda-12-0.tar.gz) elseif(CUDA_11_7) - set(LIBRARY_NAME linux-amd64-cuda-11-7.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-cuda-11-7.tar.gz) elseif(LLAMA_VULKAN) - set(LIBRARY_NAME linux-amd64-vulkan.tar.gz) - elseif(DLLAMA_AVX512) - set(LIBRARY_NAME linux-amd64-avx512.tar.gz) - elseif(DLLAMA_AVX2) - set(LIBRARY_NAME linux-amd64-avx2.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-vulkan.tar.gz) + elseif(LLAMA_AVX512) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx512.tar.gz) + elseif(NOT LLAMA_AVX2) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx.tar.gz) else() - set(LIBRARY_NAME linux-amd64-avx.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-linux-amd64-avx2.tar.gz) endif() elseif(UNIX) - set(LIBRARY_NAME mac-universal.tar.gz) + if(MAC_ARM64) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-mac-arm64.tar.gz) + else() + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-mac-amd64.tar.gz) + endif() else() if(CUDA_12_0) - if(DLLAMA_AVX512) - set(LIBRARY_NAME win-amd64-avx512-cuda-12-0.tar.gz) - elseif(DLLAMA_AVX2) - set(LIBRARY_NAME win-amd64-avx2-cuda-12-0.tar.gz) + if(LLAMA_AVX512) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx512-cuda-12-0.tar.gz) + elseif(NOT LLAMA_AVX2) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx-cuda-12-0.tar.gz) else() - set(LIBRARY_NAME win-amd64-avx-cuda-12-0.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx2-cuda-12-0.tar.gz) endif() elseif(CUDA_11_7) - if(DLLAMA_AVX512) - set(LIBRARY_NAME win-amd64-avx512-cuda-11-7.tar.gz) - elseif(DLLAMA_AVX2) - set(LIBRARY_NAME win-amd64-avx2-cuda-11-7.tar.gz) + if(LLAMA_AVX512) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx512-cuda-11-7.tar.gz) + elseif(NOT LLAMA_AVX2) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx-cuda-11-7.tar.gz) else() - set(LIBRARY_NAME win-amd64-avx-cuda-11-7.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx2-cuda-11-7.tar.gz) endif() elseif(LLAMA_VULKAN) - set(LIBRARY_NAME win-amd64-vulkan.tar.gz) - elseif(DLLAMA_AVX512) - set(LIBRARY_NAME win-amd64-avx512.tar.gz) - elseif(DLLAMA_AVX2) - set(LIBRARY_NAME win-amd64-avx2.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-vulkan.tar.gz) + elseif(LLAMA_AVX512) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx512.tar.gz) + elseif(NOT LLAMA_AVX2) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx.tar.gz) else() - set(LIBRARY_NAME win-amd64-avx.tar.gz) + set(LIBRARY_NAME cortex.llamacpp-${VERSION}-windows-amd64-avx2.tar.gz) endif() endif() -set(LIBLLAMA_ENGINE_URL https://github.com/.../releases/download/${LIBLLAMA_ENGINE_VERSION}/${LIBRARY_NAME}) + +set(LIBLLAMA_ENGINE_URL https://github.com/janhq/cortex.llamacpp/releases/download/${ENGINE_VERSION}/${LIBRARY_NAME}) +# MESSAGE("LIBLLAMA_ENGINE_URL="${LIBLLAMA_ENGINE_URL}) +# MESSAGE("LIBARRY_NAME=" ${LIBRARY_NAME}) set(LIBLLAMA_ENGINE_PATH ${CMAKE_BINARY_DIR}/engines/${LIBRARY_NAME})