18d713cf6Sjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC. 28d713cf6Sjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707. 38d713cf6Sjeremylt // All Rights reserved. See files LICENSE and NOTICE for details. 48d713cf6Sjeremylt // 58d713cf6Sjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software 68d713cf6Sjeremylt // libraries and APIs for efficient high-order finite element and spectral 78d713cf6Sjeremylt // element discretizations for exascale applications. For more information and 88d713cf6Sjeremylt // source code availability see http://github.com/ceed. 98d713cf6Sjeremylt // 108d713cf6Sjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC, 118d713cf6Sjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office 128d713cf6Sjeremylt // of Science and the National Nuclear Security Administration) responsible for 138d713cf6Sjeremylt // the planning and preparation of a capable exascale ecosystem, including 148d713cf6Sjeremylt // software, applications, hardware, advanced system engineering and early 158d713cf6Sjeremylt // testbed platforms, in support of the nation's exascale computing imperative. 168d713cf6Sjeremylt 17ec3da8bcSJed Brown #include <ceed/ceed.h> 18ec3da8bcSJed Brown #include <ceed/backend.h> 193d576824SJeremy L Thompson #include <stdbool.h> 203d576824SJeremy L Thompson #include <string.h> 218d713cf6Sjeremylt #include "ceed-xsmm.h" 228d713cf6Sjeremylt 23f10650afSjeremylt //------------------------------------------------------------------------------ 24f10650afSjeremylt // Backend Init 25f10650afSjeremylt //------------------------------------------------------------------------------ 268d713cf6Sjeremylt static int CeedInit_Xsmm_Serial(const char *resource, Ceed ceed) { 278d713cf6Sjeremylt int ierr; 28e0fc0447Sjeremylt if (strcmp(resource, "/cpu/self") 29e0fc0447Sjeremylt && strcmp(resource, "/cpu/self/xsmm/serial")) 30c042f62fSJeremy L Thompson // LCOV_EXCL_START 31e15f9bd0SJeremy L Thompson return CeedError(ceed, CEED_ERROR_BACKEND, 32e15f9bd0SJeremy L Thompson "serial libXSMM backend cannot use resource: %s", 338d713cf6Sjeremylt resource); 34c042f62fSJeremy L Thompson // LCOV_EXCL_STOP 35e15f9bd0SJeremy L Thompson ierr = CeedSetDeterministic(ceed, true); CeedChkBackend(ierr); 368d713cf6Sjeremylt 375f67fadeSJeremy L Thompson // Create reference CEED that implementation will be dispatched 388d713cf6Sjeremylt // through unless overridden 39*d1d35e2fSjeremylt Ceed ceed_ref; 40*d1d35e2fSjeremylt CeedInit("/cpu/self/opt/serial", &ceed_ref); 41*d1d35e2fSjeremylt ierr = CeedSetDelegate(ceed, ceed_ref); CeedChkBackend(ierr); 428d713cf6Sjeremylt 432f86a920SJeremy L Thompson ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "TensorContractCreate", 44e15f9bd0SJeremy L Thompson CeedTensorContractCreate_Xsmm); CeedChkBackend(ierr); 458d713cf6Sjeremylt 46e15f9bd0SJeremy L Thompson return CEED_ERROR_SUCCESS; 478d713cf6Sjeremylt } 488d713cf6Sjeremylt 49f10650afSjeremylt //------------------------------------------------------------------------------ 50f10650afSjeremylt // Backend Register 51f10650afSjeremylt //------------------------------------------------------------------------------ 521d013790SJed Brown CEED_INTERN int CeedRegister_Xsmm_Serial(void) { 531d013790SJed Brown return CeedRegister("/cpu/self/xsmm/serial", CeedInit_Xsmm_Serial, 25); 548d713cf6Sjeremylt } 55f10650afSjeremylt //------------------------------------------------------------------------------ 56