Skip to content
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

Switch to functional backend #98

Closed
wants to merge 1 commit into from

Conversation

9prady9
Copy link
Member

@9prady9 9prady9 commented Sep 18, 2016

FIxes #90

After this commit, instead of loading the libraries ahead of usage,
when an arrayfire function is called for first time, a functional
backend is loaded on the fly.

@pavanky
Copy link
Member

pavanky commented Sep 18, 2016

This does not fix #90. Think of this scenario:

  • You install arrayfire from the installer
  • You also for some reason have the CUDA toolkit installed on your system
  • You do not have an NVIDIA GPU available currently

In such a case, the backend that should be picked is either OpenCL or CPU. However the current mechanism picks CUDA, but errors out because the no nvidia gpu is available.

The proper solution would be to call some function (lets say randu) after loading a library to see if it throws an exception. If an exception is throw, continue until a library can both be loaded and randu works.

@9prady9
Copy link
Member Author

9prady9 commented Sep 18, 2016

Okay, i understand what you meant by functional now.

@9prady9 9prady9 changed the title Switch to functional backend lazily WIP - Switch to functional backend lazily Sep 18, 2016
Though libraries of a given backend can be present on the target
machine, there can be scenarios where a compatible hardware device
is not available. In such cases, backend loader checks if current
selected backend has a device ready for use. If no appropriate
device exists, the next backend in the priority list is checked
for same criteria. This process is repeated until a working
backend is found. In the event that no functional backend is found,
the program throws a runtime error.
@9prady9 9prady9 force-pushed the lazy_backend_switch branch from 3228bab to 8b5b58e Compare September 18, 2016 16:55
@9prady9 9prady9 changed the title WIP - Switch to functional backend lazily WIP - Switch to functional backend Sep 18, 2016
@9prady9 9prady9 changed the title WIP - Switch to functional backend Switch to functional backend Sep 19, 2016
@pavanky pavanky mentioned this pull request Sep 22, 2016
@pavanky pavanky closed this Sep 22, 2016
@9prady9 9prady9 deleted the lazy_backend_switch branch August 14, 2020 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants