xref: /libCEED/rust/libceed-sys/c-src/backends/xsmm/ceed-xsmm-serial.c (revision 8d713cf6e78a6ffd2518ae96db9cfdbd22a60f79)
1*8d713cf6Sjeremylt // Copyright (c) 2017-2018, Lawrence Livermore National Security, LLC.
2*8d713cf6Sjeremylt // Produced at the Lawrence Livermore National Laboratory. LLNL-CODE-734707.
3*8d713cf6Sjeremylt // All Rights reserved. See files LICENSE and NOTICE for details.
4*8d713cf6Sjeremylt //
5*8d713cf6Sjeremylt // This file is part of CEED, a collection of benchmarks, miniapps, software
6*8d713cf6Sjeremylt // libraries and APIs for efficient high-order finite element and spectral
7*8d713cf6Sjeremylt // element discretizations for exascale applications. For more information and
8*8d713cf6Sjeremylt // source code availability see http://github.com/ceed.
9*8d713cf6Sjeremylt //
10*8d713cf6Sjeremylt // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11*8d713cf6Sjeremylt // a collaborative effort of two U.S. Department of Energy organizations (Office
12*8d713cf6Sjeremylt // of Science and the National Nuclear Security Administration) responsible for
13*8d713cf6Sjeremylt // the planning and preparation of a capable exascale ecosystem, including
14*8d713cf6Sjeremylt // software, applications, hardware, advanced system engineering and early
15*8d713cf6Sjeremylt // testbed platforms, in support of the nation's exascale computing imperative.
16*8d713cf6Sjeremylt 
17*8d713cf6Sjeremylt #include <string.h>
18*8d713cf6Sjeremylt #include "ceed-xsmm.h"
19*8d713cf6Sjeremylt 
20*8d713cf6Sjeremylt static int CeedInit_Xsmm_Serial(const char *resource, Ceed ceed) {
21*8d713cf6Sjeremylt   int ierr;
22*8d713cf6Sjeremylt   if (strcmp(resource, "/cpu/self/xsmm/serial"))
23*8d713cf6Sjeremylt     return CeedError(ceed, 1, "serial libXSMM backend cannot use resource: %s",
24*8d713cf6Sjeremylt       resource);
25*8d713cf6Sjeremylt 
26*8d713cf6Sjeremylt   Ceed ceedref;
27*8d713cf6Sjeremylt 
28*8d713cf6Sjeremylt   // Create refrence CEED that implementation will be dispatched
29*8d713cf6Sjeremylt   //   through unless overridden
30*8d713cf6Sjeremylt   CeedInit("/cpu/self/ref", &ceedref);
31*8d713cf6Sjeremylt   ierr = CeedSetDelegate(ceed, &ceedref); CeedChk(ierr);
32*8d713cf6Sjeremylt 
33*8d713cf6Sjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateTensorH1",
34*8d713cf6Sjeremylt                                 CeedBasisCreateTensorH1_Xsmm); CeedChk(ierr);
35*8d713cf6Sjeremylt   ierr = CeedSetBackendFunction(ceed, "Ceed", ceed, "BasisCreateH1",
36*8d713cf6Sjeremylt                                 CeedBasisCreateH1_Xsmm); CeedChk(ierr);
37*8d713cf6Sjeremylt 
38*8d713cf6Sjeremylt   return 0;
39*8d713cf6Sjeremylt }
40*8d713cf6Sjeremylt 
41*8d713cf6Sjeremylt __attribute__((constructor))
42*8d713cf6Sjeremylt static void Register(void) {
43*8d713cf6Sjeremylt   CeedRegister("/cpu/self/xsmm/serial", CeedInit_Xsmm_Serial, 30);
44*8d713cf6Sjeremylt }
45