1*7cd70835SJames Wright // Copyright (c) 2017-2023, Lawrence Livermore National Security, LLC and other CEED contributors. 2*7cd70835SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3*7cd70835SJames Wright // 4*7cd70835SJames Wright // SPDX-License-Identifier: BSD-2-Clause 5*7cd70835SJames Wright // 6*7cd70835SJames Wright // This file is part of CEED: http://github.com/ceed 7*7cd70835SJames Wright 8*7cd70835SJames Wright #include <c_client.h> 9*7cd70835SJames Wright #include <petscsys.h> 10*7cd70835SJames Wright #include <sr_enums.h> 11*7cd70835SJames Wright 12*7cd70835SJames Wright #if defined(__clang_analyzer__) 13*7cd70835SJames Wright void SmartRedisCall(SRError); 14*7cd70835SJames Wright #else 15*7cd70835SJames Wright #define SmartRedisCall(...) \ 16*7cd70835SJames Wright do { \ 17*7cd70835SJames Wright SRError ierr_smartredis_call_q_; \ 18*7cd70835SJames Wright PetscBool disable_calls = PETSC_FALSE; \ 19*7cd70835SJames Wright PetscStackUpdateLine; \ 20*7cd70835SJames Wright PetscCall(PetscOptionsGetBool(NULL, NULL, "-smartsim_disable_calls", &disable_calls, NULL)); \ 21*7cd70835SJames Wright if (disable_calls == PETSC_TRUE) break; \ 22*7cd70835SJames Wright ierr_smartredis_call_q_ = __VA_ARGS__; \ 23*7cd70835SJames Wright if (PetscUnlikely(ierr_smartredis_call_q_ != SRNoError)) \ 24*7cd70835SJames Wright SETERRQ(PETSC_COMM_SELF, ierr_smartredis_call_q_, "SmartRedis Error (Code %d): %s", ierr_smartredis_call_q_, SRGetLastError()); \ 25*7cd70835SJames Wright } while (0) 26*7cd70835SJames Wright #endif 27*7cd70835SJames Wright 28*7cd70835SJames Wright PetscErrorCode SmartRedisVerifyPutTensor(void *c_client, const char *name, const size_t name_length); 29