1*ae2b091fSJames Wright // SPDX-FileCopyrightText: Copyright (c) 2017-2024, HONEE contributors. 2*ae2b091fSJames Wright // SPDX-License-Identifier: Apache-2.0 OR BSD-2-Clause 318fb7758SJeremy L Thompson #pragma once 47cd70835SJames Wright 57cd70835SJames Wright #include <c_client.h> 67cd70835SJames Wright #include <petscsys.h> 77cd70835SJames Wright #include <sr_enums.h> 87cd70835SJames Wright 97cd70835SJames Wright #if defined(__clang_analyzer__) 1043e9749fSJames Wright void PetscCallSmartRedis(SRError); 117cd70835SJames Wright #else 1243e9749fSJames Wright #define PetscCallSmartRedis(...) \ 137cd70835SJames Wright do { \ 147cd70835SJames Wright SRError ierr_smartredis_call_q_; \ 157cd70835SJames Wright PetscBool disable_calls = PETSC_FALSE; \ 167cd70835SJames Wright PetscStackUpdateLine; \ 177cd70835SJames Wright PetscCall(PetscOptionsGetBool(NULL, NULL, "-smartsim_disable_calls", &disable_calls, NULL)); \ 187cd70835SJames Wright if (disable_calls == PETSC_TRUE) break; \ 197cd70835SJames Wright ierr_smartredis_call_q_ = __VA_ARGS__; \ 207cd70835SJames Wright if (PetscUnlikely(ierr_smartredis_call_q_ != SRNoError)) \ 214fa1625aSJames Wright SETERRQ(PETSC_COMM_SELF, (PetscErrorCode)ierr_smartredis_call_q_, "SmartRedis Error (Code %d): %s", ierr_smartredis_call_q_, \ 224fa1625aSJames Wright SRGetLastError()); \ 237cd70835SJames Wright } while (0) 247cd70835SJames Wright #endif 257cd70835SJames Wright 267cd70835SJames Wright PetscErrorCode SmartRedisVerifyPutTensor(void *c_client, const char *name, const size_t name_length); 27