-
Notifications
You must be signed in to change notification settings - Fork 543
Make unified backend accept ArrayFire libraries in arbitrary paths (reopened) #2525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/api/unified/symbol_manager.cpp
Outdated
, backendsAvailable(0) | ||
, activeBackend(AF_BACKEND_CPU) | ||
, defaultBackend(AF_BACKEND_CPU) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these two activeBackend
and defaultBackend
variables associated with only custom handles the user adds ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid confusion, lets assign that to AF_BACKEND_DEFAULT
instead of CPU
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.