This line has a comment # Iterate in reverse order of preference. However, it loads them with some random order, because the object to iterate is a set, which doesn't keep the order. In my Linux computer, when I run import arrayfire as af, the function will be called and it loads "" first, and due to err!=0, it directly returns and not loads anything.
By the way, I simply change {"cpu", "opencl", "cuda", ""} to ["cuda"] and I can import arrayfire with no error.