Austin Schuh | 8c267c7 | 2023-11-18 14:05:14 -0800 | [diff] [blame^] | 1 | #include "frc971/orin/cuda.h" |
| 2 | |
| 3 | #include "gflags/gflags.h" |
| 4 | #include "glog/logging.h" |
| 5 | |
| 6 | DEFINE_bool( |
| 7 | sync, false, |
| 8 | "If true, force synchronization after each step to isolate errors better."); |
| 9 | |
| 10 | namespace frc971 { |
| 11 | namespace apriltag { |
| 12 | |
| 13 | void CheckAndSynchronize() { |
| 14 | CHECK_CUDA(cudaDeviceSynchronize()); |
| 15 | CHECK_CUDA(cudaGetLastError()); |
| 16 | } |
| 17 | |
| 18 | void MaybeCheckAndSynchronize() { |
| 19 | if (FLAGS_sync) CheckAndSynchronize(); |
| 20 | } |
| 21 | |
| 22 | } // namespace apriltag |
| 23 | } // namespace frc971 |