arrayfire
arrayfire copied to clipboard
[BUG] Program crash with no error message when using Unified Backend af.lib
I am having troubles using the Unified Backend library af.lib, but my program is working when I am using other libraries.
Description
My program is perfectly working if I am using afcpu.lib: the code I use is presented below with the output obtained. But it won't work if I am using af.lib. I also put the code and the output right after.
Reproducible Code and/or Steps (working)
- Add
$(AF_PATH)/include;to Project Properties -> C/C++ -> General -> Additional Include Directories. - Add
$(AF_PATH)/lib;to Project Properties -> Linker -> General -> Additional Library Directories. - Add
afcpu.lib;to Project Properties -> Linker -> Input -> Additional Dependencies.
Here is the code used:
#include <iostream>
#include <arrayfire.h>
int main()
{
std::cout << "Main running..." << std::endl;
std::cout << "Available backends: " << af::getAvailableBackends() << std::endl;
for (int i = 0; i < af::getDeviceCount(); i++) {
af::setDevice(i);
af::info();
}
return 0;
}
Here is the output:
Main running...
Available backends: 1
ArrayFire v3.8.2 (CPU, 64-bit Windows, build 5752f2dc)
[0] Intel: Intel(R) Core(TM) i5-3337U CPU @ 1.80 GHz
Reproducible Code and/or Steps (not working)
- Add
$(AF_PATH)/include;to Project Properties -> C/C++ -> General -> Additional Include Directories. - Add
$(AF_PATH)/lib;to Project Properties -> Linker -> General -> Additional Library Directories. - Add
af.lib;to Project Properties -> Linker -> Input -> Additional Dependencies.
Here is the code used:
#include <iostream>
#include <arrayfire.h>
int main()
{
std::cout << "Main running..." << std::endl;
try
{
std::cout << "Available backends: " << af::getAvailableBackends() << std::endl;
}
catch (af::exception& e)
{
std::cout << "Caught exception when trying reading backends" << std::endl;
std::cerr << e.what() << std::endl;
}
af::setBackend(AF_BACKEND_CPU);
for (int i = 0; i < af::getDeviceCount(); i++) {
af::setDevice(i);
af::info();
}
af::setBackend(AF_BACKEND_CUDA);
for (int i = 0; i < af::getDeviceCount(); i++) {
af::setDevice(i);
af::info();
}
af::setBackend(AF_BACKEND_OPENCL);
for (int i = 0; i < af::getDeviceCount(); i++) {
af::setDevice(i);
af::info();
}
return 0;
}
Here is the output:
Main running...
If I am running it with the Visual Studio Debugger, here is the error I obtain:
Unhandled exception at 0x00007FF90AEA4FD9 (KernelBase.dll) in main.exe : 0xC06D007F: Procedure not found (parameters : 0x000000D5546FD0F0).
System Information
Windows 10 64 bits Intel Core i5-3337U @ 1.80 GHz Visual Studio Community 2019 16.11.11 ArrayFire 3.8.2 (CUDA 11.4)
Visual Studio Configuration: Release, x64