Skip to content

Error: In function void print() after installation #248

Closed

Description

@WKrauze

I have a problem with arrayfire-python. I followed all installation instructions, including adding directories to LD_LIBRARY_PATH:
$ echo $LD_LIBRARY_PATH
/opt/arrayfire/lib64/::/opt/cuda/lib64/:/opt/cuda/nvvm/lib64/

In /etc/ld.so.conf.d/arrayfire.conf I have /opt/arrayfire/lib64

However, when I try to run helloworld.py from examples, I get:

Platform: CUDA Runtime 11.2, Driver: 455.45.01
[0] GeForce GTX 1070, 8119 MB, CUDA Compute 6.1
Create a 5-by-3 matrix of random floats on the GPU

A
[Element-wise arithmetic

Error: In function void print(const char*, af_array, int, std::ostream&, bool) [with T = float; af_array = void*; std::ostream = std::basic_ostream<char>]
In file src/api/c/print.cpp:

Process finished with exit code 0

When I am in the python console and I change backend to CPU I get:

af.info()
ArrayFire v3.8.0 (CPU, 64-bit Linux, build d99887a)
[0] Intel: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz

when I change back to CUDA I get:

af.info()
ArrayFire v3.8.0 (CUDA, 64-bit Linux, build d99887a)
Platform: CUDA Runtime 11.2, Driver: 455.45.01
[0] GeForce GTX 1070, 8119 MB, CUDA Compute 6.1

So for me it looks like arrayfire correctly recognizes CPU and CUDA.
I found similar problem here: https://groups.google.com/g/arrayfire-users/c/_524PBvEvGw?pli=1 however it was not solved.
Also. when I try to run another code for which I installed arrayfire, I get this error:

File "/home/wojtek/anaconda3/envs/multi-layer-born/lib/python3.8/site-packages/arrayfire/util.py", line 79, in safe_call 
raise RuntimeError(to_str(err_str))
RuntimeError: In function cuda::Module common::compileModule(const string&, const std::vector<std::basic_string<char> >&, const std::vector<std::basic_string<char> >&, const std::vector<std::basic_string<char> >&, bool)
In file src/backend/cuda/compile_module.cpp:

Process finished with exit code 1

which, as I believe, is related with the same issue.
Additional info:
I am using Anaconda, Python 3.8.5
Linux Manjaro 20.2.1

Activity

  1. changed the title [-]Error: In function void print()[/-] [+]Error: In function void print() after installation[/+] on Jan 12, 2021
  2. JackyChan97 commented on Jan 19, 2021

    @JackyChan97

    i have the same problem

  3. WKrauze commented on Jan 22, 2021

    @WKrauze
    Author

    The solution to this problem can be found on Slack channel.
    To cite:

    I think its the order in which the libraries are loaded. Python 3 and some of the wheels use a standard library that conflicts with ArrayFire's standard library sometimes.

    And the solution: write in terminal:
    LD_PRELOAD=<full_path_to_libafcuda> python your_python.py

    For example:

    LD_PRELOAD=/opt/arrayfire/lib64/libafcuda.so python3 helloworld.py

    If you want to add this environment variable in PyCharm, follow the instructions given here.
    For me this solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions