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*3d576824SJeremy L Thompson #include <ceed.h> 18*3d576824SJeremy L Thompson #include <ceed-backend.h> 19*3d576824SJeremy 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; 27d9995aecSjeremylt if (strcmp(resource, "/cpu/self/memcheck") 28d9995aecSjeremylt && strcmp(resource, "/cpu/self/memcheck/serial")) 291ef3f58fSjeremylt // LCOV_EXCL_START 301ef3f58fSjeremylt return CeedError(ceed, 1, "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/serial", &ceedref); 381ef3f58fSjeremylt ierr = CeedSetDelegate(ceed, ceedref); CeedChk(ierr); 391ef3f58fSjeremylt 401ef3f58fSjeremylt ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "QFunctionCreate", 411ef3f58fSjeremylt CeedQFunctionCreate_Memcheck); CeedChk(ierr); 421ef3f58fSjeremylt 431ef3f58fSjeremylt return 0; 441ef3f58fSjeremylt } 451ef3f58fSjeremylt 46f10650afSjeremylt //------------------------------------------------------------------------------ 47f10650afSjeremylt // Backend Register 48f10650afSjeremylt //------------------------------------------------------------------------------ 491d013790SJed Brown CEED_INTERN int CeedRegister_Memcheck_Serial(void) { 501d013790SJed Brown return CeedRegister("/cpu/self/memcheck/serial", CeedInit_Memcheck, 100); 511ef3f58fSjeremylt } 52f10650afSjeremylt //------------------------------------------------------------------------------ 53