diff --git a/bin/run-model/src/run-model/main.cc b/bin/run-model/src/run-model/main.cc index 1f53a77ed5..8be2df68a0 100644 --- a/bin/run-model/src/run-model/main.cc +++ b/bin/run-model/src/run-model/main.cc @@ -95,6 +95,13 @@ int main(int argc, char **argv) { /*workSpaceSize=*/1024 * 1024, /*allowTensorOpMathConversion=*/true); + bool has_gpus = []() { + FlexFlow::Realm::Machine::ProcessorQuery pq( + FlexFlow::Realm::Machine::get_machine()); + pq.only_kind(FlexFlow::Realm::Processor::Kind::TOC_PROC); + return pq.count() > 0; + }(); + PCGInstance pcg_instance = create_pcg_instance( /*ctx=*/ctx, /*mpcg=*/mpcg, @@ -103,7 +110,7 @@ int main(int argc, char **argv) { /*input_tensors=*/input_tensors, /*profiling_settings=*/ProfilingSettings{0_n, 1_p}, /*device_handle=*/device_handle, - /*device_type=*/DeviceType::GPU); + /*device_type=*/has_gpus ? DeviceType::GPU : DeviceType::CPU); // begin training loop int num_epochs = 5;