pinokiod 5.1.31 → 5.1.33
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 +27 -1
- package/kernel/shell.js +8 -3
- package/package.json +1 -1
package/kernel/bin/cuda.js
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
const semver = require('semver')
|
|
2
2
|
const fs = require('fs')
|
|
3
3
|
const path = require('path')
|
|
4
|
+
const { glob } = require('glob')
|
|
4
5
|
class Cuda {
|
|
6
|
+
async hasNvTargetHeader() {
|
|
7
|
+
const prefix = this.kernel.bin.path("miniconda")
|
|
8
|
+
const patterns = [
|
|
9
|
+
"Library/include/nv/target",
|
|
10
|
+
"include/nv/target",
|
|
11
|
+
"Library/targets/*/include/nv/target",
|
|
12
|
+
"targets/*/include/nv/target",
|
|
13
|
+
]
|
|
14
|
+
for (const pattern of patterns) {
|
|
15
|
+
if (pattern.includes("*")) {
|
|
16
|
+
try {
|
|
17
|
+
const matches = await glob(pattern, { cwd: prefix, absolute: true, nodir: true })
|
|
18
|
+
if (matches && matches.length > 0) {
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {}
|
|
22
|
+
} else {
|
|
23
|
+
try {
|
|
24
|
+
await fs.promises.stat(path.resolve(prefix, pattern))
|
|
25
|
+
return true
|
|
26
|
+
} catch (e) {}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
5
31
|
async patchCudaActivationScript() {
|
|
6
32
|
if (this.kernel.platform !== "win32") {
|
|
7
33
|
return
|
|
@@ -98,7 +124,7 @@ class Cuda {
|
|
|
98
124
|
console.log("cuda version", coerced)
|
|
99
125
|
if (semver.satisfies(coerced, ">=12.8.1")) {
|
|
100
126
|
console.log("cuda satisfied")
|
|
101
|
-
if (!this.
|
|
127
|
+
if (!(await this.hasNvTargetHeader())) {
|
|
102
128
|
return false
|
|
103
129
|
}
|
|
104
130
|
let deactivate_list = [
|
package/kernel/shell.js
CHANGED
|
@@ -973,6 +973,11 @@ class Shell {
|
|
|
973
973
|
}
|
|
974
974
|
|
|
975
975
|
const activate_root = this.kernel.bin.path("miniconda/etc/conda/activate.d")
|
|
976
|
+
const logDir = this.kernel.path("cache", "logs")
|
|
977
|
+
await fs.promises.mkdir(logDir, { recursive: true }).catch(() => {})
|
|
978
|
+
const logSuffix = this.id || Date.now()
|
|
979
|
+
const compiler_log = path.resolve(logDir, `vs-${logSuffix}.log`)
|
|
980
|
+
const cuda_log = path.resolve(logDir, `cuda-${logSuffix}.log`)
|
|
976
981
|
const compiler_candidates = [
|
|
977
982
|
path.resolve(activate_root, "pinokio", "vs2019_compiler_vars.bat"),
|
|
978
983
|
path.resolve(activate_root, "pinokio", "vs2022_compiler_vars.bat"),
|
|
@@ -987,9 +992,9 @@ class Shell {
|
|
|
987
992
|
}
|
|
988
993
|
}
|
|
989
994
|
if (compiler_script) {
|
|
990
|
-
conda_activation.push(`CALL "${compiler_script}" >
|
|
995
|
+
conda_activation.push(`CALL "${compiler_script}" > "${compiler_log}" 2>&1`)
|
|
991
996
|
} else if (vcvars_path && arg) {
|
|
992
|
-
conda_activation.push(`CALL "${vcvars_path}" ${arg} >
|
|
997
|
+
conda_activation.push(`CALL "${vcvars_path}" ${arg} > "${compiler_log}" 2>&1`)
|
|
993
998
|
}
|
|
994
999
|
const cuda_candidates = [
|
|
995
1000
|
path.resolve(activate_root, "pinokio", "~cuda-nvcc_activate.bat"),
|
|
@@ -1003,7 +1008,7 @@ class Shell {
|
|
|
1003
1008
|
}
|
|
1004
1009
|
}
|
|
1005
1010
|
if (cuda_script) {
|
|
1006
|
-
conda_activation.push(`CALL "${cuda_script}" >
|
|
1011
|
+
conda_activation.push(`CALL "${cuda_script}" > "${cuda_log}" 2>&1`)
|
|
1007
1012
|
}
|
|
1008
1013
|
} catch (e) {
|
|
1009
1014
|
console.log('vc vars setup', e)
|