Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
kcelia committed Sep 25, 2024
1 parent 218c666 commit 40bc329
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
from pathlib import Path

import concrete.compiler
import numpy as np
import torch
from concrete.fhe import Configuration
Expand Down Expand Up @@ -74,8 +75,14 @@ def main(args):
# observe a decrease in torch's top1 accuracy when using MPS devices
# FIXME: https://github.com/zama-ai/concrete-ml-internal/issues/3953
device = "cuda" if torch.cuda.is_available() else "cpu"
compilation_device = "cuda" if concrete.compiler.check_gpu_available() else "cpu"

print("Device in use:", device)
print("Torch device in use:", device)
print(
"To leverage the CUDA backend, follow the GPU setup guide to install the Concrete ML compiler."
)
print("GPU Enabled:", concrete.compiler.check_gpu_enabled())
print("GPU Available:", concrete.compiler.check_gpu_available())

# Find relative path to this file
dir_path = Path(__file__).parent.absolute()
Expand Down Expand Up @@ -123,7 +130,7 @@ def main(args):
if rounding_threshold_bits is not None
else None
),
device=COMPILATION_DEVICE,
device=compilation_device,
)

# Print max bit-width in the circuit
Expand Down
2 changes: 1 addition & 1 deletion use_case_examples/resnet/run_resnet18_fhe.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def main():
"--export_statistics", action="store_true", help="Export the circuit statistics."
)
parser.add_argument(
"--use_gpu", type=bool, action="store_true", help="Use the available GPU at FHE runtime."
"--use_gpu", action="store_true", help="Use the available GPU at FHE runtime."
)
parser.add_argument(
"--run_experiment",
Expand Down

0 comments on commit 40bc329

Please sign in to comment.