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