xref: /libCEED/rust/libceed-sys/c-src/backends/memcheck/ceed-memcheck-blocked.c (revision ec3da8bcb94d9f0073544b37b5081a06981a86f7)
11ef3f58fSjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
21ef3f58fSjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
31ef3f58fSjeremylt // All Rights reserved. See files LICENSE and NOTICE for details.
41ef3f58fSjeremylt //
51ef3f58fSjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software
61ef3f58fSjeremylt // libraries and APIs for efficient high-order finite element and spectral
71ef3f58fSjeremylt // element discretizations for exascale applications. For more information and
81ef3f58fSjeremylt // source code availability see http://github.com/ceed.
91ef3f58fSjeremylt //
101ef3f58fSjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
111ef3f58fSjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office
121ef3f58fSjeremylt // of Science and the National Nuclear Security Administration) responsible for
131ef3f58fSjeremylt // the planning and preparation of a capable exascale ecosystem, including
141ef3f58fSjeremylt // software, applications, hardware, advanced system engineering and early
151ef3f58fSjeremylt // testbed platforms, in support of the nation's exascale computing imperative.
161ef3f58fSjeremylt 
17*ec3da8bcSJed Brown #include <ceed/ceed.h>
18*ec3da8bcSJed Brown #include <ceed/backend.h>
193d576824SJeremy L Thompson #include <string.h>
201ef3f58fSjeremylt #include "ceed-memcheck.h"
211ef3f58fSjeremylt 
22f10650afSjeremylt //------------------------------------------------------------------------------
23f10650afSjeremylt // Backend Init
24f10650afSjeremylt //------------------------------------------------------------------------------
251ef3f58fSjeremylt static int CeedInit_Memcheck(const char *resource, Ceed ceed) {
261ef3f58fSjeremylt   int ierr;
271ef3f58fSjeremylt   if (strcmp(resource, "/cpu/self/memcheck/blocked"))
281ef3f58fSjeremylt     // LCOV_EXCL_START
29e15f9bd0SJeremy L Thompson     return CeedError(ceed, CEED_ERROR_BACKEND,
30e15f9bd0SJeremy L Thompson                      "Valgrind Memcheck backend cannot use resource: %s",
311ef3f58fSjeremylt                      resource);
321ef3f58fSjeremylt   // LCOV_EXCL_STOP
331ef3f58fSjeremylt 
345f67fadeSJeremy L Thompson   // Create reference CEED that implementation will be dispatched
351ef3f58fSjeremylt   //   through unless overridden
361ef3f58fSjeremylt   Ceed ceedref;
371ef3f58fSjeremylt   CeedInit("/cpu/self/ref/blocked", &ceedref);
38e15f9bd0SJeremy L Thompson   ierr = CeedSetDelegate(ceed, ceedref); CeedChkBackend(ierr);
391ef3f58fSjeremylt 
401ef3f58fSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate",
41e15f9bd0SJeremy L Thompson                                 CeedQFunctionCreate_Memcheck); CeedChkBackend(ierr);
421ef3f58fSjeremylt 
43e15f9bd0SJeremy L Thompson   return CEED_ERROR_SUCCESS;
441ef3f58fSjeremylt }
451ef3f58fSjeremylt 
46f10650afSjeremylt //------------------------------------------------------------------------------
47f10650afSjeremylt // Backend Register
48f10650afSjeremylt //------------------------------------------------------------------------------
491d013790SJed Brown CEED_INTERN int CeedRegister_Memcheck_Blocked(void) {
501d013790SJed Brown   return CeedRegister("/cpu/self/memcheck/blocked", CeedInit_Memcheck, 110);
511ef3f58fSjeremylt }
52f10650afSjeremylt //------------------------------------------------------------------------------
53