1*3d8e8822SJeremy L Thompson // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2*3d8e8822SJeremy L Thompson // All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 31ef3f58fSjeremylt // 4*3d8e8822SJeremy L Thompson // SPDX-License-Identifier: BSD-2-Clause 51ef3f58fSjeremylt // 6*3d8e8822SJeremy L Thompson // This file is part of CEED: http://github.com/ceed 71ef3f58fSjeremylt 8ec3da8bcSJed Brown #include <ceed/ceed.h> 9ec3da8bcSJed Brown #include <ceed/backend.h> 103d576824SJeremy L Thompson #include <string.h> 111ef3f58fSjeremylt #include "ceed-memcheck.h" 121ef3f58fSjeremylt 13f10650afSjeremylt //------------------------------------------------------------------------------ 14f10650afSjeremylt // Backend Init 15f10650afSjeremylt //------------------------------------------------------------------------------ 161ef3f58fSjeremylt static int CeedInit_Memcheck(const char *resource, Ceed ceed) { 171ef3f58fSjeremylt int ierr; 181ef3f58fSjeremylt if (strcmp(resource, "/cpu/self/memcheck/blocked")) 191ef3f58fSjeremylt // LCOV_EXCL_START 20e15f9bd0SJeremy L Thompson return CeedError(ceed, CEED_ERROR_BACKEND, 21e15f9bd0SJeremy L Thompson "Valgrind Memcheck backend cannot use resource: %s", 221ef3f58fSjeremylt resource); 231ef3f58fSjeremylt // LCOV_EXCL_STOP 241ef3f58fSjeremylt 255f67fadeSJeremy L Thompson // Create reference CEED that implementation will be dispatched 261ef3f58fSjeremylt // through unless overridden 27d1d35e2fSjeremylt Ceed ceed_ref; 28d1d35e2fSjeremylt CeedInit("/cpu/self/ref/blocked", &ceed_ref); 29d1d35e2fSjeremylt ierr = CeedSetDelegate(ceed, ceed_ref); CeedChkBackend(ierr); 301ef3f58fSjeremylt 311ef3f58fSjeremylt ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate", 32e15f9bd0SJeremy L Thompson CeedQFunctionCreate_Memcheck); CeedChkBackend(ierr); 331ef3f58fSjeremylt 34e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 351ef3f58fSjeremylt } 361ef3f58fSjeremylt 37f10650afSjeremylt //------------------------------------------------------------------------------ 38f10650afSjeremylt // Backend Register 39f10650afSjeremylt //------------------------------------------------------------------------------ 401d013790SJed Brown CEED_INTERN int CeedRegister_Memcheck_Blocked(void) { 411d013790SJed Brown return CeedRegister("/cpu/self/memcheck/blocked", CeedInit_Memcheck, 110); 421ef3f58fSjeremylt } 43f10650afSjeremylt //------------------------------------------------------------------------------ 44