Make unified backend accept ArrayFire libraries in arbitrary paths (reopened)#2525
Make unified backend accept ArrayFire libraries in arbitrary paths (reopened)#2525mark-poscablo wants to merge 1 commit intoarrayfire:masterfrom
Conversation
src/api/unified/symbol_manager.cpp
Outdated
| , newCustomHandleIndex(NUM_BACKENDS) | ||
| , backendsAvailable(0) | ||
| , activeBackend(AF_BACKEND_CPU) | ||
| , defaultBackend(AF_BACKEND_CPU) |
There was a problem hiding this comment.
Are these two activeBackend and defaultBackend variables associated with only custom handles the user adds ?
There was a problem hiding this comment.
No, they've always been there. In fact af_get_active_backend and af::setBackend(AF_BACKEND_DEFAULT) uses those variables. They're not currently being initialized, so I thought why not initialize them too as a good practice. They're actually being set in the AFSymbolManager constructor definition though. I can revert this change though if you think we should leave them not value-initialized.
There was a problem hiding this comment.
The reason I asked this is, default backend or active backend are automatically chosen if not set by user. So, I am concerned if we will mess that up by setting it to CPU here by default. Can you please verify that.
There was a problem hiding this comment.
To avoid confusion, lets assign that to AF_BACKEND_DEFAULT instead of CPU.
There was a problem hiding this comment.
Yes I can verify that it will choose whatever the AFSymbolManager constructor definition determines as the default backend (by the order of CUDA, OpenCL, and CPU) if the user does not explicitly call af::setBackend.
I think your suggestion that we initialize it to to AF_BACKEND_DEFAULT instead is fine. I see no problems with activeBackend and defaultBackend being initialized to that in any cases. If there's at least one backend available, both activeBackend and defaultBackend will be set to the determined default backend as per the order, and if there are no backends available, they will be both set to AF_BACKEND_DEFAULT, which I don't think will pose a problem - any arrayfire calls would just fail as expected, unless af_add/set_backend_library are called.
948e433 to
470a380
Compare
d7477b1 to
b68c968
Compare
I had to make a new PR because I forced-push to my branch while the previous PR (#2514) was closed and it won't let me reopen it anymore.
Here are the screenshots of the docs:



Feel free to continue the discussion here.