pinokiod 5.1.23 → 5.1.25

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.
@@ -2,19 +2,7 @@ const semver = require('semver')
2
2
  const fs = require('fs')
3
3
  const path = require('path')
4
4
  class Cuda {
5
- async restoreCudaActivationScript() {
6
- if (this.kernel.platform !== "win32") {
7
- return
8
- }
9
- const folder = this.kernel.bin.path("miniconda/etc/conda/activate.d")
10
- try {
11
- await fs.promises.rename(
12
- path.resolve(folder, "~cuda-nvcc_activate.bat.disabled"),
13
- path.resolve(folder, "~cuda-nvcc_activate.bat")
14
- )
15
- } catch (e) {}
16
- }
17
- async stashCompilerVarsScripts() {
5
+ async stashActivationScripts() {
18
6
  if (this.kernel.platform !== "win32") {
19
7
  return
20
8
  }
@@ -22,6 +10,7 @@ class Cuda {
22
10
  const stash = path.resolve(folder, "pinokio")
23
11
  await fs.promises.mkdir(stash, { recursive: true }).catch(() => {})
24
12
  const scripts = [
13
+ "~cuda-nvcc_activate.bat",
25
14
  "vs2019_compiler_vars.bat",
26
15
  "vs2022_compiler_vars.bat",
27
16
  ]
@@ -55,8 +44,7 @@ class Cuda {
55
44
  "conda install -y nvidia/label/cuda-12.8.1::cuda"
56
45
  ]
57
46
  }, ondata)
58
- await this.restoreCudaActivationScript()
59
- await this.stashCompilerVarsScripts()
47
+ await this.stashActivationScripts()
60
48
  } else {
61
49
  await this.kernel.bin.exec({
62
50
  message: [
@@ -83,8 +71,7 @@ class Cuda {
83
71
  async installed() {
84
72
  if (this.kernel.gpu === "nvidia") {
85
73
  if (this.kernel.platform === 'win32') {
86
- await this.restoreCudaActivationScript()
87
- await this.stashCompilerVarsScripts()
74
+ await this.stashActivationScripts()
88
75
  if (this.kernel.bin.installed.conda.has("cudnn") && this.kernel.bin.installed.conda.has("cuda") && this.kernel.bin.installed.conda.has("libzlib-wapi")) {
89
76
  let version = this.kernel.bin.installed.conda_versions.cuda
90
77
  if (version) {
package/kernel/shell.js CHANGED
@@ -973,16 +973,39 @@ class Shell {
973
973
  }
974
974
 
975
975
  const compiler_log = '"%TEMP%\\pinokio-vs.log"'
976
- const compiler_cmd = [
977
- `if exist "%CONDA_PREFIX%\\etc\\conda\\activate.d\\pinokio\\vs2019_compiler_vars.bat" (call "%CONDA_PREFIX%\\etc\\conda\\activate.d\\pinokio\\vs2019_compiler_vars.bat" > ${compiler_log} 2>&1)`,
978
- `else if exist "%CONDA_PREFIX%\\etc\\conda\\activate.d\\pinokio\\vs2022_compiler_vars.bat" (call "%CONDA_PREFIX%\\etc\\conda\\activate.d\\pinokio\\vs2022_compiler_vars.bat" > ${compiler_log} 2>&1)`,
979
- `else if exist "%CONDA_PREFIX%\\etc\\conda\\activate.d\\vs2019_compiler_vars.bat" (call "%CONDA_PREFIX%\\etc\\conda\\activate.d\\vs2019_compiler_vars.bat" > ${compiler_log} 2>&1)`,
980
- `else if exist "%CONDA_PREFIX%\\etc\\conda\\activate.d\\vs2022_compiler_vars.bat" (call "%CONDA_PREFIX%\\etc\\conda\\activate.d\\vs2022_compiler_vars.bat" > ${compiler_log} 2>&1)`,
976
+ const activate_root = this.kernel.bin.path("miniconda/etc/conda/activate.d")
977
+ const compiler_candidates = [
978
+ path.resolve(activate_root, "pinokio", "vs2019_compiler_vars.bat"),
979
+ path.resolve(activate_root, "pinokio", "vs2022_compiler_vars.bat"),
980
+ path.resolve(activate_root, "vs2019_compiler_vars.bat"),
981
+ path.resolve(activate_root, "vs2022_compiler_vars.bat"),
981
982
  ]
982
- if (vcvars_path && arg) {
983
- compiler_cmd.push(`else if exist "${vcvars_path}" (CALL "${vcvars_path}" ${arg} > ${compiler_log} 2>&1)`)
983
+ let compiler_script = null
984
+ for (const candidate of compiler_candidates) {
985
+ if (await this.exists(candidate)) {
986
+ compiler_script = candidate
987
+ break
988
+ }
989
+ }
990
+ if (compiler_script) {
991
+ conda_activation.push(`CALL "${compiler_script}" > ${compiler_log} 2>&1`)
992
+ } else if (vcvars_path && arg) {
993
+ conda_activation.push(`CALL "${vcvars_path}" ${arg} > ${compiler_log} 2>&1`)
994
+ }
995
+ const cuda_candidates = [
996
+ path.resolve(activate_root, "pinokio", "~cuda-nvcc_activate.bat"),
997
+ path.resolve(activate_root, "~cuda-nvcc_activate.bat"),
998
+ ]
999
+ let cuda_script = null
1000
+ for (const candidate of cuda_candidates) {
1001
+ if (await this.exists(candidate)) {
1002
+ cuda_script = candidate
1003
+ break
1004
+ }
1005
+ }
1006
+ if (cuda_script) {
1007
+ conda_activation.push(`CALL "${cuda_script}" > ${compiler_log} 2>&1`)
984
1008
  }
985
- conda_activation.push(compiler_cmd.join(" "))
986
1009
  conda_activation.push("@echo off")
987
1010
  conda_activation.push("set TORCH_CUDA_ARCH_LIST=")
988
1011
  conda_activation.push("set CUDAARCHS=")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "5.1.23",
3
+ "version": "5.1.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {