11#include " quadblas_interface.h"
2- #include " ../QBLAS/include/quadblas/quadblas.hpp"
32#include < cstring>
43#include < algorithm>
54
5+ #ifndef DISABLE_QUADBLAS
6+ #include " ../QBLAS/include/quadblas/quadblas.hpp"
7+ #endif // DISABLE_QUADBLAS
8+
69extern " C" {
710
11+
12+ #ifndef DISABLE_QUADBLAS
13+
814int
915qblas_dot (size_t n, Sleef_quad *x, size_t incx, Sleef_quad *y, size_t incy, Sleef_quad *result)
1016{
@@ -138,4 +144,90 @@ py_quadblas_get_version(PyObject *self, PyObject *args)
138144 return PyUnicode_FromString (" QuadBLAS 1.0.0 - High Performance Quad Precision BLAS" );
139145}
140146
147+ int
148+ quadblas_set_num_threads (int num_threads)
149+ {
150+ QuadBLAS::set_num_threads (num_threads);
151+ return 0 ;
152+ }
153+
154+ int
155+ quadblas_get_num_threads (void )
156+ {
157+ int num_threads = QuadBLAS::get_num_threads ();
158+ return num_threads;
159+ }
160+
161+ #else // DISABLE_QUADBLAS
162+
163+
164+ int
165+ qblas_dot (size_t n, Sleef_quad *x, size_t incx, Sleef_quad *y, size_t incy, Sleef_quad *result)
166+ {
167+ return -1 ; // QBLAS is disabled, dot product not available
168+ }
169+
170+ int
171+ qblas_gemv (char layout, char trans, size_t m, size_t n, Sleef_quad *alpha, Sleef_quad *A,
172+ size_t lda, Sleef_quad *x, size_t incx, Sleef_quad *beta, Sleef_quad *y, size_t incy)
173+ {
174+ return -1 ; // QBLAS is disabled, GEMV not available
175+ }
176+
177+ int
178+ qblas_gemm (char layout, char transa, char transb, size_t m, size_t n, size_t k, Sleef_quad *alpha,
179+ Sleef_quad *A, size_t lda, Sleef_quad *B, size_t ldb, Sleef_quad *beta, Sleef_quad *C,
180+ size_t ldc)
181+ {
182+ return -1 ; // QBLAS is disabled, GEMM not available
183+ }
184+
185+ int
186+ qblas_supports_backend (QuadBackendType backend)
187+ {
188+ return -1 ; // QBLAS is disabled, backend support not available
189+ }
190+
191+ PyObject *
192+ py_quadblas_set_num_threads (PyObject *self, PyObject *args)
193+ {
194+ // raise error
195+ PyErr_SetString (PyExc_NotImplementedError, " QuadBLAS is disabled" );
196+ return NULL ;
197+ }
198+
199+ PyObject *
200+ py_quadblas_get_num_threads (PyObject *self, PyObject *args)
201+ {
202+ // raise error
203+ PyErr_SetString (PyExc_NotImplementedError, " QuadBLAS is disabled" );
204+ return NULL ;
205+ }
206+
207+ PyObject *
208+ py_quadblas_get_version (PyObject *self, PyObject *args)
209+ {
210+ // raise error
211+ PyErr_SetString (PyExc_NotImplementedError, " QuadBLAS is disabled" );
212+ return NULL ;
213+ }
214+
215+ int
216+ quadblas_set_num_threads (int num_threads)
217+ {
218+ // raise error
219+ PyErr_SetString (PyExc_NotImplementedError, " QuadBLAS is disabled" );
220+ return -1 ;
221+ }
222+
223+ int
224+ quadblas_get_num_threads (void )
225+ {
226+ // raise error
227+ PyErr_SetString (PyExc_NotImplementedError, " QuadBLAS is disabled" );
228+ return -1 ;
229+ }
230+
231+ #endif // DISABLE_QUADBLAS
232+
141233} // extern "C"
0 commit comments