From d8e05684b589a02e660b2868d9256b5cde06ccc8 Mon Sep 17 00:00:00 2001
From: Russel Arbore <rarbore2@illinois.edu>
Date: Tue, 14 Jan 2025 16:47:56 -0600
Subject: [PATCH] use cuda as default device if cuda feature present

---
 hercules_cg/Cargo.toml    | 3 +++
 hercules_cg/src/device.rs | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/hercules_cg/Cargo.toml b/hercules_cg/Cargo.toml
index cf0767de..0952ee57 100644
--- a/hercules_cg/Cargo.toml
+++ b/hercules_cg/Cargo.toml
@@ -4,6 +4,9 @@ version = "0.1.0"
 authors = ["Russel Arbore <rarbore2@illinois.edu>"]
 edition = "2021"
 
+[features]
+cuda = []
+
 [dependencies]
 rand = "*"
 ordered-float = "*"
diff --git a/hercules_cg/src/device.rs b/hercules_cg/src/device.rs
index 866fa6ad..9f71c1a7 100644
--- a/hercules_cg/src/device.rs
+++ b/hercules_cg/src/device.rs
@@ -13,6 +13,8 @@ pub fn device_placement(functions: &Vec<Function>, callgraph: &CallGraph) -> Vec
             devices.push(device);
         } else if function.entry || callgraph.num_callees(FunctionID::new(idx)) != 0 {
             devices.push(Device::AsyncRust);
+        } else if cfg!(feature = "cuda") {
+            devices.push(Device::CUDA);
         } else {
             devices.push(Device::LLVM);
         }
-- 
GitLab