Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 367a698

Browse files
committed
refactor: shorten query
1 parent ba4d4f6 commit 367a698

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

cortex-js/src/infrastructure/commanders/init.command.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ export class InitCommand extends CommandRunner {
160160
let filesCuda12: string[]
161161
let filesCuda11: string[]
162162
let paths: string[]
163-
let cudaVersion: string = ''
164163

165164
if (process.platform === 'win32') {
166165
filesCuda12 = ['cublas64_12.dll', 'cudart64_12.dll', 'cublasLt64_12.dll']
@@ -175,21 +174,16 @@ export class InitCommand extends CommandRunner {
175174
paths.push('/usr/lib/x86_64-linux-gnu/')
176175
}
177176

178-
let cudaExists = filesCuda12.every(
177+
if (filesCuda12.every(
179178
(file) => existsSync(file) || this.checkFileExistenceInPaths(file, paths)
180-
)
179+
)) return '12'
181180

182-
if (!cudaExists) {
183-
cudaExists = filesCuda11.every(
184-
(file) => existsSync(file) || this.checkFileExistenceInPaths(file, paths)
185-
)
186-
if (cudaExists) {
187-
cudaVersion = '11'
188-
}
189-
} else {
190-
cudaVersion = '12'
191-
}
192-
return cudaExists ? cudaVersion : undefined
181+
182+
if (filesCuda11.every(
183+
(file) => existsSync(file) || this.checkFileExistenceInPaths(file, paths)
184+
)) return '11'
185+
186+
return undefined // No CUDA Toolkit found
193187
}
194188

195189
checkFileExistenceInPaths = (file: string, paths: string[]): boolean => {
@@ -200,7 +194,7 @@ export class InitCommand extends CommandRunner {
200194
const platform = process.platform === 'win32' ? 'windows' : 'linux'
201195

202196
const url = this.CUDA_DOWNLOAD_URL
203-
.replace('<version>', options.cudaVersion === '11' ? '11.7' : '12.4')
197+
.replace('<version>', options.cudaVersion === '11' ? '11.7' : '12.0')
204198
.replace('<platform>', platform)
205199
const destination = resolve(this.rootDir(), 'cuda-toolkit.tar.gz');
206200

0 commit comments

Comments
 (0)