Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruinong Tian committed Jul 9, 2024
1 parent 7263d42 commit f02ac49
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
14 changes: 8 additions & 6 deletions test/test_artifacts/v0/scripts/cuda_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
import subprocess

# Run the micromamba list command and capture the output
result = subprocess.run(['micromamba', 'list'], stdout=subprocess.PIPE, text=True)
result = subprocess.run(["micromamba", "list"], stdout=subprocess.PIPE, text=True)

# Split the output into lines
package_lines = result.stdout.strip().split('\n')
package_lines = result.stdout.strip().split("\n")

# Find the PyTorch entry
pytorch_entry = None
for line in package_lines:
dependency_info = line.strip().split()
if dependency_info and dependency_info[0] == 'pytorch':
if dependency_info and dependency_info[0] == "pytorch":
pytorch_entry = line.split()
break

Expand All @@ -31,7 +31,7 @@
package_build = pytorch_entry[2]
print(f"PyTorch: {package_name} {package_version} {package_build}")
# Raise exception if CUDA is not detected
if 'cuda' not in package_build:
if "cuda" not in package_build:
raise Exception("Pytorch is installed without CUDA support for GPU image build.")

# Verify Pytorch has CUDA working properly
Expand All @@ -40,5 +40,7 @@
import torch

if not torch.cuda.is_available():
raise Exception("Pytorch is installed with CUDA support but not working in current environment. \
Make sure to execute this test case in GPU environment if you are not")
raise Exception(
"Pytorch is installed with CUDA support but not working in current environment. \
Make sure to execute this test case in GPU environment if you are not"
)
14 changes: 8 additions & 6 deletions test/test_artifacts/v1/scripts/cuda_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
import subprocess

# Run the micromamba list command and capture the output
result = subprocess.run(['micromamba', 'list'], stdout=subprocess.PIPE, text=True)
result = subprocess.run(["micromamba", "list"], stdout=subprocess.PIPE, text=True)

# Split the output into lines
package_lines = result.stdout.strip().split('\n')
package_lines = result.stdout.strip().split("\n")

# Find the PyTorch entry
pytorch_entry = None
for line in package_lines:
dependency_info = line.strip().split()
if dependency_info and dependency_info[0] == 'pytorch':
if dependency_info and dependency_info[0] == "pytorch":
pytorch_entry = line.split()
break

Expand All @@ -31,7 +31,7 @@
package_build = pytorch_entry[2]
print(f"PyTorch: {package_name} {package_version} {package_build}")
# Raise exception if CUDA is not detected
if 'cuda' not in package_build:
if "cuda" not in package_build:
raise Exception("Pytorch is installed without CUDA support for GPU image build.")

# Verify Pytorch has CUDA working properly
Expand All @@ -40,5 +40,7 @@
import torch

if not torch.cuda.is_available():
raise Exception("Pytorch is installed with CUDA support but not working in current environment. \
Make sure to execute this test case in GPU environment if you are not")
raise Exception(
"Pytorch is installed with CUDA support but not working in current environment. \
Make sure to execute this test case in GPU environment if you are not"
)
14 changes: 8 additions & 6 deletions test/test_artifacts/v2/scripts/cuda_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
import subprocess

# Run the micromamba list command and capture the output
result = subprocess.run(['micromamba', 'list'], stdout=subprocess.PIPE, text=True)
result = subprocess.run(["micromamba", "list"], stdout=subprocess.PIPE, text=True)

# Split the output into lines
package_lines = result.stdout.strip().split('\n')
package_lines = result.stdout.strip().split("\n")

# Find the PyTorch entry
pytorch_entry = None
for line in package_lines:
dependency_info = line.strip().split()
if dependency_info and dependency_info[0] == 'pytorch':
if dependency_info and dependency_info[0] == "pytorch":
pytorch_entry = line.split()
break

Expand All @@ -31,7 +31,7 @@
package_build = pytorch_entry[2]
print(f"PyTorch: {package_name} {package_version} {package_build}")
# Raise exception if CUDA is not detected
if 'cuda' not in package_build:
if "cuda" not in package_build:
raise Exception("Pytorch is installed without CUDA support for GPU image build.")

# Verify Pytorch has CUDA working properly
Expand All @@ -40,5 +40,7 @@
import torch

if not torch.cuda.is_available():
raise Exception("Pytorch is installed with CUDA support but not working in current environment. \
Make sure to execute this test case in GPU environment if you are not")
raise Exception(
"Pytorch is installed with CUDA support but not working in current environment. \
Make sure to execute this test case in GPU environment if you are not"
)

0 comments on commit f02ac49

Please sign in to comment.