flexiblas_switch(3)

πŸ“¦
version 3.5.0 Β· 3 versions
, in fedora 43, fedora 44

πŸ’– flexiblas_switch(3) πŸ’–

okay bestie, welcome to the flexiblas_switch(3) manual page, like, the actual official one but make it cute ✨ It lives in The FlexiBLAS Library section of your man pages, and honestly? it's giving "tiny function, huge power". Let's get into it 🌸


✨ NAME ✨

flexiblas_switch β€” switch the currently used FlexiBLAS backend. no cap, that's literally the whole job 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <flexiblas/flexiblas_api.h>

int flexiblas_switch(int id );

Link with -lflexiblas.

bestie do NOT forget the -lflexiblas flag, she will NOT link herself πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

flexiblas_switch switches the currently used BLAS backend. main character move, honestly πŸ‘‘

The id parameter is the id of the previously loaded backend. Where does that id come from, you ask? It's returned by flexiblas_load_backend or flexiblas_load_backend_library β€” so you gotta load first, then switch. that's the pipeline πŸ”₯

⚠️ okay serious moment: this function is not thread safe, and switching the backend inside a threaded environment can cause problems if there is a BLAS call running at the same time. like, imagine changing the entire vibe of the party while someone's mid-dance. chaos. don't do it 😭

The special id of 0 resets the backend to the default backend, which is the one loaded at the initialization before the program starts. so 0 is basically the "factory reset my backend" button 🌈


⭐ RETURN VALUE ⭐

On success, it returns zero. slay πŸ’…


πŸ’€ ERRORS πŸ’€

All negative return values are errors. This happens if the id is out of range. (out of range = not a real backend id, bestie, don't make one up πŸ™ˆ)


🌸 EXAMPLES 🌸

The following example loads the NETLIB BLAS backend and switches to it. iconic behaviour, fr fr 🧚

πŸ’œ Program Source πŸ’œ

#include <stdio.h>
#include <flexiblas/flexiblas_api.h>

int main ( int argc, char **argv ) {
     int netlib_id;

     netlib_id = flexiblas_load_backend("NETLIB");
     if ( netlib_id < 0 ) {
          fprintf(stderr, "Failed to load the NETLIB backend.\n");
          return -1;
     }
     /* Switch to the NETLIB backend */
     flexiblas_switch(netlib_id);

     /* DGEMM performed with the NETLIB backend. */
     dgemm_(.....);

     return 0;
}

πŸ‘€ SEE ALSO πŸ‘€

(go read those too, they're the prequel to this one πŸ“)


πŸ™ˆ REPORTING BUGS πŸ™ˆ

The current information about the developers and reporting bugs can be found on the FlexiBLAS homepage. found a bug? tell the devs, not the group chat, they actually fix things 🫢

FlexiBLAS Homepage: <http://www.mpi-magdeburg.mpg.de/projects/flexiblas>


πŸ‘‘ AUTHORS πŸ‘‘

Martin Koehler, Jens Saak


Copyright (C) 2013-2025 Martin Koehler


🌈 LICENSE 🌈

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

yes bestie, NO WARRANTY, capital letters, they meant it πŸ’€

M. Koehler β€” 2013-2025 β€” flexiblas_switch(3)

and that's the whole page, bestie!! source & version: M. Koehler, dated 2013-2025, from the flexiblas_switch(3) page in The FlexiBLAS Library. now go forth and switch those backends responsibly βœ¨πŸ’…πŸ¦‹

πŸ“¦ where this page comes from