Skip to content

Commit 6e59160

Browse files
authored
fix: split prebuilt CUDA binaries into 2 npm modules (#495)
1 parent b10999d commit 6e59160

File tree

23 files changed

+467
-49
lines changed

23 files changed

+467
-49
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ jobs:
104104
if: matrix.config.name == 'Ubuntu (1)'
105105
run: |
106106
sudo apt-get update
107-
sudo apt-get install ninja-build cmake libtbb-dev g++-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
107+
sudo apt-get install ninja-build libtbb-dev g++-aarch64-linux-gnu gcc-aarch64-linux-gnu g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf
108+
109+
wget -c https://github.com/Kitware/CMake/releases/download/v3.31.7/cmake-3.31.7-linux-x86_64.tar.gz
110+
sudo tar --strip-components=1 -C /usr/local -xzf cmake-3.31.7-linux-x86_64.tar.gz
111+
rm -f ./cmake-3.31.7-linux-x86_64.tar.gz
108112
109113
which aarch64-linux-gnu-gcc
110114
which aarch64-linux-gnu-g++
@@ -126,17 +130,8 @@ jobs:
126130
127131
cmake --version
128132
129-
- name: Install Cuda 12.4 on Windows (1)
133+
- name: Install Cuda 13.0 on Windows (1)
130134
if: matrix.config.name == 'Windows (1)'
131-
uses: Jimver/[email protected]
132-
with:
133-
cuda: '12.4.0'
134-
method: 'network'
135-
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
136-
use-local-cache: false
137-
138-
- name: Install Cuda 13.0 on Windows (2)
139-
if: matrix.config.name == 'Windows (2)'
140135
shell: bash
141136
timeout-minutes: 30
142137
run: |
@@ -155,20 +150,29 @@ jobs:
155150
echo "CUDA_PATH_VX_Y=CUDA_PATH_V13_0" >> $GITHUB_ENV
156151
echo "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v13.0\\bin" >> $GITHUB_PATH
157152
158-
- name: Install Cuda 12.4 on Ubuntu
159-
if: matrix.config.name == 'Ubuntu (1)'
153+
- name: Install Cuda 12.4 on Windows (2)
154+
if: matrix.config.name == 'Windows (2)'
160155
uses: Jimver/[email protected]
161156
with:
162157
cuda: '12.4.0'
163158
method: 'network'
159+
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
160+
use-local-cache: false
164161

165-
- name: Install Cuda 13.0 on Ubuntu
166-
if: matrix.config.name == 'Ubuntu (2)'
162+
- name: Install Cuda 13.0 on Ubuntu (1)
163+
if: matrix.config.name == 'Ubuntu (1)'
167164
uses: Jimver/[email protected]
168165
with:
169166
cuda: '13.0.0'
170167
method: 'network'
171168

169+
- name: Install Cuda 12.4 on Ubuntu (2)
170+
if: matrix.config.name == 'Ubuntu (2)'
171+
uses: Jimver/[email protected]
172+
with:
173+
cuda: '12.4.0'
174+
method: 'network'
175+
172176
- name: Install Vulkan SDK on Windows (1)
173177
if: matrix.config.name == 'Windows (1)'
174178
shell: powershell

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,14 @@
228228
"@node-llama-cpp/linux-armv7l": "0.1.0",
229229
"@node-llama-cpp/linux-x64": "0.1.0",
230230
"@node-llama-cpp/linux-x64-cuda": "0.1.0",
231+
"@node-llama-cpp/linux-x64-cuda-ext": "0.1.0",
231232
"@node-llama-cpp/linux-x64-vulkan": "0.1.0",
232233
"@node-llama-cpp/mac-arm64-metal": "0.1.0",
233234
"@node-llama-cpp/mac-x64": "0.1.0",
234235
"@node-llama-cpp/win-arm64": "0.1.0",
235236
"@node-llama-cpp/win-x64": "0.1.0",
236237
"@node-llama-cpp/win-x64-cuda": "0.1.0",
238+
"@node-llama-cpp/win-x64-cuda-ext": "0.1.0",
237239
"@node-llama-cpp/win-x64-vulkan": "0.1.0"
238240
}
239241
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Gilad S.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# [`node-llama-cpp`](https://github.com/withcatai/node-llama-cpp)
2+
This is an extension of the [`@node-llama-cpp/linux-x64-cuda`](https://www.npmjs.com/package/@node-llama-cpp/linux-x64-cuda) package
3+
that provides a prebuilt binary for [`node-llama-cpp`](https://github.com/withcatai/node-llama-cpp) for Linux x64 with CUDA support.
4+
5+
Do not install this package directly.

packages/@node-llama-cpp/linux-x64-cuda-ext/package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "@node-llama-cpp/linux-x64-cuda-ext",
3+
"version": "0.1.0",
4+
"description": "Extension of @node-llama-cpp/linux-x64-cuda - prebuilt binary for node-llama-cpp for Linux x64 with CUDA support",
5+
"main": "dist/index.js",
6+
"type": "module",
7+
"files": [
8+
"dist/",
9+
"bins/",
10+
"package.json",
11+
"README.md",
12+
"LICENSE"
13+
],
14+
"exports": {
15+
".": {
16+
"import": "./dist/index.js",
17+
"node": "./dist/index.js",
18+
"default": "./dist/index.js"
19+
}
20+
},
21+
"engines": {
22+
"node": ">=20.0.0"
23+
},
24+
"os": ["linux"],
25+
"cpu": ["x64"],
26+
"libc": ["glibc"],
27+
"scripts": {
28+
"prebuild": "rimraf ./dist ./tsconfig.tsbuildinfo",
29+
"build": "tsc --build tsconfig.json --force",
30+
"prewatch": "rimraf ./dist ./tsconfig.tsbuildinfo",
31+
"watch": "tsc --build tsconfig.json --watch --force",
32+
"clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo"
33+
},
34+
"repository": {
35+
"type": "git",
36+
"url": "git+https://github.com/withcatai/node-llama-cpp.git"
37+
},
38+
"author": "Gilad S.",
39+
"license": "MIT",
40+
"preferUnplugged": true,
41+
"bugs": {
42+
"url": "https://github.com/withcatai/node-llama-cpp/issues"
43+
},
44+
"homepage": "https://node-llama-cpp.withcat.ai",
45+
"devDependencies": {
46+
"typescript": "^5.2.2"
47+
}
48+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import path from "path";
2+
import {fileURLToPath} from "url";
3+
import fs from "node:fs/promises";
4+
5+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
6+
const binsDir = path.join(__dirname, "..", "bins");
7+
const packageVersion: string = (JSON.parse(await fs.readFile(path.join(__dirname, "..", "package.json"), "utf8"))).version;
8+
9+
export function getBinsDir() {
10+
return {
11+
binsDir,
12+
packageVersion
13+
};
14+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2022"],
4+
"module": "es2022",
5+
"target": "es2022",
6+
"esModuleInterop": true,
7+
"noImplicitAny": true,
8+
"noImplicitReturns": true,
9+
"noImplicitThis": true,
10+
"noImplicitOverride": true,
11+
"removeComments": false,
12+
"allowSyntheticDefaultImports": true,
13+
"forceConsistentCasingInFileNames": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"skipLibCheck": true,
16+
"moduleResolution": "node",
17+
"resolveJsonModule": false,
18+
"strictNullChecks": true,
19+
"isolatedModules": true,
20+
"noEmit": false,
21+
"outDir": "./dist",
22+
"strict": true,
23+
"sourceMap": false,
24+
"composite": false,
25+
"declaration": false,
26+
"stripInternal": true
27+
},
28+
"files": [
29+
"./src/index.ts"
30+
],
31+
"include": [
32+
"./src"
33+
]
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

0 commit comments

Comments
 (0)