xref: /libCEED/rust/libceed-sys/c-src/backends/xsmm/ceed-xsmm-serial.c (revision 5f67fade47e323fa44018f277580acfe24400ad4)
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 
178d713cf6Sjeremylt #include "ceed-xsmm.h"
188d713cf6Sjeremylt 
19f10650afSjeremylt //------------------------------------------------------------------------------
20f10650afSjeremylt // Backend Init
21f10650afSjeremylt //------------------------------------------------------------------------------
228d713cf6Sjeremylt static int CeedInit_Xsmm_Serial(const char *resource, Ceed ceed) {
238d713cf6Sjeremylt   int ierr;
24e0fc0447Sjeremylt   if (strcmp(resource, "/cpu/self")
25e0fc0447Sjeremylt       && strcmp(resource, "/cpu/self/xsmm/serial"))
26c042f62fSJeremy L Thompson     // LCOV_EXCL_START
278d713cf6Sjeremylt     return CeedError(ceed, 1, "serial libXSMM backend cannot use resource: %s",
288d713cf6Sjeremylt                      resource);
29c042f62fSJeremy L Thompson   // LCOV_EXCL_STOP
309525855cSJeremy L Thompson   ierr = CeedSetDeterministic(ceed, true); CeedChk(ierr);
318d713cf6Sjeremylt 
32*5f67fadeSJeremy L Thompson   // Create reference CEED that implementation will be dispatched
338d713cf6Sjeremylt   //   through unless overridden
346f7d248dSjeremylt   Ceed ceedref;
3589c6efa4Sjeremylt   CeedInit("/cpu/self/opt/serial", &ceedref);
36a4999eddSjeremylt   ierr = CeedSetDelegate(ceed, ceedref); CeedChk(ierr);
378d713cf6Sjeremylt 
382f86a920SJeremy L Thompson   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "TensorContractCreate",
392f86a920SJeremy L Thompson                                 CeedTensorContractCreate_Xsmm); CeedChk(ierr);
408d713cf6Sjeremylt 
418d713cf6Sjeremylt   return 0;
428d713cf6Sjeremylt }
438d713cf6Sjeremylt 
44f10650afSjeremylt //------------------------------------------------------------------------------
45f10650afSjeremylt // Backend Register
46f10650afSjeremylt //------------------------------------------------------------------------------
478d713cf6Sjeremylt __attribute__((constructor))
488d713cf6Sjeremylt static void Register(void) {
4989c6efa4Sjeremylt   CeedRegister("/cpu/self/xsmm/serial", CeedInit_Xsmm_Serial, 25);
508d713cf6Sjeremylt }
51f10650afSjeremylt //------------------------------------------------------------------------------
52