Giter Site home page Giter Site logo

Comments (11)

termoshtt avatar termoshtt commented on August 22, 2024

/usr/bin/ld: cannot find -lcublas

This could be caused by

  • libcublas.a does not exists on your system
  • env variable $LIBRARY_PATH does not containing dir where libcublas.a exists

I guess $LIBRARY_PATH setting is failing. If you do not prefer to modify it, you can use $CUDA_LIBRARY_PATH instead.

Dockerfile of termoshtt/rust-cuda may help construct your env

from accel.

ehsanmok avatar ehsanmok commented on August 22, 2024

Thanks! I ran ld -lcudart --verbose and saw it's searching over wrong places so I symlinked
sudo ln -s /usr/local/cuda-8.0/lib64/libcublas.so /usr/lib/libcublas.so then sudo ldconfig. The same for libcudart and could successfully build accel root crate.

However, cargo test fails with

error: custom attribute panicked
 --> examples/add.rs:9:1
  |
9 | #[kernel]
  | ^^^^^^^^^
  |
  = help: message: Failed to compile: IOError((Link, Os { code: 2, kind: NotFound, message: "No such file or directory" }))

error: aborting due to previous error

error: Could not compile `accel`.

It seems it's the linker issue and cargo test fails for nvptx with error

running 2 tests
    Blocking waiting for file lock on nvptx64-nvidia-cuda's sysroot
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling accel-core v0.2.0-alpha
   Compiling ptx-builder v0.1.0 (file:///tmp/ptx-builder.9Vy9DYkX6TOf)
    Finished release [optimized] target(s) in 0.22 secs
test compile_tmp ... FAILED
   Compiling accel-core v0.2.0-alpha
   Compiling ptx-builder v0.1.0 (file:///home/ilab/tmp/rust2ptx)
    Finished release [optimized] target(s) in 0.21 secs
test compile_path ... FAILED

failures:

---- compile_tmp stdout ----
        Already clean (dir = /tmp/ptx-builder.9Vy9DYkX6TOf/target)
thread 'compile_tmp' panicked at 'called `Result::unwrap()` on an `Err` value: IOError((Link, Os { code: 2, kind: N                                                                                               otFound, message: "No such file or directory" }))', libcore/result.rs:945:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- compile_path stdout ----
        thread 'compile_path' panicked at 'called `Result::unwrap()` on an `Err` value: IOError((Link, Os { code: 2                                                                                               , kind: NotFound, message: "No such file or directory" }))', libcore/result.rs:945:5


failures:
    compile_path
    compile_tmp

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out

and accel-core build fails with (might be related to arch?)

LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.read.ptx.sreg.ntid.x
error: Could not compile `accel-core`.

Though, cuda-sys and accel-derive have passed the tests.

Any idea how to resolve them?
Thanks!

from accel.

termoshtt avatar termoshtt commented on August 22, 2024

Thanks for testing.

error: custom attribute panicked
test compile_tmp ... FAILED
test compile_path ... FAILED

These are raised while the link step. Could you check there are three commands ar, llvm-link, and llc in your $PATH? This will be a bug if they exists.

LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.read.ptx.sreg.ntid.x

You need to compile accel-core for nvptx64-nvidia-cuda target. It can be done using cargo-nvptx in nvptx crate (created very recently #29).

cd nvptx
cargo install  # cargo-nvptx is installed into ~/.cargo/bin
cd ../accel-core
cargo nvptx  # this will show the generated PTX

Be sure that the interface of cargo-nvptx will change (´・ω・`)
You can also build it using xargo directory

cp nvptx/src/nvptx64-nvidia-cuda.json accel-core/
xargo rustc --target nvptx64-nvidia-cuda

from accel.

ehsanmok avatar ehsanmok commented on August 22, 2024

Thanks! it's strange that I get miss-matched errors:

Could you check there are three commands ar, llvm-link, and llc in your $PATH? This will be a bug if they exists.

I have ar in PATH only.

cd nvptx
cargo install  # cargo-nvptx is installed into ~/.cargo/bin
cd ../accel-core
cargo nvptx  # this will show the generated PTX

nvptx install was successful though cargo nvptx in accel-core fails with

thread 'main' panicked at 'Link failed: IOError((Link, Os { code: 2, kind: NotFound, message: "No such file or directory" }))', libcore/result.rs:945:5 

I tried xargo rustc --target nvptx64-nvidia-cuda and was successful

though and cargo test fails on accel-core with

LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.read.ptx.sreg.ntid.x
error: Could not compile `accel-core`.

and the root test fails as before.

from accel.

ehsanmok avatar ehsanmok commented on August 22, 2024

Here's my main issue to use nvptx from nightly 1.27. Did you have such issues? if so what did you do?

from accel.

termoshtt avatar termoshtt commented on August 22, 2024

The sample at japaric/nvptx uses japaric/core64, which does not updated. You can use latest libcore on the main rust library, so I guess you can compile that sample by removing Xargo.toml.

nvptx install was successful though cargo nvptx in accel-core fails with

Does cargo test on nvptx crate works? Anyway, this error message has no information. I have to fix #33 first (´・ω・`)

from accel.

shritesh avatar shritesh commented on August 22, 2024

I went through the same issues with the same error messages.

In my case, llvm-link and llc commands do not exist in my $PATH but they are hardcoded in nvptx::compile::Builder::link. I edited the commands to llvm-link-6.0 and llc-6.0 and it works on my machine. The Dockerfile has RUN bash -c 'for e in $(ls /usr/bin/ll*-6.0); do mv $e ${e%-6.0}; done' to do the same.

Hope this helps.

from accel.

termoshtt avatar termoshtt commented on August 22, 2024

I edited the commands to llvm-link-6.0 and llc-6.0 and it works on my machine.

Thanks comment. These naming rules should be detected in cargo-nvptx since such postfix is widely used. I will fix it.

from accel.

ehsanmok avatar ehsanmok commented on August 22, 2024

Does cargo test on nvptx crate works?

With changes @shritesh mentioned, the build and test were successfully for me as well. But when I tried to build accel-core separately it complained about LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.read.ptx.sreg.ntid.x however, root accel build and tests were successful.

from accel.

termoshtt avatar termoshtt commented on August 22, 2024

llc-6.0-like naming is supported in #39.

LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.read.ptx.sreg.ntid.x

accel-core cannot be compiled to X86. It must be compiled to NVPTX target (defined in LLVM), and cargo-nvptx is a tool for it.

cd nvptx
cargo install --path .  # install cargo-nvptx into ~/.cargo/bin/
cd ../accel-core
cargo nvptx  # this will show compiled PTX text

as CI does

cd nvptx
cargo install -f
cd ../accel-core
cargo nvptx

from accel.

termoshtt avatar termoshtt commented on August 22, 2024

Please re-open if not resolved

from accel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.