Git Product home page Git Product logo

arrayfire-rust's Introduction

ci docs book slack github-discussions

ArrayFire Rust Bindings

ArrayFire is a high performance library for parallel computing with an easy-to-use API. It enables users to write scientific computing code that is portable across CUDA, OpenCL and CPU devices. This project provides Rust bindings for the ArrayFire library. Given below table shows the rust bindings compatability with ArrayFire. If you find any bugs, please report them here.

arrayfire-rust ArrayFire
M.m.p1 M.m.p2

Only, Major(M) & Minor(m) version numbers need to match. p1 and p2 are patch/fix updates for arrayfire-rust & ArrayFire respectively, and they don't need to match.

Supported platforms

Linux, Windows and OSX. Rust 1.31 or newer is required.

Use from Crates.io

To use the rust bindings for ArrayFire from crates.io, the following requirements are to be met first.

  1. Download and install ArrayFire binaries based on your operating system. Depending on the method of your installation for Linux, steps (2) & (3) may not be required. If that is the case, proceed to step (4) directly.
  2. Set the evironment variable AF_PATH to point to ArrayFire installation root folder.
  3. Make sure to add the path to lib files to your path environment variables.
    • On Linux: do export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib64
    • On OSX: do export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$AF_PATH/lib
    • On Windows: Add %AF_PATH%\lib to your PATH environment variable.
  4. Add arrayfire = "3.8" to the dependencies section of your project's Cargo.toml file. Make sure to change the version to latest available.

Once step (4) is over, you should be able to use ArrayFire in your Rust project. If you find any bugs, please report them here.

Build from Source

Edit build.conf to modify the build flags. The structure is a simple JSON blob. Currently Rust does not allow key:value pairs to be passed from the CLI. To use an existing ArrayFire installation modify the first three JSON values. You can install ArrayFire using one of the following two ways.

To build arrayfire submodule available in the rust wrapper repository, you have to do the following.

git submodule update --init --recursive
cargo build // use --all to build all crates in the workspace

This is recommended way to build Rust wrapper since the submodule points to the most compatible version of ArrayFire the Rust wrapper has been tested with. You can find the ArrayFire dependencies below.

Example

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);

Sample output

~/p/arrayfire_rust> cargo run --example helloworld
...
Create a 5-by-3 matrix of random floats on the GPU
[5 3 1 1]
    0.7402     0.4464     0.7762
    0.9210     0.6673     0.2948
    0.0390     0.1099     0.7140
    0.9690     0.4702     0.3585
    0.9251     0.5132     0.6814
...

Troubleshooting

If the build command fails with undefined references errors even after taking care of environment variables, we recommend doing a cargo clean and re-running cargo build or cargo test.

You can also use some environment variables mentioned in our book, such as AF_PRINT_ERRORS to print more elaborate error messages to console.

Acknowledgements

The ArrayFire library is written by developers at ArrayFire LLC with contributions from several individuals. The developers at ArrayFire LLC have received partial financial support from several grants and institutions. Those that wish to receive public acknowledgement are listed below:

Grants

This material is based upon work supported by the DARPA SBIR Program Office under Contract Numbers W31P4Q-14-C-0012 and W31P4Q-15-C-0008. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the DARPA SBIR Program Office.

arrayfire-rust's People

Contributors

9prady9 avatar adamnemecek avatar atomicky avatar benjamin-philip avatar botev avatar c0dearm avatar ctrl-z-9000-times avatar garymcd avatar jkelleyrtp avatar jonathanwoollett-light avatar jramapuram avatar kryo4096 avatar kryptan avatar ma2bd avatar maxtnuk avatar mcobzarenco avatar michaelmcculloch avatar mmetcalfe avatar nerosnm avatar nlsnightmare avatar nodespace avatar pauleaster avatar pavanky avatar peamaeq avatar phil-opp avatar serprex avatar tedsta avatar timmmm avatar umar456 avatar vadixidav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arrayfire-rust's Issues

Examples are not compiling

I just installed arrayfire on windows 10 pro.

I am not able to compile any example e.g. if I compile the snow.rs example I get
main.rs:20:17: 20:20 error: too many type parameters provided: expected at most 0 parameters, found 1 parameter [E0087]
main.rs:20 randu::(dims).as_ref()

Ok I am able to fix this but when I run the example I get error: Process didn't exit successfully: (...) (exit code: 3221225477)

Any hints to fix this would be great.

Thanks.

Michael

Edit:
BTW: The arrayfire-dotnet (c#) is running wihout any problems e.g. if I run the example HelloWorld I get

ArrayFire v3.3.1 (OpenCL, 64-bit Windows, build f53efc3)
[0] NVIDIA : GeForce GTX 960M, 2048 MB
-1- INTEL : Intel(R) HD Graphics 530, 6483 MB
-2- INTEL : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz, 16227 MB
arr1
[3 3 1 1]
-0.8708 -1.3035 1.1526
0.4579 -1.0310 1.1717
0.2983 0.5926 0.3209

and so on....

Macro af_print not found

I just installed arrayfire on windows 10 Pro and created a rust project as described but building the project failed with the message

main.rs:1:13: 1:21 error: imported macro not found [E0469]
main.rs:1 #[macro_use(af_print)]
^~~~~~~~
main.rs:22:5: 22:13 error: macro undefined: 'af_print!'
main.rs:22 af_print!("Create a 5-by-3 matrix of random floats on the GPU", a);

and so on....

If I use arrayfire = "3.3.0" instead of arrayfire = "3.2.0" I get version required: ^3.3.0
versions found: 3.2.0 because this is the actual version on crates.io.

Thanks.

Michael

Error with documented hellow world on Ubuntu 14.04 CUDA

Hi, I have tried to compile your example hello world and I get

tyger42@minch-yoda:~/code/playground/array_fire/rust/my_first_af$ RUST_BACKTRACE=1 cargo run
     Running `target/debug/my_first_af`
Create a 5-by-3 matrix of random floats on the GPU
modprobe: ERROR: could not insert 'nvidia_352': No such device
thread '<main>' panicked at 'Error message: Eror either in ArrayFire or in a project upstream', /home/tyger42/.cargo/registry/src/github.com-88ac128001ac3a9a/arrayfire-3.3.1/src/error.rs:47
stack backtrace:
   1:     0x7f197d657650 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
   2:     0x7f197d65983b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
   3:     0x7f197d6594c3 - std::panicking::default_hook::haac48fa641db8fa2
   4:     0x7f197d65199f - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
   5:     0x7f197d652378 - std::sys_common::unwind::begin_unwind_fmt::h64c0ff793199cc1b
   6:     0x7f197d64fc34 - arrayfire::error::handle_error_general::h850e86f50ea94bfe
                        at /home/tyger42/code/playground/array_fire/my_first_af/<std macros>:8
   7:     0x7f197d64fc4b - fn(defines..AfError) $u7b$error..handle_error_general$u7d$::fn_pointer_shim.13448::hcbcf2b22c9dc31c2
   8:     0x7f197d64efb0 - arrayfire::error::HANDLE_ERROR::hbd01e4994c2877f0
                        at /home/tyger42/.cargo/registry/src/github.com-88ac128001ac3a9a/arrayfire-3.3.1/src/error.rs:60
   9:     0x7f197d64ecdc - arrayfire::data::randu::h122f02e85e026c88
                        at /home/tyger42/.cargo/registry/src/github.com-88ac128001ac3a9a/arrayfire-3.3.1/src/data/mod.rs:282
  10:     0x7f197d64eb6a - my_first_af::main::hc5618c3a38539c0e
                        at src/main.rs:9
  11:     0x7f197d659104 - std::sys_common::unwind::try::try_fn::h09ba69fd13531e58
  12:     0x7f197d656abb - __rust_try
  13:     0x7f197d658b4b - std::rt::lang_start::h5b0863080165c75e
  14:     0x7f197d64ee19 - main
  15:     0x7f197c5f7a3f - __libc_start_main
  16:     0x7f197d64e8e8 - _start
  17:                0x0 - <unknown>
error: Process didn't exit successfully: `target/debug/my_first_af` (exit code: 101)

here is my main.rs

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);
}

And here is my graphics details

tyger42@minch-yoda:~/code/playground/array_fire/rust/my_first_af$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation GT216M [GeForce GT 330M] (rev a2)

Am I missing something or is this possibly a library issue? Thank you!

Can't run project with `cargo run` on OSX

Platform: macOS 10.12.2
Cargo: cargo 0.15.0-nightly (298a012 2016-12-20)
Rust: rustc 1.14.0 (e8a012324 2016-12-16)

I've set up a rust project using crates but I'm getting no backends if I use cargo run, if I run the executable directly from the shell, I get expected results.

cargo run --example unified
   Compiling arrayfire v3.4.1 (file:///Users/shane/src/rust/arrayfire-rust)
    Finished debug [unoptimized + debuginfo] target(s) in 0.27 secs
     Running `target/debug/examples/unified`
There are 0 available backends

cargo build --example unified
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs

./target/debug/examples/unified
There are 2 available backends
Evaluating CPU Backend...
There are 1 CPU compute devices
...

I've added a stackoverflow question with similar info http://stackoverflow.com/questions/41602744/how-to-configure-arrayfire-rust-to-use-cargo-run

Array Indexing

Is it possible at this point to indexing arrays by implementing IndexMut, etc? It would be nice to do be able to do the following a[x_index][y_index][z_index][d_index]

Ideally it would be great to be able to have ranges inside as well [numpy style], eg:
a[0..x_index][y_index][z_index][d_index]

and even negative indexing to pick elements from the end:
a[-1][y_index][z_index][d_index]

Relevant SO post. I believe dynamic types are already in now?

Implement Neg overloaded operator for Array

Array should implement the unary negative operator. It is implemented in C++ by making a zero array of the same size and subtracting them. I guess something like this:

impl Neg for Array {
    fn neg(&self) -> Array {
        constant(0, self.dims()) - self
    }
}

Sorry I am new to Rust so that is probably all wrong. Also I can't find a good explanation for how copying/cloning arrays in ArrayFire works.

Build issue with rustc 1.10.0

Facing the following compile error on rustc 1.10.0 which didn't happen on earlier version. We are currently looking into it.

   Compiling arrayfire v3.4.0 (file:///home/pradeep/gitroot/arrayfire-rust)
src/error.rs:25:1: 25:81 error: the trait bound `std::ops::Fn(defines::AfError) + 'static: std::marker::Sync` is not satisfied [E0277]
src/error.rs:25 pub static DEFAULT_HANDLE_ERROR: &'static ErrorCallback = &handle_error_general;
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/error.rs:25:1: 25:81 help: run `rustc --explain E0277` to see a detailed explanation
src/error.rs:25:1: 25:81 note: `std::ops::Fn(defines::AfError) + 'static` cannot be shared between threads safely
src/error.rs:25:1: 25:81 note: required because it appears within the type `&'static std::ops::Fn(defines::AfError) + 'static`
src/error.rs:25:1: 25:81 note: shared static variables must have a type that implements `Sync`
error: aborting due to previous error
error: Could not compile `arrayfire`.

To learn more, run the command again with --verbose.

passing a str pointer (or even a String) into af::Window::new via a function call results in a GLFWWindow Error for Graphics module

pub fn plot(raw_values: Vec<f32>, title: &'static str, window_x: u16, window_y: u16) {
  // copy from float vector to Array
  let dims = Dim4::new(&[raw_values.len() as u64, 1, 1, 1]);
  let values = &Array::new(dims, &raw_values.as_ref(), Aftype::F32).unwrap();

  // create a window
  let title_str = String::from(title); // if we don't .clone() we get a crash!
  let wnd = match af::Window::new(window_x as i32, window_y as i32, title_str) {
    Ok(v)  => v,
    Err(e) => panic!("Window creation failed: {}", e), //XXX: handle better
  };

  // display till closed
  loop {
    wnd.draw_plot(&af::range(dims, 0, af::Aftype::F32).unwrap(), &values, None);
    if wnd.is_closed().unwrap() == true { break; }
  }
}

results in:

2015-08-26 14:44:37.785 perceptron[11818:5138515] *** Assertion failure in -[GLFWWindow setTitle:], /SourceCache/AppKit/AppKit-1348.17/AppKit.subproj/NSWindow.m:3068
thread '<main>' panicked at 'Window creation failed: Unkown Error', src/plot.rs:14
An unknown error occurred

Possible solution: run .clone() internally in the appropriate functions

selectl (and possibly others) return only f64 arrays

I have an issue when using a laptop that doesn't have a card that support F64.

The current selectl is as follows:

pub fn selectl(a: f64, cond: &Array, b: &Array) -> Array {

This automatically returns an f64 array which breaks my entire pipeline. Not sure what the behavior is in af mainline.

There are a few other functions (not sure at the top of my head right now) that do the same thing and I have to hack it with something obtuse such as this:

pub fn cast(input: &Array, dest_type: DType) -> Array {
  if input.get_type() == dest_type{
    return input.clone()
  }

  match dest_type
  {
    DType::F32 => input.cast::<f32>(),
    DType::F64 => input.cast::<f64>(),
    DType::C32 => input.cast::<Complex<f32>>(),
    DType::C64 => input.cast::<Complex<f64>>(),
    DType::B8  => input.cast::<bool>(),
    DType::S32 => input.cast::<i32>(),
    DType::U32 => input.cast::<u32>(),
    DType::U8  => input.cast::<u8>(),
    DType::S64 => input.cast::<i64>(),
    DType::U64 => input.cast::<u64>(),
    DType::S16 => input.cast::<i64>(),
    DType::U16 => input.cast::<u16>(),
  }
}

While this works for the case of upcasting say an array of i32 --> f32, with af::selectl though there is no way to proceed at all as I get the following error:

thread '<main>' panicked at 'Error message: This device does not support double', arrayfire-rust/src/error.rs:47
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Desired goal: return array of same type as input array and simply convert the SINGLE value (eg: a in selectl) to the destination type (as opposed to the entire array). Suggest using numeric generic type or typecast (as a last hope) if necessary ( conv can be used for this to saturate)

Plans to integrate rust-ndarray?

Do you have plans to integrate arrayfire-rust with rust-ndarray? I understand that arrayfire supports up to 4 dimensions, so I am not calliing for actually implementing n-dimensional arrays as requested here.

I believe ndarray is currently the most mature library for handling arrays in Rust, and I am actively using it in my projects (integration of high-dimensional ODEs). It would be great if there was a straight-forward way of combining this with arrayfire.

Error on OSX in OpenCL backend

Evaluating OpenCL Backend...
There are 2 OpenCL compute devices
ArrayFire v3.4.0 (OpenCL, 64-bit Mac OSX, build 2ecff98)
[0] APPLE   : GeForce GT 750M, 2048 MB
-1- APPLE   : Iris Pro, 1536 MB
Create a 10-by-10 matrix of random floats on the compute device
No Name Array
[10 10 1 1]
Process 32181 stopped
* thread #1: tid = 0x1ba85f, 0x00007fff8798ef06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'opencl_runtime', stop reason = signal SIGABRT
    frame #0: 0x00007fff8798ef06 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff8798ef06 <+10>: jae    0x7fff8798ef10            ; <+20>
    0x7fff8798ef08 <+12>: movq   %rax, %rdi
    0x7fff8798ef0b <+15>: jmp    0x7fff879897cd            ; cerror_nocancel
    0x7fff8798ef10 <+20>: retq
(lldb) bt
* thread #1: tid = 0x1ba85f, 0x00007fff8798ef06 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'opencl_runtime', stop reason = signal SIGABRT
  * frame #0: 0x00007fff8798ef06 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff87c844ec libsystem_pthread.dylib`pthread_kill + 90
    frame #2: 0x00007fff9ae886e7 libsystem_c.dylib`abort + 129
    frame #3: 0x00007fff95c07e5c libGPUSupportMercury.dylib`gpusGenerateCrashLog + 158
    frame #4: 0x00007fff93fa4dc7 GeForceGLDriver`___lldb_unnamed_function6443$$GeForceGLDriver + 9
    frame #5: 0x00007fff95c08818 libGPUSupportMercury.dylib`gpusQueueSubmitDataBuffers + 162
    frame #6: 0x00007fff9797b026 libclh.dylib`channelFlushUnitFlushGLK + 278
    frame #7: 0x00007fff9791346d libclh.dylib`channelFlush_UnderLock + 317
    frame #8: 0x00007fff979132fe libclh.dylib`channelEndPushInternal_UnderLock + 526
    frame #9: 0x00007fff979130be libclh.dylib`channelEndPushInternal + 14
    frame #10: 0x00007fff9791a3f8 libclh.dylib`ctxMarkerPushAwakenInternal + 360
    frame #11: 0x00007fff9791a73d libclh.dylib`ctxMarkerWait + 77
    frame #12: 0x00007fff978567e2 libclh.dylib`cuiCtxSynchronize + 258
    frame #13: 0x00007fff94088af6 GeForceGLDriver`gldFinishQueue + 253
    frame #14: 0x00007fff8685bb86 OpenCL`___lldb_unnamed_function16$$OpenCL + 78
    frame #15: 0x00007fff8685c058 OpenCL`___lldb_unnamed_function17$$OpenCL + 1114
    frame #16: 0x00007fff8687a358 OpenCL`___lldb_unnamed_function440$$OpenCL + 95
    frame #17: 0x00007fff8687d9b8 OpenCL`___lldb_unnamed_function475$$OpenCL + 286
    frame #18: 0x00007fff8557540b libdispatch.dylib`_dispatch_client_callout + 8
    frame #19: 0x00007fff85583a9a libdispatch.dylib`_dispatch_barrier_sync_f_slow + 856
    frame #20: 0x00007fff8687d834 OpenCL`___lldb_unnamed_function474$$OpenCL + 127
    frame #21: 0x00007fff86879430 OpenCL`___lldb_unnamed_function426$$OpenCL + 436
    frame #22: 0x00007fff8686e777 OpenCL`clEnqueueReadBuffer + 817
    frame #23: 0x0000000104315cdd libafopencl.3.dylib`void opencl::copyData<float>(float*, opencl::Array<float> const&) + 573
    frame #24: 0x0000000105a6b595 libafopencl.3.dylib`af_get_data_ptr + 149
    frame #25: 0x0000000105c9dd81 libafopencl.3.dylib`void print<float>(char const*, void*, int, std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool) + 1025
    frame #26: 0x0000000105c9d543 libafopencl.3.dylib`af_print_array + 227
    frame #27: 0x0000000100003e11 unified`arrayfire::array::print(input=0x00007fff5fbfecb8) + 33 at array.rs:323
    frame #28: 0x000000010000166c unified`unified::test_backend + 1004 at unified.rs:18
    frame #29: 0x000000010000263f unified`unified::main + 3599 at unified.rs:52
    frame #30: 0x000000010000cca3 unified`sys_common::unwind::try::try_fn::h14566978960817497624 + 35
    frame #31: 0x000000010000b659 unified`__rust_try + 9
    frame #32: 0x000000010000cb46 unified`rt::lang_start::h8931373347d15a278Vx + 566
    frame #33: 0x0000000100003b7a unified`main + 42
    frame #34: 0x00007fff96df45ad libdyld.dylib`start + 1

Require Rust 1.8

With the error handling push I started seeing errors like this:

src/arith/mod.rs:387:1: 387:55 note: in this expansion of bit_assign_func! (defined in src/arith/mod.rs)
src/arith/mod.rs:376:13: 382:14 error: use of unstable library feature 'op_assign_traits': recently added (see issue #28235)
src/arith/mod.rs:376             fn $fn_name(&mut self, rhs: Array) {
src/arith/mod.rs:377                 let mut idxrs = Indexer::new();
src/arith/mod.rs:378                 idxrs.set_index(&Seq::<f32>::default(), 0, Some(false));
src/arith/mod.rs:379                 idxrs.set_index(&Seq::<f32>::default(), 1, Some(false));
src/arith/mod.rs:380                 let tmp = assign_gen(self as &Array, &idxrs, & $func(self as &Array, &rhs));
src/arith/mod.rs:381                 mem::replace(self, tmp);

Bumping my rust install to 1.8 solved this.

Creating arrays similar to other arrays

The current rust interface to arrayfire uses stricter type enforcement than the underlying C interface, which is good for safety but also prevents using e.g. arrayfire::constant to create an array of the same type as another array, because

1- ConstGenerator is private
2- get_type can't return a type (so it returns a DType)
3- There is no way to use a DType instead of a type on which HasAfEnum is defined when such a thing is required (i.e. pretty much everywhere)
4- HasAfEnum's get_af_dtype does not use a ...self parameter so it's not possible to define HasAfEnum on a DType wrapper.

I see two obvious possible solutions for this issue:

1- Implement HasAfEnum for DType and possibly make get_af_dtype take a ...self argument as a result
2- Expose helper functions zeros_like and ones_like (at least) which yield, respectively, an array of zeros with the same type and shape as the input (an array), or likewise for an array of ones. With these, it's possible to create arbitrary arrays with the same dimensions and type as another array.

However I don't know if limiting the solution to this would impact performance too much. I recall reading that arrayfire can optimize sequences of operations but I don't know if such a usecase is covered.

Use the unified API and switch backends at runtime

Now that the unified API is in the devel branch, the choice of backend can be made at runtime via a specified command.

I think this needs to be done after a particular tag is made that is compatible with 3.0. We can skip 3.1 compatibility entirely and jump to 3.2.

Wrap C API

currently calls are made along the lines of:

    unsafe {
          let A: *mut arrayfire::af_array = &mut NULL as *mut _ as *mut arrayfire::af_array;
          let dims: [arrayfire::dim_t; 2] = [5,3];
          arrayfire::af_randu(A, 2, &dims[0], arrayfire::f32);
      }

If we can clean this up with a nice 'Rusty' type object that would be helpful.

Resolve Operator Overloading Disparity

Keeping this one here till either:

  1. Rust provides a better interface / error handling for this (or)
  2. We strip the overloading and resort to af::add () , etc.

In this case 1 > 2

Invalid Memory Reference on --release builds (only)

Note: This happens only with cargo run --release

extern crate arrayfire as af;

use af::{Array, Dim4, DType};

pub fn assert_types(v: Vec<&Array>){
  let base_type = v[0].get_type();
  for i in 1..v.len() {
    let cur_type = v[i].get_type();
    assert!(cur_type == base_type
            , "type mismatch detected: {:?} vs {:?}"
            , cur_type, base_type);
  }
}

fn main() {
  for _ in 0..100000 {
    let a = af::constant(3.0f32, Dim4::new(&[128, 128, 1, 1]));
    let b =  af::constant(3.0f32, Dim4::new(&[128, 128, 1, 1]));
    assert_types(vec![&a, &b]);
  }
}

Stack trace:

(lldb) r
Process 71790 launched: '/Users/jramapuram/Dropbox/projects/af_playground/target/release/af_playground' (x86_64)
warning: (x86_64) /usr/local/cuda/lib/libcublas.7.5.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /usr/local/cuda/lib/libcufft.7.5.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /Developer/NVIDIA/CUDA-7.5/nvvm/lib/libnvvm.3.0.0.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
warning: (x86_64) /usr/local/cuda/lib/libcusolver.7.5.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 71790 stopped
* thread #1: tid = 0x591924, 0x0000000100001696 af_playground`main::h935482300789cbfaWda + 326, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x7fff5effffd7)
    frame #0: 0x0000000100001696 af_playground`main::h935482300789cbfaWda + 326
af_playground`main::h935482300789cbfaWda:
->  0x100001696 <+326>: movb   %r15b, -0x29(%rbp)
    0x10000169a <+330>: movq   0x8(%r14), %rdi
    0x10000169e <+334>: callq  0x1000018c0               ; array::Array::get_type::h6963b010eb7489401ka
    0x1000016a3 <+339>: movb   %al, -0x2a(%rbp)

Multiple runs cause different issues:

โžœ  af_playground git:(master) โœ— cargo run --release --verbose
       Fresh rustc-serialize v0.3.19
       Fresh lazy_static v0.2.1
       Fresh libc v0.1.12
       Fresh winapi-build v0.1.1
       Fresh winapi v0.2.7
       Fresh semver v0.1.20
       Fresh custom_derive v0.1.5
       Fresh libc v0.2.11
       Fresh num-traits v0.1.32
       Fresh rustc_version v0.1.7
       Fresh conv v0.3.3
       Fresh rand v0.3.14
       Fresh num-integer v0.1.32
       Fresh num-complex v0.1.32
       Fresh num-iter v0.1.32
       Fresh num-bigint v0.1.32
       Fresh kernel32-sys v0.2.2
       Fresh num-rational v0.1.32
       Fresh time v0.1.35
       Fresh num v0.1.32
       Fresh arrayfire v3.3.0
       Fresh af_playground v0.1.0 (file:///Users/jramapuram/Dropbox/projects/af_playground)
     Running `target/release/af_playground`
error: Process didn't exit successfully: `target/release/af_playground` (signal: 11, SIGSEGV: invalid memory reference)
โžœ  af_playground git:(master) โœ— cargo run --release --verbose
       Fresh custom_derive v0.1.5
       Fresh libc v0.2.11
       Fresh winapi-build v0.1.1
       Fresh num-traits v0.1.32
       Fresh semver v0.1.20
       Fresh rustc-serialize v0.3.19
       Fresh lazy_static v0.2.1
       Fresh winapi v0.2.7
       Fresh conv v0.3.3
       Fresh rand v0.3.14
       Fresh num-integer v0.1.32
       Fresh rustc_version v0.1.7
       Fresh num-complex v0.1.32
       Fresh libc v0.1.12
       Fresh num-iter v0.1.32
       Fresh num-bigint v0.1.32
       Fresh kernel32-sys v0.2.2
       Fresh num-rational v0.1.32
       Fresh time v0.1.35
       Fresh num v0.1.32
       Fresh arrayfire v3.3.0
       Fresh af_playground v0.1.0 (file:///Users/jramapuram/Dropbox/projects/af_playground)
     Running `target/release/af_playground`
thread '<main>' panicked at 'Error message: Unknown Error', /Users/jramapuram/.cargo/registry/src/github.com-88ac128001ac3a9a/arrayfire-3.3.0/src/error.rs:47
note: Run with `RUST_BACKTRACE=1` for a backtrace.
fatal runtime error: Could not unwind stack, error = 5
error: Process didn't exit successfully: `target/release/af_playground` (signal: 4, SIGILL: illegal instruction)

gtest submodule won't initialize correctly

The one in the main arrayfire repo appears to work fine though

Submodule 'arrayfire' (https://github.com/arrayfire/arrayfire) registered for path 'arrayfire'
Cloning into 'arrayfire'...
remote: Counting objects: 23410, done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 23410 (delta 11), reused 0 (delta 0), pack-reused 23364
Receiving objects: 100% (23410/23410), 5.23 MiB | 2.23 MiB/s, done.
Resolving deltas: 100% (16296/16296), done.
Checking connectivity... done.
Submodule path 'arrayfire': checked out '86426db07af709f8880b4e86a34eb354e9ceedac'
Submodule 'assets' (https://github.com/arrayfire/assets) registered for path 'assets'
Submodule 'test/data' (https://github.com/arrayfire/arrayfire_data) registered for path 'test/data'
Submodule 'test/gtest' (http://git.chromium.org/external/googletest.git) registered for path 'test/gtest'
Cloning into 'assets'...
remote: Counting objects: 106, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 106 (delta 8), reused 4 (delta 4), pack-reused 97
Receiving objects: 100% (106/106), 15.53 MiB | 4.27 MiB/s, done.
Resolving deltas: 100% (15/15), done.
Checking connectivity... done.
Submodule path 'arrayfire/assets': checked out '77ba8d3c8dc399c49da7413774b71985ce989a09'
Cloning into 'test/data'...
remote: Counting objects: 671, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 671 (delta 0), reused 0 (delta 0), pack-reused 662
Receiving objects: 100% (671/671), 10.05 MiB | 4.29 MiB/s, done.
Resolving deltas: 100% (272/272), done.
Checking connectivity... done.
Submodule path 'arrayfire/test/data': checked out '8b4a85eb89118028b4da524f0d734969baa4b0f2'
Cloning into 'test/gtest'...
fatal: http://git.chromium.org/external/googletest.git/info/refs not valid: is this a git repository?
Clone of 'http://git.chromium.org/external/googletest.git' into submodule path 'test/gtest' failed
Failed to recurse into submodule path 'arrayfire'
[kelvin@batman007 arrayfire_rust]$ git submodule update --init --recursive
Cloning into 'test/gtest'...
fatal: http://git.chromium.org/external/googletest.git/info/refs not valid: is this a git repository?
Clone of 'http://git.chromium.org/external/googletest.git' into submodule path 'test/gtest' failed
Failed to recurse into submodule path 'arrayfire'

Incorrect output of `print` and `af_print` under osx/opencl

In my mac pro (with ati radoen hd 5770), both print function and af_print macro prints incorrect values.

code:

#[macro_use(af_print)]
extern crate arrayfire as af;

use af::*;

fn main() {
    let available = get_available_backends();
    // Select CUDA - OPENCL - CPU
    if available.contains(&Backend::CUDA) {
       set_backend(Backend::CUDA);
       println!("There are {} CUDA compute devices", device_count());
    } else if available.contains(&Backend::OPENCL) {
       set_backend(Backend::OPENCL);
       println!("There are {} OPENCL compute devices", device_count());
    } else if available.contains(&Backend::CPU) {
       println!("Evaluating CPU Backend...");
       set_backend(Backend::CPU);
       println!("There are {} CPU compute devices", device_count());
    }
    info();
    let dims = Dim4::new(&[10,10,1,1]);
    let a = randu::<f32>(dims);
    let b = randu::<f32>(dims);
    // print
    print(&a);
    print(&b);
    // macro print
    af_print!("", a);
    af_print!("", b);

    // firstly copy array to a vec, then print. (only this works)
    let mut buf = Vec::<f32>::new();
    buf.resize(100, 0f32);
    a.host(&mut buf);
    println!("{:?}", buf);

}

Output: (expect random values between [0,1], got nan.)

$ cargo run
     Running `target/debug/af`
There are 1 OPENCL compute devices
ArrayFire v3.3.2 (OpenCL, 64-bit Mac OSX, build f65dd97)
[0] APPLE   : ATI Radeon HD 5770, 1024 MB
No Name Array
[10 10 1 1]
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 

No Name Array
[10 10 1 1]
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 


No Name Array
[10 10 1 1]
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 


No Name Array
[10 10 1 1]
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 
       nan        nan        nan        nan        nan        nan        nan        nan        nan        nan 

[0.41073772, 0.8223705, 0.95179963, 0.17936543, 0.41982353, 0.008073494, 0.37754178, 0.3026608, 0.64556795, 0.55907905, 0.6600012, 0.0764177, 0.09007972, 0.593275, 0.10984313, 0.104641184, 0.8826711, 0.16470726, 0.8059861, 0.5937568, 0.839482, 0.19334152, 0.7270495, 0.03218992, 0.0011899231, 0.87032217, 0.5259499, 0.14427514, 0.32533863, 0.5081013, 0.92498755, 0.30630583, 0.9312504, 0.86840326, 0.6591691, 0.43871564, 0.37842128, 0.40023077, 0.43901545, 0.47176215, 0.6529656, 0.54763544, 0.85767967, 0.836985, 0.061794102, 0.42239332, 0.529269, 0.021239838, 0.11028498, 0.44200444, 0.8355114, 0.48783612, 0.2055233, 0.17935656, 0.56057334, 0.67667997, 0.67417336, 0.452302, 0.12359583, 0.79240143, 0.103285834, 0.21190202, 0.5955207, 0.37446535, 0.91645145, 0.9425949, 0.48174524, 0.9097086, 0.6821017, 0.605556, 0.9275532, 0.8661627, 0.35776076, 0.6262612, 0.9746776, 0.20015794, 0.20222169, 0.5388589, 0.55094266, 0.81801903, 0.6742259, 0.97126704, 0.9877892, 0.06626553, 0.6042976, 0.59000194, 0.7481744, 0.23789643, 0.31214234, 0.89567167, 0.28086075, 0.30839512, 0.19651483, 0.14590272, 0.25506493, 0.5745967, 0.36144972, 0.4470784, 0.083551034, 0.7877617]

0 backends in Rust

Hey everyone,

I'm on OSX 10.10 and I built and installed ArrayFire C++ with the CPU and OpenCL backend. I've ran the C++ tests (everything passed), ran the basic_unified.cpp example from /tmp, and used this in other C++ projects so I know the C++ version works.

I downloaded the AF Rust repo, initiated the submodules, compiled the project without issues, and set the AF_PATH. However when I run cargo run --example unified I get
There are 0 available backends

I also tried using the AF Rust from crates.io and I get the same thing. Any ideas why this is happening?

P.S. I'm using AF 3.4.0

Rust Bindgen Fails

Tried using https://github.com/crabtw/rust-bindgen but fails when pulling in ostream:

    jramapuram@gauss ~/p/a/include>
    ../../rust-bindgen/target/debug/bindgen -l lib/libafcuda.dylib -I /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -o arrayfire.rs arrayfire.h
    arrayfire.h:10:9: warning: #pragma once in main file
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:227:9: error: unknown type name '__char16_t'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:228:9: error: unknown type name '__char32_t'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:360:1: error: unknown type name 'namespace'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:360:14: error: expected ';' after top level declarator
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:538:1: error: unknown type name 'template'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:538:10: error: expected identifier or '('
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:539:1: error: unknown type name 'template'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config:539:10: error: expected identifier or '('
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:96:1: error: unknown type name 'namespace'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/iosfwd:96:1: error: expected ';' after top level declarator
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:67:1: error: unknown type name 'namespace'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:67:1: error: expected ';' after top level declarator
    /usr/include/wctype.h:122:1: error: unknown type name 'wctrans_t'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cwctype:61:1: error: unknown type name 'namespace'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cwctype:61:1: error: expected ';' after top level declarator
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstddef:44:1: error: unknown type name 'namespace'
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstddef:44:1: error: expected ';' after top level declarator
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:132:38: error: expected ';' after top level declarator
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/new:133:30: error: variable has incomplete type 'void'
    fatal error: too many errors emitted, stopping now [-ferror-limit=]

Port all functions from ArrayFire 3.0

Import from each header file into unique source files.

  • algorithm
  • arith
  • array
  • blas
  • data
  • defines
  • device
  • features
  • graphics
  • image
  • index
  • lapack
  • signal
  • statistics
  • util
  • version
  • vision

C++ only headers that need not be ported

  • exception.h (ported the necessary C function to util.py)
  • complex.h
  • dim4.hpp
  • gfor (are there any necessary bits??)
  • constants

Inconsistent behavior: operator+ & af:add

af::add is throwing a convertible error if you pass in an &af::Array

let test2 = add(&a, &b).unwrap();
โžœ  arrayfire-rust git:(master) โœ— cargo run --example helloworld
   Compiling arrayfire v3.0.0 (file:///Users/jramapuram/projects/arrayfire-rust)
examples/helloworld.rs:39:17: 39:20 error: the trait `arrayfire::arith::Convertable` is not implemented for the type `&arrayfire::array::Array` [E0277]
examples/helloworld.rs:39     let test2 = add(&a, &b).unwrap();
                                          ^~~
examples/helloworld.rs:39:17: 39:20 help: run `rustc --explain E0277` to see a detailed explanation
examples/helloworld.rs:39:17: 39:20 error: the trait `arrayfire::arith::Convertable` is not implemented for the type `&arrayfire::array::Array` [E0277]
examples/helloworld.rs:39     let test2 = add(&a, &b).unwrap();
                                          ^~~
examples/helloworld.rs:39:17: 39:20 help: run `rustc --explain E0277` to see a detailed explanation
error: aborting due to 2 previous errors
Could not compile `arrayfire`.

However, operator+ seems to work just fine. This behaviour should be consistent & accept an &Array.

Using arrayfire-rust in library breaks with an af_draw_surface dependency

Couldn't post the entire example on play-rust so here is a zip with the example: https://dl.dropboxusercontent.com/u/13112806/graphics.zip

This happens with & without using the crate.
Only the crate example is provided though.

Error logs from build:

โžœ  graphics git:(master) โœ— echo $AF_PATH
/usr/local
โžœ  graphics git:(master) โœ— cargo run --verbose --example main
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling rustc-serialize v0.3.16
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/rustc-serialize-0.3.16/src/lib.rs --crate-name rustc_serialize --crate-type lib -g -C metadata=7ff5bfc027146194 -C extra-filename=-7ff5bfc027146194 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps -Awarnings`
   Compiling libc v0.2.2
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.2.2/src/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"default\" -C metadata=540159808ccfa9ab -C extra-filename=-540159808ccfa9ab --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps -Awarnings`
   Compiling winapi-build v0.1.1
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/winapi-build-0.1.1/src/lib.rs --crate-name build --crate-type lib -g -C metadata=304afb6bdff23d72 -C extra-filename=-304afb6bdff23d72 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps -Awarnings`
   Compiling winapi v0.2.5
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/winapi-0.2.5/src/lib.rs --crate-name winapi --crate-type lib -g -C metadata=d88a8c018c340227 -C extra-filename=-d88a8c018c340227 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps -Awarnings`
   Compiling libc v0.1.12
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.12/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"default\" --cfg feature=\"cargo-build\" -C metadata=29adb837ec836726 -C extra-filename=-29adb837ec836726 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps -Awarnings`
   Compiling kernel32-sys v0.2.1
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/kernel32-sys-0.2.1/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /private/tmp/graphics/target/debug/build/kernel32-sys-35c1a745c861d23a --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern build=/private/tmp/graphics/target/debug/deps/libbuild-304afb6bdff23d72.rlib -Awarnings`
   Compiling advapi32-sys v0.1.2
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/advapi32-sys-0.1.2/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /private/tmp/graphics/target/debug/build/advapi32-sys-cfef7a1f30f1e5f6 --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern build=/private/tmp/graphics/target/debug/deps/libbuild-304afb6bdff23d72.rlib -Awarnings`
     Running `/private/tmp/graphics/target/debug/build/advapi32-sys-cfef7a1f30f1e5f6/build-script-build`
     Running `/private/tmp/graphics/target/debug/build/kernel32-sys-35c1a745c861d23a/build-script-build`
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/kernel32-sys-0.2.1/src/lib.rs --crate-name kernel32 --crate-type lib -g -C metadata=35c1a745c861d23a -C extra-filename=-35c1a745c861d23a --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern winapi=/private/tmp/graphics/target/debug/deps/libwinapi-d88a8c018c340227.rlib -Awarnings`
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/advapi32-sys-0.1.2/src/lib.rs --crate-name advapi32 --crate-type lib -g -C metadata=cfef7a1f30f1e5f6 -C extra-filename=-cfef7a1f30f1e5f6 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern winapi=/private/tmp/graphics/target/debug/deps/libwinapi-d88a8c018c340227.rlib -Awarnings`
   Compiling rand v0.3.12
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/rand-0.3.12/src/lib.rs --crate-name rand --crate-type lib -g -C metadata=204b49f864ff4762 -C extra-filename=-204b49f864ff4762 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern libc=/private/tmp/graphics/target/debug/deps/liblibc-540159808ccfa9ab.rlib --extern advapi32=/private/tmp/graphics/target/debug/deps/libadvapi32-cfef7a1f30f1e5f6.rlib --extern winapi=/private/tmp/graphics/target/debug/deps/libwinapi-d88a8c018c340227.rlib -Awarnings`
   Compiling time v0.1.34
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/time-0.1.34/src/lib.rs --crate-name time --crate-type lib -g -C metadata=b8d9c9e7ca5bced7 -C extra-filename=-b8d9c9e7ca5bced7 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern kernel32=/private/tmp/graphics/target/debug/deps/libkernel32-35c1a745c861d23a.rlib --extern winapi=/private/tmp/graphics/target/debug/deps/libwinapi-d88a8c018c340227.rlib --extern libc=/private/tmp/graphics/target/debug/deps/liblibc-540159808ccfa9ab.rlib -Awarnings`
   Compiling num v0.1.28
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/num-0.1.28/src/lib.rs --crate-name num --crate-type lib -g --cfg feature=\"complex\" --cfg feature=\"rustc-serialize\" --cfg feature=\"rand\" --cfg feature=\"bigint\" --cfg feature=\"rational\" --cfg feature=\"default\" -C metadata=e432b6183cf6cb0e -C extra-filename=-e432b6183cf6cb0e --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern rustc_serialize=/private/tmp/graphics/target/debug/deps/librustc_serialize-7ff5bfc027146194.rlib --extern rand=/private/tmp/graphics/target/debug/deps/librand-204b49f864ff4762.rlib -Awarnings`
   Compiling arrayfire v3.2.0-rc0
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/arrayfire-3.2.0-rc0/build.rs --crate-name build_script_build --crate-type bin -C prefer-dynamic -g --out-dir /private/tmp/graphics/target/debug/build/arrayfire-f18930cca82be3e0 --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern rustc_serialize=/private/tmp/graphics/target/debug/deps/librustc_serialize-7ff5bfc027146194.rlib -Awarnings`
     Running `/private/tmp/graphics/target/debug/build/arrayfire-f18930cca82be3e0/build-script-build`
     Running `rustc /Users/jramapuram/.cargo/registry/src/github.com-0a35038f75765ae4/arrayfire-3.2.0-rc0/src/lib.rs --crate-name arrayfire --crate-type lib -g -C metadata=f18930cca82be3e0 -C extra-filename=-f18930cca82be3e0 --out-dir /private/tmp/graphics/target/debug/deps --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug/deps -L dependency=/private/tmp/graphics/target/debug/deps --extern libc=/private/tmp/graphics/target/debug/deps/liblibc-29adb837ec836726.rlib --extern num=/private/tmp/graphics/target/debug/deps/libnum-e432b6183cf6cb0e.rlib --extern time=/private/tmp/graphics/target/debug/deps/libtime-b8d9c9e7ca5bced7.rlib -Awarnings -L native=/usr/local/lib -L native=/usr/local/cuda/lib64 -L native=/usr/local/cuda/nvvm/lib64 -L native=/usr/lib64 -l dylib=af -l dylib=forge`
   Compiling graphics v0.1.0 (file:///private/tmp/graphics)
     Running `rustc src/lib.rs --crate-name graphics --crate-type dylib -C prefer-dynamic -g --out-dir /private/tmp/graphics/target/debug --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug -L dependency=/private/tmp/graphics/target/debug/deps --extern arrayfire=/private/tmp/graphics/target/debug/deps/libarrayfire-f18930cca82be3e0.rlib -L native=/usr/local/lib -L native=/usr/local/cuda/lib64 -L native=/usr/local/cuda/nvvm/lib64 -L native=/usr/lib64`
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib" "/private/tmp/graphics/target/debug/graphics.0.o" "-o" "/private/tmp/graphics/target/debug/libgraphics.dylib" "-Wl,-force_load,/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a" "/private/tmp/graphics/target/debug/graphics.metadata.o" "-Wl,-dead_strip" "-nodefaultlibs" "-Wl,-force_load,/var/folders/89/g3s244y547q8_t_xb_t0fh3c0000gn/T/rustc.OMqSgX2sKDj1/libarrayfire-f18930cca82be3e0.rlib" "-Wl,-force_load,/var/folders/89/g3s244y547q8_t_xb_t0fh3c0000gn/T/rustc.OMqSgX2sKDj1/libnum-e432b6183cf6cb0e.rlib" "-Wl,-force_load,/var/folders/89/g3s244y547q8_t_xb_t0fh3c0000gn/T/rustc.OMqSgX2sKDj1/librand-204b49f864ff4762.rlib" "-Wl,-force_load,/var/folders/89/g3s244y547q8_t_xb_t0fh3c0000gn/T/rustc.OMqSgX2sKDj1/librustc_serialize-7ff5bfc027146194.rlib" "-Wl,-force_load,/var/folders/89/g3s244y547q8_t_xb_t0fh3c0000gn/T/rustc.OMqSgX2sKDj1/liblibc-29adb837ec836726.rlib" "-Wl,-force_load,/var/folders/89/g3s244y547q8_t_xb_t0fh3c0000gn/T/rustc.OMqSgX2sKDj1/liblibc-540159808ccfa9ab.rlib" "-L" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib" "-l" "std-74fa456f" "-L" "/private/tmp/graphics/target/debug" "-L" "/private/tmp/graphics/target/debug/deps" "-L" "/usr/local/lib" "-L" "/usr/local/cuda/lib64" "-L" "/usr/local/cuda/nvvm/lib64" "-L" "/usr/lib64" "-L" "/usr/local/Cellar/rust/HEAD/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/private/tmp/graphics/.rust/lib/x86_64-apple-darwin" "-L" "/private/tmp/graphics/lib/x86_64-apple-darwin" "-l" "af" "-l" "forge" "-l" "c" "-l" "m" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-dynamiclib" "-Wl,-dylib" "-l" "compiler-rt"
note: ld: warning: directory not found for option '-L/usr/local/cuda/nvvm/lib64'
ld: warning: directory not found for option '-L/usr/lib64'
ld: warning: directory not found for option '-L/private/tmp/graphics/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/private/tmp/graphics/lib/x86_64-apple-darwin'
Undefined symbols for architecture x86_64:
  "_af_draw_surface", referenced from:
      graphics::Window::draw_surface::h50564f660a3c09dalHf in libarrayfire-f18930cca82be3e0.rlib(arrayfire-f18930cca82be3e0.0.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
Could not compile `graphics`.

Caused by:
  Process didn't exit successfully: `rustc src/lib.rs --crate-name graphics --crate-type dylib -C prefer-dynamic -g --out-dir /private/tmp/graphics/target/debug --emit=dep-info,link -L dependency=/private/tmp/graphics/target/debug -L dependency=/private/tmp/graphics/target/debug/deps --extern arrayfire=/private/tmp/graphics/target/debug/deps/libarrayfire-f18930cca82be3e0.rlib -L native=/usr/local/lib -L native=/usr/local/cuda/lib64 -L native=/usr/local/cuda/nvvm/lib64 -L native=/usr/lib64` (exit code: 101)

linking with `cc` failed: exit code: 1

...

In function `arrayfire::random::randu<f32>':
/home/pola/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.4.0/src/random/mod.rs:88: undefined reference to `af_randu'
/home/pola/projects/af-example/target/debug/deps/libarrayfire-6f8f57e7476ef501.rlib(arrayfire-6f8f57e7476ef501.0.o): In function `arrayfire::array::{{impl}}::drop':
/home/pola/.cargo/registry/src/github.com-1ecc6299db9ec823/arrayfire-3.4.0/src/array.rs:412: undefined reference to `af_release_array'
collect2: error: ld returned 1 exit status

I've tried the example and used my package manager(Arch Linux) which is officially supported by the lead dev? I've tried both the 3.3(Manjaro package is slightly behind) and the AUR git package with cargo dependencies 3.3(different error but fails, presumably need to use an older version of Rust) and 3.4 which gives me this error when using randu.

Set the evironment variable AF_PATH to point to ArrayFire installation root folder.

Not sure if I needed to do this but echoing it was empty, I set it to /usr/lib which contains AF binaries

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib

/usr/lib contains libaf.so, assuming I should set export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib?

Is the problem because I used a package for my OS instead of downloading the binaries from ArrayFire? Is that the only way to use the Crate?

Getting `Invalid Kernel when calling clEnqueueNDRangeKernel`

Hey there!

I'm getting an error when trying to do a custom implementation of a Neural Network (for fun). My code runs fine with the CPU backend (slowly, but fine), but in the CUDA and OPENCL backends, it crashes with the following: (actually, on OPENCL shows this, CUDA doesn't print anything but I assume its the same issue)

In function void opencl::evalNodes(std::vector<opencl::Param>&, std::vector<opencl::JIT::Node*>)
In file src/backend/opencl/jit.cpp:267
OpenCL Error (-48): Invalid Kernel when calling clEnqueueNDRangeKernel

In function af_err af_transpose(void**, af_array, bool)
In file src/api/c/transpose.cpp:51

thread 'main' panicked at 'Error message: Eror either in ArrayFire or in a project upstream', /home/jared/.cargo/registry/src/github.com-1ecc6299db9ec823/arra
yfire-3.4.0/src/error.rs:72

Happy to provide a Rust stacktrace and the code if it's helpful. This is on Ubuntu 16.04, Cuda 8.0, ArrayFire 3.4.2, arrayfire-rust 3.4.0 running on an Nvdia GeForce 980 Ti. Let me know what other information might be useful, and thanks in advance =D

Edit: In case its helpful, here's the Rust code:

// iter of type (usize, (Array, Array)) => (index, (activation, zeta))
let iter = activations.iter().rev().zip(zetas.iter().rev()).rev().enumerate().rev();
// inject / fold / reduce with starting blank delta, receiving
// Array, (usize, (Array, Array)) => delta, (index, (activation, zeta))
let _ = iter.fold(constant::<f64>(0f64, Dim4::new(&[1, 1, 1, 1])), |delta, (index, (activation, zeta))| {
    if index == self.num_layers - 1 {
        self.cost_derivative(activation, target) * tanh_prime(zeta)
    } else if index == 0 {
        nabla_b.push(delta.clone());
        let activation_t = transpose(activation, false);
        let mul = matmul(&delta, &activation_t, MatProp::NONE, MatProp::NONE);
        nabla_w.push(mul.clone());
        delta
    } else {
        let activation_t = transpose(activation, false);
        let mul = matmul(&delta, &activation_t, MatProp::NONE, MatProp::NONE);
        nabla_w.push(mul.clone());
        nabla_b.push(delta.clone());

        let activated = tanh_prime(zeta);
        let weight = transpose(&self.weights[index], false);
        let new_delta = matmul(&weight, &delta, MatProp::NONE, MatProp::NONE) * activated;
        new_delta
    }
});

It's blowing up at the let activation_t = transpose(activation, false); line in the else clause (presumably because that clause is hit before the else if clause?). Specifically, it will blow up with any access to activations data, even a af_print!("", activation) call.

In the iter construction up there, both activations and zetas are of type Vec<Array>. This only happens when, for some reason, I create a neural network who's last layer has more than 3 nodes in it.

Edit 2: I'm using array fire 3.4.2, not 3.4.0:

ArrayFire v3.4.2 (OpenCL, 64-bit Linux, build 2da9967)
[0] NVIDIA  : GeForce GTX 980 Ti, 6076 MB

Better Arrayfire Expressions Syntax

I am thinking of a better way of expressing arrayfire expressions in rust, however still needs some work on the design.

We can create macros describing an arrayfire expressions, like this:

let dims = af::Dim4::new(&[10, 10, 1, 1]);
let a = af::randu(dims, Aftype::F32)
let result = af::expression!(
    |expr, err| println!("'{}' Calculation failure, error: {}", expr, err),
    af::sin(1) / a + a);

let result = af::retry!(
    3,
    |expr, err| println!("'{}' Calcuation failure, error: {}", expr, err),
    af::retry_expression!(af::sin(1) / a + a));

Most of the time I'm quite bored with a lot of and_then appearing in my arrayfire-rust code, and creating a lot of disambiguation in expresstions.

However, the with the error appearing, generally people will:

  1. print the error, save the state and calculated results and let it panic. Then, let other daemon scripts restart the program.
  2. retry the calculation

Improve build mechanism

Would it be possible to pass in command line arguments to cargo instead of editing build.rs to configure the following:

  • Changing the backend
  • Changing the number of threads for make

It should also be possible to use arrayfire that is already installed on the system.

Typed Arrays?

Hi folks,

Thanks for such an awesome official binding, this has opened up a lot of possibilities for Rust and Machine Learning experimentation for me, on my AMD card.

One head-scratching thing for me though, is why Arrays aren't typed in the Rust API? The Arrays are constructed with a typed slice/array, so the information is there at compile time. And, there are methods to get type, so type is clearly stored/available at runtime.

But, there's a big difference between doing a runtime match over the results of an array's get_type method, and building a true generic dispatch. For example, here's what I have right now for a left-rotate:

fn gpu_rotl(x: &af::Array, n: u8) -> af::Array {
    let t = x.get_type();
    let dsize : u8 = match t {
        af::DType::U8 => 8,
        af::DType::U16 => 16,
        af::DType::U32 => 32,
        af::DType::U64 => 64,
        _ => panic!("Array passed to rotl is not of unsigned integer type: {:?}", t),
    };
    let ls = af::shiftl(x, &n, false);
    let rsn = dsize - n;
    let rs = af::shiftr(x, &rsn, false);
    af::bitor(&ls, &rs)
}

AFAIK, the above will result in a runtime match. But, if it were typed appropriately, it might be possible to get a compiled static-dispatch. I imagine that would be better for ArrayFire's JIT, because there wouldn't be a context switch from the GPU operations to the CPU to decide the next action, there would just be a hard-compiled set of operations.

At the very least, appropriate typing would help catch bugs. But I think this might be a performance issue, too?

n-dimensional Arrays

The documentation states

Currently, Array objects can store only data until four dimensions

I would like to learn more about why that is and if there are plans to make it store any kind of n-dim data?

compilation errors with sample code

Got ArrayFile installed fine, tried to run the sample code from here.

main.rs

extern crate arrayfire as af;
use af::*; // Ideally, you should use only names you are about to use, for example purposes * is fine.

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 = match randu(dims, Aftype::F32) {
        Ok(value) => value,
        Err(error) => panic!("{}", error),
    };
    print(&a);
}

Cargo.toml

[package]
name = "af-test"
version = "0.1.0"
authors = ["SomeKittens <[email protected]>"]

[dependencies]
# tried with 3.2.0, same deal
arrayfire = "3.3.0"
$ rustc --version 
rustc 1.9.0 (e4e8b6668 2016-05-18)

Errors from build via cargo run:

src/main.rs:9:31: 9:42 error: failed to resolve. Use of undeclared type or module `Aftype` [E0433]
src/main.rs:9     let a = match randu(dims, Aftype::F32) {
                                            ^~~~~~~~~~~
src/main.rs:9:31: 9:42 help: run `rustc --explain E0433` to see a detailed explanation
src/main.rs:9:19: 9:43 error: this function takes 1 parameter but 2 parameters were supplied [E0061]
src/main.rs:9     let a = match randu(dims, Aftype::F32) {
                                ^~~~~~~~~~~~~~~~~~~~~~~~
src/main.rs:9:19: 9:43 help: run `rustc --explain E0061` to see a detailed explanation
src/main.rs:10:9: 10:18 error: mismatched types:
 expected `af::Array`,
    found `std::result::Result<_, _>`
(expected struct `af::Array`,
    found enum `std::result::Result`) [E0308]
src/main.rs:10         Ok(value) => value,
                       ^~~~~~~~~
src/main.rs:10:9: 10:18 help: run `rustc --explain E0308` to see a detailed explanation
src/main.rs:11:9: 11:19 error: mismatched types:
 expected `af::Array`,
    found `std::result::Result<_, _>`
(expected struct `af::Array`,
    found enum `std::result::Result`) [E0308]
src/main.rs:11         Err(error) => panic!("{}", error),
                       ^~~~~~~~~~
src/main.rs:11:9: 11:19 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 3 previous errors
error: Could not compile `af-test`.

To learn more, run the command again with --verbose.

How to config the rust wrapper using CUDA and how to modify the build.conf file to build arrayfire submodule available in the rust wrapper

Hi, firstly, thanks for your great project. I love rust and arrayfire. I'm a newer to arrayfire. I've installed the latest official cuda 7.5 installer and the latest official arrayfire installers( linux v3.3.1 64-bit) under my ubuntu 15.10. And I use the default configuration follow the official doc. But When I successfully build the arrayfire-rust lib and try to run the "unified" example in the ./examples folder. It shows me i only have cpu and opencl backends. CUDA backend can not be found.
fuying fuying-kylin -rustprojs-arrayfire-rust_010

So my question is :
*# how to config to let this wrapper to support cuda in my computer. *
By the way, the official cpp examples can be built successfully using Cuda.
benchmarks_011

Another question is how to modify the build.conf file to build arrayfire submodule available in the rust wrapper. When I git clone the source from github. The build.conf file looks like:
build conf -home-fuying-rustprojs-arrayfire-rust atom_012
How can I config these options:
"glew_static": "OFF",
"freeimage_type": "DYNAMIC",
"cpu_fft_type": "FFTW",
"cpu_blas_type": "LAPACKE",
"cpu_lapack_type": "LAPACKE",

"freeimage_dir": "E:\\Libraries\\FreeImage\\Dist",
"fftw_dir": "E:\\Libraries\\fftw-3.3.4",
"acml_dir": "",
"mkl_dir": "",
"lapacke_dir": "E:\\Libraries\\lapack",
"glew_dir": "E:\\Libraries\\GLEW",
"glfw_dir": "E:\\Libraries\\glfw3",
"boost_dir": "E:\\Libraries\\boost_1_56_0",

"cuda_sdk": "/usr/local/cuda",
"opencl_sdk": "/usr"

By the way, I check the path of cuda libs, "cuda_sdk" option seems correct. So, what's the problem with my config.
cuda_013

Link errors on Windows

I believe I have set all the environment variables correctly, and I'm using the msvc version of Rust, but I get the following error when building an example. Any ideas?

error: linking with `link.exe` failed: exit code: 1107
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64_x86\\link.exe" "/LIBPATH:C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\lib\\" "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10240.0\\ucrt\\x86" "/LIBPATH:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.10240.0\\um\\x86" "/NOLOGO" "/NXCOMPAT" "/LARGEADDRESSAWARE" "/SAFESEH" "/LIBPATH:C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\rust_wave.0.o" "/OUT:C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\rust_wave.exe" "/OPT:REF,ICF" "/DEBUG" "/LIBPATH:C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps" "/LIBPATH:C:\\Program Files\\ArrayFire\\v3\\lib" "/LIBPATH:C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libarrayfire-b7c27ba721787443.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum-41a23d8da89f5a86.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum_iter-5474aa2e9ebf740f.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\liblazy_static-c4d0c6f844c89335.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\liblibc-2b61e37508f49e74.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum_complex-4882e1ebc5edce6d.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum_rational-ee89253d580e42d4.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum_bigint-374d29c013543b7c.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum_integer-6170c15ee89fe890.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\libnum_traits-1697fd5ceeaaacd2.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\librustc_serialize-7ce9989bca0848e8.rlib" "C:\\Users\\Tim\\Dropbox\\Projects\\RustWave\\target\\debug\\deps\\librand-dc0d8b5a0b199a98.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libstd-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libpanic_unwind-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libunwind-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\liblibc-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\librand-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcollections-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\librustc_unicode-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\liballoc-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\liballoc_system-40393716.rlib" "C:\\Users\\Tim\\.multirust\\toolchains\\stable-i686-pc-windows-msvc\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcore-40393716.rlib" "af.lib" "msvcrt.lib" "advapi32.lib" "ws2_32.lib" "userenv.lib" "shell32.lib" "advapi32.lib" "msvcrt.lib" "compiler-rt.lib"
  = note: libarrayfire-b7c27ba721787443.rlib(arrayfire-b7c27ba721787443.0.o) : error LNK2019: unresolved external symbol _af_get_backend_id referenced in function __ZN9arrayfire5array5Array11get_backend17hb3bfda90775ae64fE
libarrayfire-b7c27ba721787443.rlib(arrayfire-b7c27ba721787443.0.o) : error LNK2019: unresolved external symbol _af_get_device_id referenced in function __ZN9arrayfire5array5Array13get_device_id17h7c00c7de04f47f62E
libarrayfire-b7c27ba721787443.rlib(arrayfire-b7c27ba721787443.0.o) : error LNK2019: unresolved external symbol _af_get_elements referenced in function __ZN9arrayfire5array5Array8elements17hf47a0e6c8fa973a1E
libarrayfire-b7c27ba721787443.rlib(arrayfire-b7c27ba721787443.0.o) : error LNK2019: unresolved external symbol _af_get_type referenced in function __ZN9arrayfire5array5Array8get_type17h0153acc5955f679fE
libarrayfire-b7c27ba721787443.rlib(arrayfire-b7c27ba721787443.0.o) : error LNK2019: unresolved external symbol _af_get_dims referenced in function __ZN9arrayfire5array5Array4dims17h818364306c1dbab0E
libarrayfire-b7c27ba721787443.rlib(arrayfire-b7c27ba721787443.0.o) : error LNK2019: unresolved external symbol _af_get_strides referenced in function __ZN9arrayfire5array5Array7strides17h3ae94fd6ec60cfd7E
...etc...

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.