xref: /libCEED/rust/libceed-sys/c-src/backends/memcheck/ceed-memcheck-serial.c (revision d9995aec8949465977409d138cd94b7dd885e51e)
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 
171ef3f58fSjeremylt #include "ceed-memcheck.h"
181ef3f58fSjeremylt 
19f10650afSjeremylt //------------------------------------------------------------------------------
20f10650afSjeremylt // Backend Init
21f10650afSjeremylt //------------------------------------------------------------------------------
221ef3f58fSjeremylt static int CeedInit_Memcheck(const char *resource, Ceed ceed) {
231ef3f58fSjeremylt   int ierr;
24*d9995aecSjeremylt   if (strcmp(resource, "/cpu/self/memcheck")
25*d9995aecSjeremylt       && strcmp(resource, "/cpu/self/memcheck/serial"))
261ef3f58fSjeremylt     // LCOV_EXCL_START
271ef3f58fSjeremylt     return CeedError(ceed, 1, "Valgrind Memcheck backend cannot use resource: %s",
281ef3f58fSjeremylt                      resource);
291ef3f58fSjeremylt   // LCOV_EXCL_STOP
301ef3f58fSjeremylt 
311ef3f58fSjeremylt   // Create refrence CEED that implementation will be dispatched
321ef3f58fSjeremylt   //   through unless overridden
331ef3f58fSjeremylt   Ceed ceedref;
341ef3f58fSjeremylt   CeedInit("/cpu/self/ref/serial", &ceedref);
351ef3f58fSjeremylt   ierr = CeedSetDelegate(ceed, ceedref); CeedChk(ierr);
361ef3f58fSjeremylt 
371ef3f58fSjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate",
381ef3f58fSjeremylt                                 CeedQFunctionCreate_Memcheck); CeedChk(ierr);
391ef3f58fSjeremylt 
401ef3f58fSjeremylt   return 0;
411ef3f58fSjeremylt }
421ef3f58fSjeremylt 
43f10650afSjeremylt //------------------------------------------------------------------------------
44f10650afSjeremylt // Backend Register
45f10650afSjeremylt //------------------------------------------------------------------------------
461ef3f58fSjeremylt __attribute__((constructor))
471ef3f58fSjeremylt static void Register(void) {
481ef3f58fSjeremylt   CeedRegister("/cpu/self/memcheck/serial", CeedInit_Memcheck, 100);
491ef3f58fSjeremylt }
50f10650afSjeremylt //------------------------------------------------------------------------------
51