pinokiod 5.1.27 → 5.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/bin/cuda.js +19 -0
- package/kernel/shell.js +0 -3
- package/package.json +1 -1
package/kernel/bin/cuda.js
CHANGED
|
@@ -2,6 +2,24 @@ const semver = require('semver')
|
|
|
2
2
|
const fs = require('fs')
|
|
3
3
|
const path = require('path')
|
|
4
4
|
class Cuda {
|
|
5
|
+
async patchCudaActivationScript() {
|
|
6
|
+
if (this.kernel.platform !== "win32") {
|
|
7
|
+
return
|
|
8
|
+
}
|
|
9
|
+
const script = this.kernel.bin.path("miniconda/etc/conda/activate.d/pinokio/~cuda-nvcc_activate.bat")
|
|
10
|
+
let content
|
|
11
|
+
try {
|
|
12
|
+
content = await fs.promises.readFile(script, "utf8")
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return
|
|
15
|
+
}
|
|
16
|
+
const lines = content.split(/\r?\n/)
|
|
17
|
+
const filtered = lines.filter((line) => !/set\s+\"?(TORCH_CUDA_ARCH_LIST|CUDAARCHS)=/i.test(line))
|
|
18
|
+
if (filtered.length !== lines.length) {
|
|
19
|
+
const eol = content.includes("\r\n") ? "\r\n" : "\n"
|
|
20
|
+
await fs.promises.writeFile(script, filtered.join(eol))
|
|
21
|
+
}
|
|
22
|
+
}
|
|
5
23
|
async stashActivationScripts() {
|
|
6
24
|
if (this.kernel.platform !== "win32") {
|
|
7
25
|
return
|
|
@@ -28,6 +46,7 @@ class Cuda {
|
|
|
28
46
|
}
|
|
29
47
|
}
|
|
30
48
|
}
|
|
49
|
+
await this.patchCudaActivationScript()
|
|
31
50
|
}
|
|
32
51
|
async install(req, ondata) {
|
|
33
52
|
if (this.kernel.gpu === "nvidia") {
|
package/kernel/shell.js
CHANGED
|
@@ -1005,9 +1005,6 @@ class Shell {
|
|
|
1005
1005
|
if (cuda_script) {
|
|
1006
1006
|
conda_activation.push(`CALL "${cuda_script}" > nul 2>&1`)
|
|
1007
1007
|
}
|
|
1008
|
-
conda_activation.push("@echo off")
|
|
1009
|
-
conda_activation.push("set TORCH_CUDA_ARCH_LIST=")
|
|
1010
|
-
conda_activation.push("set CUDAARCHS=")
|
|
1011
1008
|
} catch (e) {
|
|
1012
1009
|
console.log('vc vars setup', e)
|
|
1013
1010
|
}
|