You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow disabling of BLAS prototypes at compile-time.
Details:
- Modified bli_blas.h so that:
- By default, if the BLAS layer is enabled at configure-time, BLAS
prototypes are also enabled within blis.h;
- But if the user #defines BLIS_DISABLE_BLAS_DEFS prior to including
blis.h, BLAS prototypes are skipped over entirely so that, for
example, the application or some other header pulled in by the
application may prototype the BLAS functions without causing any
duplication.
- Updated docs/BuildSystem.md to document the feature above, and
related text.
***[Linking against BLIS](BuildSystem.md#linking-against-blis)**
13
16
***[Uninstalling](BuildSystem.md#uninstalling)**
14
17
***[make targets](BuildSystem.md#make-targets)**
@@ -83,7 +86,7 @@ Alternatively, `configure` can automatically select a configuration based on you
83
86
```
84
87
$ ./configure auto
85
88
```
86
-
However, as of this writing, only a limited number of architectures are detected. If the `configure` script is not able to detect your architecture, the `generic` configuration will be used.
89
+
However, as of this writing, only a limited number of architectures are detected. If the `configure` script is not able to detect your architecture, the `generic` configuration will be used.
87
90
88
91
Upon running configure, you will get output similar to the following. The exact output will depend on whether you cloned BLIS from a `git` repository or whether you obtained BLIS via a downloadable tarball from the [releases](https://github.com/flame/blis/releases) page.
89
92
```
@@ -338,6 +341,47 @@ Removing include.
338
341
Running the `distclean` target is like saying, "Remove anything ever created by the build system."
339
342
340
343
344
+
## Compiling with BLIS
345
+
346
+
All BLIS definitions and prototypes may be included in your C source file by including a single header file, `blis.h`:
347
+
```c
348
+
#include"stdio.h"
349
+
#include"stdlib.h"
350
+
#include"otherstuff.h"
351
+
#include"blis.h"
352
+
```
353
+
If the BLAS compatibility layer was enabled at configure-time (as it is by default), then `blis.h` will also provide BLAS prototypes to your source code.
354
+
355
+
356
+
### Disabling BLAS prototypes
357
+
358
+
Some applications already `#include` a header that contains BLAS prototypes. This can cause problems if those applications also try to `#include` the BLIS header file, as shown above. Suppose for a moment that `otherstuff.h` in the example above already provides BLAS prototypes.
If your application is already declaring (prototyping) BLAS functions, then you may disable those prototypes from being defined included within `blis.h`. This prevents `blis.h` from re-declaring those prototypes, or, allows your other header to declare those functions for the first time, depending on the order that you `#include` the headers.
366
+
```c
367
+
#include"stdio.h"
368
+
#include"stdlib.h"
369
+
#include"otherstuff.h"
370
+
#defineBLIS_DISABLE_BLAS_DEFS// disable BLAS prototypes within BLIS.
371
+
#include"blis.h"
372
+
```
373
+
By `#defining` the `BLIS_DISABLE_BLAS_DEFS` macro, we signal to `blis.h` that it should skip over the BLAS prototypes, but otherwise `#include` everything else as it normally would. Note that `BLIS_DISABLE_BLAS_DEFS` must be `#defined`*prior* to the `#include "blis.h"` directive in order for it to have any effect.
374
+
375
+
376
+
### CBLAS
377
+
378
+
If you build BLIS with CBLAS enabled and you wish to access CBLAS function prototypes from within your application, you will have to `#include` the `cblas.h` header separately from `blis.h`.
379
+
```
380
+
#include "blis.h"
381
+
#include "cblas.h"
382
+
```
383
+
384
+
341
385
## Linking against BLIS
342
386
343
387
Once you have instantiated (configured and compiled, and perhaps installed) a BLIS library, you can link to it in your application's makefile as you would any other library. The following is an abbreviated makefile for a small hypothetical application that has just two external dependencies: BLIS and the standard C math library. We also link against libpthread since that library has been a runtime dependency of BLIS since 70640a3 (December 2017).
The above example assumes you will want to include BLIS definitions and function prototypes into your application via `#include blis.h`. (If you are only using the BLIS via the BLAS compatibility layer, including `blis.h` is not necessary.) Since BLIS headers are installed into a `blis` subdirectory of `PREFIX/include`, you must make sure that the compiler knows where to find the `blis.h` header file. This is typically accomplished by inserting `#include "blis.h"` into your application's source code files and compiling the code with `-I PREFIX/include/blis`.
0 commit comments