Comments (23)
Did you clone the rust-wrapper ? or Are you using the arrayfire crate from crates.io ?
- If you have cloned the repository, then it is likely that you are using devel branch code base. 3.3.0 compatible wrapper is not yet published on crates.io. So, you would have to build the arrayfire from source to use devel rust-wrapper code base.
- If you want to use crate from crates.io, please install ArrayFire 3.2.x.
Hope that helps.
-Pradeep.
from arrayfire-rust.
As described I added arrayfire = "3.2.0" to the dependencies section of my project's Cargo.toml file. Is there anything else I have to do?
Thanks.
Michael
from arrayfire-rust.
It is better to do git checkout v3.2.0
instead of manually changing Cargo.toml file.
from arrayfire-rust.
Like this:
[dependencies]
arrayfire = { git = "https://github.com/arrayfire/arrayfire-rust.git" }
from arrayfire-rust.
As per the documentation you have to specify branch if it is not master. Can you trying do that and see how it goes ?
af_print macro is only defined in current devel.
from arrayfire-rust.
Ok, I am using
[dependencies]
arrayfire = { path = "path/to/arrayfire-rust/" }
Now I am able to compile e.g. the HelloWorld example.
But still the program is crashing:
error: Process didn't exit successfully: target\debug\my-af.exe
(exit code: 3221225477)
from arrayfire-rust.
which rust binary did you install, msvc or the mingw one ? Rust/ArrayFire expects MSVC.
from arrayfire-rust.
Ok, I have GNU ABI, mingw.
Thanks.
from arrayfire-rust.
Is the macro not available in the 3.4 crate? Just ran into the same problem, using the downloaded linux 3.4 binaries from the ArrayFire site.
from arrayfire-rust.
Sorry about that, but the macro was not removed.
Can you please post the code that can help us reproduce the problem.
On Tue, Oct 11, 2016, 6:36 PM Brennan Kinney [email protected]
wrote:
Is the macro not available in the 3.4 crate? Just ran into the same
problem, using the downloaded linux 3.4 binaries from the ArrayFire site.—
You are receiving this because you were assigned.Reply to this email directly, view it on GitHub
#66 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADHnOkJy7Fae7LSIJooukN1hsVVpVW26ks5qy4nSgaJpZM4ID2E9
.
from arrayfire-rust.
Also, please let us know on which OS is this happening.
Thank you.
On Tue, Oct 11, 2016, 6:51 PM Pradeep Garigipati [email protected]
wrote:
Sorry about that, but the macro was not removed.
Can you please post the code that can help us reproduce the problem.
On Tue, Oct 11, 2016, 6:36 PM Brennan Kinney [email protected]
wrote:Is the macro not available in the 3.4 crate? Just ran into the same
problem, using the downloaded linux 3.4 binaries from the ArrayFire site.—
You are receiving this because you were assigned.Reply to this email directly, view it on GitHub
#66 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADHnOkJy7Fae7LSIJooukN1hsVVpVW26ks5qy4nSgaJpZM4ID2E9
.
from arrayfire-rust.
@9prady9 Using the sample code you have here
extern crate arrayfire as af;
use af::*;
fn main() {
let num_rows: u64 = 5;
let num_cols: u64 = 3;
let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);
println!("Create a 5-by-3 matrix of random floats on the GPU");
let a = randu::<f32>(dims);
print(&a);
}
OS is Manjaro(Arch Linux 64-bit), @pavanky maintains the packages. I had some problems at first building and ended up downloading the binaries from the ArrayFire site updating my env vars and running cargo build again. I can compile without af_print
but it seems as soon as randu
is called output hangs. I've placed a println!
before and after it, the one before prints but the 2nd afterwards doesn't show up. GPU is Nvidia GTX 1070, I've been able to run OpenCL on it with Hashcat, so drivers should be fine.
EDIT: Err, I've run that example and the one on the main page that shows usage of af_print!
macro.
from arrayfire-rust.
In rust, to use a macro exported by a crate you have to do the following.
#[macro_use(af_print)]
extern crate arrayfire as af;
Please retry again with the above declaration in your source code.
On Tue, Oct 11, 2016, 6:59 PM Brennan Kinney [email protected]
wrote:
@9prady9 https://github.com/9prady9 Using the sample code you have here
#75 (comment)extern crate arrayfire as af;
use af::*;fn main() {
let num_rows: u64 = 5;
let num_cols: u64 = 3;
let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);
println!("Create a 5-by-3 matrix of random floats on the GPU");
let a = randu::(dims);
print(&a);
}OS is Manjaro(Arch Linux 64-bit), @pavanky https://github.com/pavanky
maintains the packages. I had some problems at first building and ended up
downloading the binaries from the ArrayFire site updating my env vars and
running cargo build again. I can compile without af_print but it seems as
soon as randu is called output hangs. I've placed a println! before and
after it, the one before prints but the 2nd afterwards doesn't show up. GPU
is Nvidia GTX 1070, I've been able to run OpenCL on it with Hashcat, so
drivers should be fine.—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
#66 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADHnOj0WI5sADzwfB4gP2TbVlZbRGOcmks5qy48tgaJpZM4ID2E9
.
from arrayfire-rust.
@9prady9 That lets it compile thanks. But still no output like other outputs I see posted here and in examples of the array.
[pola@pc debug]$ ./af-example
Create a 5-by-3 matrix of random floats on the GPU
*EDIT: Noticed my build seemed to be cached in the debug, I did a release build and no text displays in output now. Pretty sure it's due to randu
?
from arrayfire-rust.
Can you try the same example in a C++ program and check if this is specific
to that device?
Another thing you can try is, create a constant array and then print it.
That should tell us if this related to arrays created using rand
On Tue, Oct 11, 2016, 7:08 PM Brennan Kinney [email protected]
wrote:
@9prady9 https://github.com/9prady9 That lets it compile thanks. But
still no output like other outputs I see posted here and in examples of the
array.[pola@pc debug]$ ./af-example
Create a 5-by-3 matrix of random floats on the GPU—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#66 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADHnOlp6HscA4zN5B3m29Pt1sVH-Zm86ks5qy5FIgaJpZM4ID2E9
.
from arrayfire-rust.
@9prady9 Tried with the Array example, only output I receive is "1":
Rust 1.12(Stable)
#[macro_use(af_print)]
extern crate arrayfire as af;
use af::*;
fn main() {
let values: [f32; 3] = [1.0, 2.0, 3.0];
println!("1");
let indices = Array::new(&values, Dim4::new(&[3, 1, 1, 1]));
println!("2");
print(&indices);
println!("3");
}
Tried building the C++ examples but the build failed:
[pola@pc build]$ make
Scanning dependencies of target example_basic_opencl
[ 0%] Building CXX object CMakeFiles/example_basic_opencl.dir/unified/basic.cpp.o
[ 0%] Linking CXX executable unified/basic_opencl
[ 0%] Built target example_basic_opencl
Scanning dependencies of target example_swe_opencl
[ 0%] Building CXX object CMakeFiles/example_swe_opencl.dir/pde/swe.cpp.o
/home/pola/projects/bin/arrayfire-3/share/ArrayFire/examples/pde/swe.cpp: In function ‘void swe(bool)’:
/home/pola/projects/bin/arrayfire-3/share/ArrayFire/examples/pde/swe.cpp:89:26: error: ‘class af::Window’ has no member named ‘setAxesLimits’
(*win)(0, 1).setAxesLimits(0, hist_out.elements(), 0, max<float>(hist_out));
^~~~~~~~~~~~~
/home/pola/projects/bin/arrayfire-3/share/ArrayFire/examples/pde/swe.cpp:90:26: error: ‘class af::Window’ has no member named ‘setAxesLimits’
(*win)(1, 0).setAxesLimits(range(up.dims(1)), vp.col(0));
^~~~~~~~~~~~~
/home/pola/projects/bin/arrayfire-3/share/ArrayFire/examples/pde/swe.cpp:91:26: error: ‘class af::Window’ has no member named ‘setAxesLimits’
(*win)(1, 1).setAxesLimits(eta.col(0), up.col(0), vp.col(0));
^~~~~~~~~~~~~
/home/pola/projects/bin/arrayfire-3/share/ArrayFire/examples/pde/swe.cpp:96:127: error: no matching function for call to ‘af::Window::plot(af::array, af::array, af::array, const char [44])’
(*win)(1,1).plot(flat(eta.col(0)), flat(up.col(0)), flat(vp.col(0)), "Gradients versus Magnitude at left boundary"); // viz
^
In file included from /usr/include/arrayfire.h:267:0,
from /home/pola/projects/bin/arrayfire-3/share/ArrayFire/examples/pde/swe.cpp:6:
/usr/include/af/graphics.h:186:14: note: candidate: void af::Window::plot(const af::array&, const af::array&, const char*)
void plot(const array& X, const array& Y, const char* const title=NULL);
^~~~
/usr/include/af/graphics.h:186:14: note: candidate expects 3 arguments, 4 provided
make[2]: *** [CMakeFiles/example_swe_opencl.dir/build.make:63: CMakeFiles/example_swe_opencl.dir/pde/swe.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/example_swe_opencl.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
from arrayfire-rust.
Please set AF_DISABLE_GRAPHICS
environment variable to 1 to skip building graphics related builds since we don't need that for now.
from arrayfire-rust.
export AF_DISABLE_GRAPHICS=1
? Ran cmake and make again but still got the same output with errors. Not sure what I'm doing wrong.
from arrayfire-rust.
@polarathene That should have skipped building graphics related source code. Can you try removing forge
directory that is located at third_party
under your build directory and try building arrayfire again ? Your build setup seems to be using old version of forge(arrayfire build setup has an external project build for forge).
from arrayfire-rust.
@9prady9 I had installed the 3.3 package at first via package manager, then the git version from AUR. Although I had set environment variables to point to the downloaded binaries it seems it was still preferring the git package I still had installed, after removing that I got some error about CMake not being able to find ArrayFireConfig.cmake
, I know where that file is.
I do not have a third_party
directory, I did find forge though. I'll look into it after I've had some rest and get back to you.
from arrayfire-rust.
@9prady9 Rebooted system with no arrayfire package installed anymore, $AF_PATH
pointed to the downloaded lib from the ArrayFire site(forge removed), did a fresh build cargo clean && cargo run
of the example code and everything compiles fine with correct output :)
Thanks for the help, I can finally dig into AF now!
from arrayfire-rust.
I just installed ArrayFire-v3.6
at my mac, with latest rust version:
Hasans-Air:pgu h_ajsf$ rustup show
Default host: x86_64-apple-darwin
stable-x86_64-apple-darwin (default)
rustc 1.33.0 (2aa4c46cf 2019-02-28)
And copied this example:
#[macro_use(af_print)]
use arrayfire::{Dim4, randu};
fn main() {
println!("Hello, world!");
let num_rows: u64 = 5;
let num_cols: u64 = 3;
let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);
let a = randu::<f32>(dims);
af_print!("Create a 5-by-3 matrix of random floats on the GPU", a);
}
But got the below error:
error: cannot find macro `af_print!` in this scope
--> src/main.rs:10:5
|
10 | af_print!("Create a 5-by-3 matrix of random floats on the GPU", a);
| ^^^^^^^^
error: aborting due to previous error
In my Caro.toml
I've:
[dependencies]
arrayfire = "3.6.0"
When I tried:
#[macro_use(af_print)]
use arrayfire::*;
//use arrayfire::{Dim4, randu};
fn main() {
println!("Hello, world!");
let num_rows: u64 = 5;
let num_cols: u64 = 3;
let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);
let a = randu::<f32>(dims);
af_print!("Create a 5-by-3 matrix of random floats on the GPU", a);
}
I got:
warning: unused attribute
--> src/main.rs:1:1
|
1 | #[macro_use(af_print)]
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_attributes)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 0.72s
Running `target/debug/pgu`
dyld: Library not loaded: @rpath/libaf.3.dylib
Referenced from: /Users/h_ajsf/IdeaProjects/pgu/target/debug/pgu
Reason: image not found
Abort trap: 6
from arrayfire-rust.
@hajsf Regarding image not found, you need to have the $AF_PATH/lib64
added to your DYLD_LIBRARY_PATH
for the program to be able to load required libraries at runtime. This is bug which was fixed in master after current 3.6.0
tag has been published.
As far as the af_print
macro, I am not sure what is missing there. In fact using latest rust version, Rust 2018 edition, you don't even need the
use_macroattribute. You should be able to do just
arrayfire::af_print!()`
from arrayfire-rust.
Related Issues (20)
- Add github action to check for crate vulnerabilities to run once a day on master branch HOT 1
- Support batch matrix multiplication
- Feature: Build feature to automatically download arrayfire binaries HOT 2
- [BUG] FFT example not working, Trait Bound HasAfEnum not implemented for Complex<float> HOT 5
- How to convert Seq to Array? HOT 2
- How to do assignment? HOT 2
- In file src\backend\cuda\kernel/reduce.hpp:429 CUDA Error (209): no kernel image is available for execution on the device 0# af::array::host in afcuda 1# af::array::host in afcuda 2# af::array::host in afcuda 3# af::array::host in afcuda 4# af::array::host in afcuda 5# af::array::host in af 6# arrayfire::algorithm::max_all<f64> HOT 1
- [Build] Failing Security GitHub Action HOT 3
- [BUG] Memory accumulation when using load_image in a loop HOT 3
- Multi GPU Support HOT 2
- "max" crash when using GTX 1060 and CUDA 11.8 HOT 2
- [Build] Support MacOS-arm-64
- Pad invert HOT 1
- [Build] Half 2.2.0 is not compatible HOT 5
- [Feature Request] Support indexing like `rows(..., 0, -2)`
- [BUG] arrayfire::locate fails for large arrays HOT 2
- cargo test failed with msg "error: test failed, to rerun pass `--lib`" HOT 3
- Feature Update Arrayfire Rust to 3.9.0 HOT 6
- Update repositories for releasing crates HOT 1
- Publish Release
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrayfire-rust.