C++ program crash with no error message only when using a particular library of ArrayFire

380 Views Asked by At

I am trying to use the ArrayFire library, everything is working perfectly (see the working example above), but I have a problem only when using a particular library af.lib. The problem is that when my program crashes, I have no message error and the compilation didn't send back any message either.

Reproducible Code and/or Steps (working)

  1. Add $(AF_PATH)/include; to Project Properties -> C/C++ -> General -> Additional Include Directories.
  2. Add $(AF_PATH)/lib; to Project Properties -> Linker -> General -> Additional Library Directories.
  3. 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)

  1. Add $(AF_PATH)/include; to Project Properties -> C/C++ -> General -> Additional Include Directories.
  2. Add $(AF_PATH)/lib; to Project Properties -> Linker -> General -> Additional Library Directories.
  3. 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 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).

Enabling the Microsoft or the NuGet Symbol Servers doesn't solve the error.

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

0

There are 0 best solutions below