monarch_rdma/
macros.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9#[macro_export]
10macro_rules! cu_check {
11    ($result:expr) => {
12        if $result != cuda_sys::CUresult::CUDA_SUCCESS {
13            let mut error_string: *const i8 = std::ptr::null();
14            cuda_sys::cuGetErrorString($result, &mut error_string);
15            panic!(
16                "cuda failure {}:{} {:?} '{}'",
17                file!(),
18                line!(),
19                $result,
20                std::ffi::CStr::from_ptr(error_string).to_string_lossy()
21            );
22        }
23    };
24}