cblas on Mac

It’s very easy to use cblas on Mac. cblas is installed initially and you can use it now. cblas is included in Accelerate framework which is optimized for Mac. So the program is expected to work so fast.

Write code

Open visual studio code and write down (or copy and paste) the following example code. Save the file as “dgemm.cpp”.

If you want to use cblas, include Accelerate framework. The detail is shown in https://developer.apple.com/documentation/accelerate/blas.

Run

Compile and run as follows.

> c++ -framework Accelerate dgemm.cpp
> ./a.out
---- cblas_dgemm ----
30 36 42
66 81 96
102 126 150

You can see the result! Congratulations! 

Leave a Comment

Your email address will not be published. Required fields are marked *