ViennaLS
Loading...
Searching...
No Matches
lsOxidationGpuAbi.hpp
Go to the documentation of this file.
1// Stable C ABI exported by the ViennaLS_GPU shared library: the linear solves
2// of the oxidation solvers on the GPU (gpu/lsOxidationGpu.cu).
3//
4// The library links against the CUDA runtime. ViennaLS itself must NOT, so
5// that a build with GPU support still loads on machines with no CUDA runtime
6// installed. The library is therefore opened lazily with dlopen() and these
7// symbols are resolved with dlsym() -- see lsOxidationGpuInterface.hpp.
8//
9// Everything here is deliberately plain C: opaque void* handles, no
10// references, int instead of bool. That keeps the boundary independent of
11// C++ name mangling and of the standard library, so the two sides stay
12// compatible even when built by different compilers (nvcc vs g++).
13//
14// Bump VIENNALS_GPU_ABI_VERSION on any incompatible change to the signatures
15// below; the loader refuses a library reporting a different version.
16
17#pragma once
18
19#include <cstddef>
20#include <cstdint>
21
22#define VIENNALS_GPU_ABI_VERSION 3
23
24// The exporting side (lsOxidationGpu.cu) must keep these visible even under
25// -fvisibility=hidden, or dlsym() cannot find them.
26#if defined(_WIN32)
27#define VIENNALS_GPU_ABI __declspec(dllexport)
28#else
29#define VIENNALS_GPU_ABI __attribute__((visibility("default")))
30#endif
31
32extern "C" {
33
36
39
48viennalsGpuDiffusionSolve(int64_t n, const int64_t *ptr, const int64_t *col,
49 const double *val, const double *rhs, double *x,
50 unsigned maxIterations, double absTolerance,
51 unsigned *outIterations);
52
57VIENNALS_GPU_ABI void *viennalsGpuMacSetup(int64_t n, const int64_t *ptr,
58 const int64_t *col,
59 const double *val, int64_t nvel,
60 int dim, const double *nullspace);
61
67viennalsGpuMacSolve(void *handle, int64_t n, const int64_t *ptr,
68 const int64_t *col, const double *val, const double *rhs,
69 double *x, unsigned maxIterations, double tolerance,
70 unsigned *outIterations, double *outResidual);
71
74
75} // extern "C"
VIENNALS_GPU_ABI int viennalsGpuMacSolve(void *handle, int64_t n, const int64_t *ptr, const int64_t *col, const double *val, const double *rhs, double *x, unsigned maxIterations, double tolerance, unsigned *outIterations, double *outResidual)
FGMRES on A x = rhs with the preconditioner of handle; A may differ from the matrix of the setup (sam...
#define VIENNALS_GPU_ABI
Definition lsOxidationGpuAbi.hpp:29
VIENNALS_GPU_ABI int viennalsGpuAbiVersion(void)
Returns the ABI version this library was built against.
VIENNALS_GPU_ABI const char * viennalsGpuGetLastErrorMessage(void)
Human-readable detail for the last failure on this thread.
VIENNALS_GPU_ABI void * viennalsGpuMacSetup(int64_t n, const int64_t *ptr, const int64_t *col, const double *val, int64_t nvel, int dim, const double *nullspace)
3-D velocity-pressure solve of OxidationDeformation: set up the preconditioner for the CSR system (pt...
VIENNALS_GPU_ABI void viennalsGpuMacFree(void *handle)
Free a setup. Safe to call with nullptr.
VIENNALS_GPU_ABI int viennalsGpuDiffusionSolve(int64_t n, const int64_t *ptr, const int64_t *col, const double *val, const double *rhs, double *x, unsigned maxIterations, double absTolerance, unsigned *outIterations)
Diffusion solve of OxidationDiffusion, as on the CPU: BiCGSTAB preconditioned by smoothed-aggregation...