LTT commited on
Commit
651c39e
1 Parent(s): 88b2f9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -2,7 +2,9 @@ import spaces
2
  import os
3
  os.environ["CXX"] = os.popen("which g++").read().strip()
4
  os.environ["CC"] = os.popen("which gcc").read().strip()
5
- os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
 
 
6
  import imageio
7
  import numpy as np
8
  import torch
@@ -80,15 +82,14 @@ if cuda_path:
80
  print(f"CUDA installation found at: {cuda_path}")
81
  else:
82
  print("CUDA installation not found")
83
- import os
84
-
85
- # 确保 CUDA_HOME 设置正确
86
- os.environ["CUDA_HOME"] = "/usr/local/cuda"
87
- os.environ["PATH"] += os.pathsep + os.path.join(os.environ["CUDA_HOME"], "bin")
88
- os.environ["LD_LIBRARY_PATH"] = os.environ.get("LD_LIBRARY_PATH", "") + os.pathsep + os.path.join(os.environ["CUDA_HOME"], "lib64")
89
 
 
 
 
 
 
90
  print(f"GPU: {torch.cuda.is_available()}")
91
- a = torch.tensor([0]).cuda()
92
  if torch.cuda.is_available() and torch.cuda.device_count() >= 2:
93
  device0 = torch.device('cuda:0')
94
  device1 = torch.device('cuda:0')
 
2
  import os
3
  os.environ["CXX"] = os.popen("which g++").read().strip()
4
  os.environ["CC"] = os.popen("which gcc").read().strip()
5
+ os.environ['CUDA_LAUNCH_BLOCKING']="1"
6
+ os.environ['TORCH_USE_CUDA_DSA'] = "1"
7
+ import nvdiffrast.torch as dr
8
  import imageio
9
  import numpy as np
10
  import torch
 
82
  print(f"CUDA installation found at: {cuda_path}")
83
  else:
84
  print("CUDA installation not found")
85
+ # import os
 
 
 
 
 
86
 
87
+ # # 确保 CUDA_HOME 设置正确
88
+ # os.environ["CUDA_HOME"] = "/usr/local/cuda"
89
+ # os.environ["PATH"] += os.pathsep + os.path.join(os.environ["CUDA_HOME"], "bin")
90
+ # os.environ["LD_LIBRARY_PATH"] = os.environ.get("LD_LIBRARY_PATH", "") + os.pathsep + os.path.join(os.environ["CUDA_HOME"], "lib64")
91
+ GLCTX = dr.RasterizeCudaContext()
92
  print(f"GPU: {torch.cuda.is_available()}")
 
93
  if torch.cuda.is_available() and torch.cuda.device_count() >= 2:
94
  device0 = torch.device('cuda:0')
95
  device1 = torch.device('cuda:0')