arrayfire icon indicating copy to clipboard operation
arrayfire copied to clipboard

[Question] How to disable intel mkl?

Open twmht opened this issue 3 years ago • 7 comments

Hi,

Can I disable MKL when compiling from source? is mkl a must required package for arrayfire?

thank you

twmht avatar Dec 16 '21 09:12 twmht

i did not see any MKL requirement on the page https://github.com/arrayfire/arrayfire/wiki/Build-Instructions-for-Linux

twmht avatar Dec 16 '21 11:12 twmht

I find we can use -DAF_COMPUTE_LIBRARY=BLAS to change the backend. the install document needs to be updated.

twmht avatar Dec 16 '21 12:12 twmht

I changed to vcpkg description file: vcpkg.json (in source dir of arrayfire), so that it now uses openblas and fftw3. The improvement in speed on non-Intel CPU is remarkable. Since intel upgraded to OneMKL package, the existing improvement tricks no longer work.

The dependencyies section in the vkpkg.json file now has following content:

    "dependencies": [
        "boost-compute",
        "boost-functional",
        "boost-stacktrace",
        {
            "name": "forge",
            "version>=": "1.0.7",
            "platform": "windows"
        },
        "freeimage",
        {
            "name": "fontconfig",
            "platform": "!windows"
        },
        "glad",
        "spdlog",
		"fftw3",
		"openblas"
    ]

PS: intel-mkl is replace by fftw3 and openblas. The other content can change, depending on updates. As you can see, this is the windows version, although I expect it to be similar for linux.

I hope this will help you.

willyborn avatar Dec 16 '21 15:12 willyborn

@willyborn

I don't use VC for compiling, I just use cmake file to compile, so the config did not work for me.

Now I just change -DAF_COMPUTE_LIBRARY to BLAS, and now it can build without MKL.

twmht avatar Dec 17 '21 01:12 twmht

Also, I think it's not ideal if the default backend is set to MKL, since I believe many of the users did not use intel cpu.

twmht avatar Dec 17 '21 01:12 twmht

@twmht The code has Intel-MKL as default backend. You can however use the combination of BLAS/FFTW/LAPACK libaries as well but you need to install them as per instructions on the wiki. Thanks for pointing out about the wiki. I have updated it now.

Note that this defaults to MKL because it is the fastest way to setup all required blas, fftw and lapack dependencies. As mentioned above you can change the cmake option to the other option with all necessary dependencies installed and it should work right away.

9prady9 avatar Dec 23 '21 14:12 9prady9

Hello, I have also came across through this when building from source on MacOS M1 by following the wiki, solved by using BLAS instead, I think the docs should be updated as well, thanks yall!

praisethemoon avatar Jan 17 '22 22:01 praisethemoon