try to set cuda pcie order first thing

This commit is contained in:
Concedo 2025-06-18 20:25:38 +08:00
parent a8d33ebb0d
commit e0a7694328

View file

@ -8,10 +8,14 @@
# editing tools, save formats, memory, world info, author's note, characters, # editing tools, save formats, memory, world info, author's note, characters,
# scenarios and everything Kobold and KoboldAI Lite have to offer. # scenarios and everything Kobold and KoboldAI Lite have to offer.
import os
try:
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # try set GPU to PCI order first thing
except Exception:
pass
import copy import copy
import ctypes import ctypes
import multiprocessing import multiprocessing
import os
import math import math
import re import re
import argparse import argparse
@ -574,7 +578,7 @@ def set_backend_props(inputs):
inputs.kcpp_main_gpu = args.maingpu inputs.kcpp_main_gpu = args.maingpu
if args.usecublas: if args.usecublas:
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
if not args.tensor_split: if not args.tensor_split:
if (args.usecublas and "0" in args.usecublas): if (args.usecublas and "0" in args.usecublas):
os.environ["CUDA_VISIBLE_DEVICES"] = "0" os.environ["CUDA_VISIBLE_DEVICES"] = "0"